ppc476 workaround sizing
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-11-20  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
4
5 2014-10-28  Alan Modra  <amodra@gmail.com>
6
7         Apply trunk patches
8         2014-10-22  Alan Modra  <amodra@gmail.com>
9         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
10         thread_starter.
11
12 2014-09-30  Cary Coutant  <ccoutant@google.com>
13
14         PR gold/17432
15         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
16
17 2014-09-30  Kito Cheng  <kito@0xlab.org>
18
19         PR gold/13597
20         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
21         hash table before sysv-style hash table.
22
23 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
24
25         * options.h (--pic-executable): Add negative to alias to -no-pie.
26
27 2014-09-26  Cary Coutant  <ccoutant@google.com>
28
29         PR gold/16773
30         * object.cc (Sized_relobj_file): Compute value of section symbols
31         for TLS sections the same as TLS symbols.
32
33 2014-09-25  Cary Coutant  <ccoutant@google.com>
34
35         PR gold/17432
36         * resolve.cc (Symbol_table::resolve): Override common placeholder
37         symbols, but adjust sizes.
38         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
39         symbols to common lists.
40
41 2014-09-24  Alan Modra  <amodra@gmail.com>
42
43         * po/POTFILES.in: Regenerate.
44
45 2014-09-23  Taiju Tsuiki  <tzik@google.com>
46             Cary Coutant  <ccoutant@google.com>
47
48         PR gold/14860
49         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
50         on input_sections_blocker.
51         * layout.cc (Write_sections_task::locks): Unblock
52         input_sections_blocker_.
53         * layout.h (Write_sections_task::Write_sections_task): Add
54         input_sections_blocker.
55         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
56         to DEPENDENCIES.
57         * testsuite/Makefile.in: Regenerate.
58
59 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
60
61         * testsuite/Makefile.am (plugin_test_10): New test.
62         * testsuite/Makefile.in: Regenerate
63         * testsuite/plugin_common_test_2.c (c1): Align to 8.
64         * testsuite/plugin_test_10.sh: New file.
65
66 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
67
68         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
69         * resolve.cc (Symbol_table::resolve): Don't override common symbols
70         during the replacement phase.
71
72 2014-09-17  Han Shen  <shenhan@google.com>
73             Jing Yu  <jingyu@google.com>
74
75         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
76         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
77         * aarch64.cc (Target_aarch64): Add data members
78         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
79         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
80         constructor.
81         (Target_aarch64::do_reloc_symbol_index): New method.
82         (Target_aarch64::do_reloc_addend): New method.
83         (Target_aarch64::add_tlsdesc_info): New method.
84         (Target_aarch64::do_dynsym_value): New method.
85         (Target_aarch64::do_make_data_plt): Add new parameters: got,
86         got_irelative. Pass them to Output_data_plt_aarch64_standard.
87         (Target_aarch64::make_data_plt): Add new parameters: got,
88         got_irelative. Pass them to do_make_data_plt.
89         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
90         (Target_aarch64::Relocate:tls_gd_to_le): New method.
91         (Target_aarch64::Relocate:tls_ie_to_le): New method.
92         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
93         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
94         (Target_aarch64::got_tlsdesc_section): New method.
95         (Target_aarch64::make_local_ifunc_plt_entry): New method.
96         (Target_aarch64::define_tls_base_symbol): New method.
97         (Target_aarch64::reserve_tlsdesc_entries): New method.
98         (Target_aarch64::got_mod_index_entry): New method.
99         (Target_aarch64::rela_tlsdesc_section): New method.
100         (Target_aarch64::rela_irelative_section): New method.
101         (Target_aarch64::Tlsdesc_info): New struct.
102         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
103         relocations and tlsdesc relocations.
104         (Target_aarch64::optimize_tls_reloc): Implement method.
105         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
106         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
107         in constructor.
108         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
109         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
110         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
111         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
112         (Output_data_plt_aarch64::rela_tlsdesc): New method.
113         (Output_data_plt_aarch64::rela_irelative): New method.
114         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
115         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
116         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
117         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
118         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
119         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
120         (Output_data_plt_aarch64_standard): New member variables:
121         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
122         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
123         New parameter: got, got_irelative.
124         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
125         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
126         (Output_data_plt_aarch64::do_write): Replace got_address with
127         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
128         (AArch64_relocate_functions::update_movnz): New method.
129         (AArch64_relocate_functions): Correct format.
130         (AArch64_relocate_functions::movnz): New method.
131         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
132         before the switch. Add new cases to switch.
133         Check ie_to_le relaxation on tlsie relocations. Add code handling
134         tlsgd tlsdesc cases.
135         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
136         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
137         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
138         Call reloc_name_in_error_message to print unsupported reloc.
139         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
140         make_data_plt.
141         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
142         relocs. Fill in some more dynamic tags.
143         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
144         Skip call tls_get_addr when tlsgd is relaxed.
145         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
146         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
147         tlsdesc->ie relaxation.
148
149 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
150
151         * mips.cc (Target_mips_nacl): New class.
152         (Target_selector_mips_nacl): New class.
153         (target_selector_mips32): Rename from target_selector_mips32be and use
154         Target_selector_mips_nacl instead of Target_selector_mips.
155         (target_selector_mips32el): Rename from target_selector_mips32 and use
156         Target_selector_mips_nacl instead of Target_selector_mips.
157         (target_selector_mips64): Rename from target_selector_mips64be and use
158         Target_selector_mips_nacl instead of Target_selector_mips.
159         (target_selector_mips64el): Rename from target_selector_mips64 and use
160         Target_selector_mips_nacl instead of Target_selector_mips.
161         (Target_mips::mips_info): Add const attribute.
162
163 2014-09-02  Cary Coutant  <ccoutant@google.com>
164
165         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
166         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
167         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
168         (Sized_incr_dynobj::do_section_name): Likewise.
169         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
170         (Sized_incr_dynobj::do_section_name): Likewise.
171         * object.h (Object::section_name): Likewise.
172         (Object::do_section_name): Likewise.
173         (Sized_relobj_file::do_section_name): Likewise.
174         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
175         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
176
177 2014-09-02  Cary Coutant  <ccoutant@google.com>
178
179         PR gold/17005
180         * ehframe.cc (Fde::write): Add output_offset parameter.
181         (Cie::write): Likewise.
182         (Eh_frame::set_final_data_size): Account for offset within output
183         section.
184         (Eh_frame::do_sized_write): Likewise.
185         * ehframe.h (Fde::write): Add output_offset parameter.
186         (Cie::write): Likewise.
187         * output.cc (Output_section::Input_section_sort_entry): Remove
188         section_has_name_; add output_section_name parameter. Use
189         output section name for non-input sections.
190         (Output_section::Input_section_sort_entry::section_has_name): Remove.
191         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
192         (Output_section::Input_section_sort_compare): Remove logic for
193         sections without names.
194         (Output_section::Input_section_sort_init_fini_compare): Likewise.
195         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
196         Likewise.
197         (Output_section::Input_section_sort_section_name_compare): Likewise.
198
199 2014-08-29 Han Shen <shenhan@google.com>
200            Jing Yu <jingyu@google.com>
201
202         * aarch64-reloc-property.cc
203         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
204         reference reloc property in the table.
205         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
206         3 other entries.
207         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
208         2 new overloaded methods.
209         (Output_data_got_aarch64::do_write): Add code to write out
210         static relocs.
211         (class Output_data_got_aarch64::Static_reloc): New class to wrap
212         static relocs.
213         (Output_data_got_aarch64::static_relocs): New vector to
214         hold static relocs.
215         (Target_aarch64::TCB_SIZE): New const static memeber.
216         (Target_aarch64::tcb_size): New method.
217         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
218         (Target_aarch64::Relocate::relocate_tls): New method.
219         (Target_aarch64::Scan::local): Add code handling new reloc types.
220         (Target_aarch64::Scan::global): Add code handling new reloc types.
221
222 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
223
224         * options.h (-no-pie): Add option.
225
226 2014-08-08  Jing Yu  <jingyu@google.com>
227             Han Shen  <shenhan@google.com>
228
229         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
230         (DEFFILES): add aarch64-reloc.def.
231         (TARGETSOURCES): Add aarch64-reloc-property.cc.
232         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
233         * Makefile.in: Regenerate.
234         * aarch64-reloc-property.cc: New file.
235         * aarch64-reloc-property.h: New file.
236         * aarch64-reloc.def: New file.
237         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
238         with tab to make the format consistent.
239         (Output_data_got_aarch64::symbol_table_): New method.
240         (Target_aarch64::do_plt_address_for_global): New method.
241         (Target_aarch64::do_plt_address_for_local): New method.
242         (Target_aarch64::do_select_as_default_target): New method.
243         (Target_aarch64::do_make_data_plt): New method.
244         (Target_aarch64::make_data_plt): New method.
245         (Output_data_plt_aarch64::has_irelative_section): New method.
246         (Output_data_plt_aarch64::address_for_global): New method.
247         (Output_data_plt_aarch64::address_for_local): New method.
248         (Output_data_plt_aarch64::irelative_rel_): New parameter.
249         (Output_data_plt_aarch64::add_entry): Implement contents.
250         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
251         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
252         the got_pov entry to plt0.
253         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
254         Implement contents.
255         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
256         (AArch64_howto): New struct.
257         (aarch64_howto[]): New static const array.
258         (AArch64_relocate_functions): New class.
259         (Target_aarch64::Scan::get_reference_flags): Remove method.
260         (Target_aarch64::Scan::local): Implement to support a few relocations.
261         (Target_aarch64::Scan::global): Implement to support a few relocations.
262         (Target_aarch64::make_plt_section): Implement contents.
263         (Target_aarch64::make_plt_entry): Implement contents.
264         (Target_aarch64::do_finalize_sections): Implement contents.
265         (Target_aarch64::Relocate::relocate): Implement a few relocations.
266         (Target_aarch64::relocate_section): Implement contents.
267
268 2014-08-06  Alan Modra  <amodra@gmail.com>
269
270         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
271
272 2014-08-06  Alan Modra  <amodra@gmail.com>
273
274         PR 13227
275         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
276
277 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
278
279         * object.cc (Relobj::is_section_name_included): Add
280         ".rodata.nptl_version" to not garbage collect this section.
281
282 2014-07-08  Cary Coutant  <ccoutant@google.com>
283
284         * expression.cc (struct Expression::Expression_eval_info): Add
285         new fields type_pointer, vis_pointer, and nonvis_pointer.
286         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
287         nonvis_pointer parameters. Adjust all calls.
288         (Symbol_expression::value): Update type, visibility, and nonvis bits
289         in caller.
290         * script.cc (Symbol_assignment::sized_finalize): Update type,
291         visibility, and remaining st_other bits for new symbol.
292         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
293         vis_pointer, and nonvis_pointer parameters.
294         * symtab.h (Symbol::set_type): New method.
295
296         * testsuite/Makefile.am (defsym_test): New test.
297         * testsuite/Makefile.in: Regenerate.
298         * testsuite/defsym_test.c: New file.
299         * testsuite/defsym_test.sh: New file.
300
301 2014-07-08  Cary Coutant  <ccoutant@google.com>
302
303         PR gold/15639
304         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
305         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
306         (Sized_dynobj::base_read_symbols): ...new method.
307         * object.h (Sized_relobj_file::base_read_symbols): New method.
308         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
309         (Sized_relobj_file::base_read_symbols): ...new method.
310         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
311         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
312         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
313
314 2014-07-04  Alan Modra  <amodra@gmail.com>
315
316         * po/POTFILES.in: Regenerate.
317
318 2014-07-02  Jing Yu  <jingyu@google.com>
319
320         * aarch64.cc: New file
321         * Makefile.am (TARGETSOURCES): Add aarch64.cc
322         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
323         * Makefile.in: Regenerate.
324         * configure.tgt: Add entries for aarch64*.
325         * configure.ac:  Likewise.
326         * configure: Likewise.
327
328 2014-06-27  Alan Modra  <amodra@gmail.com>
329
330         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
331
332 2014-06-24  Cary Coutant  <ccoutant@google.com>
333
334         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
335         sections.
336         (Dwo_file::sized_read_unit_index): Likewise.
337
338 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
339
340         * mips.cc: New file.
341         * Makefile.am (TARGETSOURCES): Add mips.cc
342         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
343         * configure.tgt: Add entries for mips*.
344         * configure.ac: Likewise.
345         * Makefile.in: Regenerate.
346         * configure: Likewise.
347
348 2014-06-09  Cary Coutant  <ccoutant@google.com>
349
350         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
351         unit_length is within section bounds.
352
353 2014-06-09  Cary Coutant  <ccoutant@google.com>
354
355         PR gold/16980
356         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
357         map.
358
359 2014-06-07  Alan Modra  <amodra@gmail.com>
360
361         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
362
363 2014-06-06  Cary Coutant  <ccoutant@google.com>
364
365         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
366         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
367         (Dwarf_pubnames_table::read_header): Likewise.
368         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
369         .debug_gnu_pubtypes.
370
371 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
372
373         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
374         * Makefile.in, configure: Regenerate.
375
376 2014-06-03  Alan Modra  <amodra@gmail.com>
377
378         * powerpc.cc (addis_12_2): Define.
379         (Stub_table::do_write): Support fusion on ELFv2 stubs.
380
381 2014-06-03  Alan Modra  <amodra@gmail.com>
382
383         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
384         st_other output.
385
386 2014-06-02  Alan Modra  <amodra@gmail.com>
387
388         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
389         Only ignore relocs on ELFv1.
390         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
391
392 2014-05-30  Cary Coutant  <ccoutant@google.com>
393
394         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
395         * testsuite/Makefile.in: Regenerate.
396         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
397
398 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
399
400         PR gold/16945
401         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
402         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
403
404 2014-05-15  Alan Modra  <amodra@gmail.com>
405
406         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
407         Compare FDE contents with DW_CFA_nop rather than 0.
408
409 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
410
411         * symtab.h (may_need_copy_reloc): Remove check for position independent
412         code.
413         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
414         position independence before pc absolute may_need_copy_reloc call.
415         Add check for executable output befor pc relative may_need_copy_reloc
416         call.
417         * i386.cc: Ditto.
418         * arm.cc: Ditto.
419         * sparc.cc: Ditto.
420         * tilegx.cc: Ditto.
421         * powerpc.cc: Add check for no position independence before
422         may_need_copy_reloc calls.
423         * testsuite/pie_copyrelocs_test.cc: New file.
424         * testsuite/pie_copyrelocs_shared_test.cc: New file.
425         * Makefile.am (pie_copyrelocs_test): New test.
426         * Makefile.in: Regenerate.
427
428 2014-05-08  Martin Liška  <mliska@suse.cz>
429
430         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
431
432 2014-05-06  Cary Coutant  <ccoutant@google.com>
433
434         PR gold/16900
435         * i386.cc (Output_data_got_plt_i386): New class.
436         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
437         parameter. Change all callers.
438         (Output_data_plt_i386::layout_): Remove.
439         (Output_data_plt_i386::got_plt_): Change type.
440         (Target_i386::got_plt_): Change type. Change all references.
441         (Target_i386::got_section): Create instance of new class.
442         (Output_data_got_plt_i386::do_write): New function.
443         * x86_64.cc (Output_data_got_plt_x86_64): New class.
444         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
445         parameter. Change all callers.
446         (Output_data_plt_x86_64::layout_): Remove.
447         (Output_data_plt_x86_64::got_plt_): Change type.
448         (Target_x86_64::got_plt_): Change type. Change all references.
449         (Target_x86_64::got_section): Create instance of new class.
450         (Output_data_got_plt_x86_64::do_write): New function.
451         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
452         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
453         class.
454
455 2014-05-05  Cary Coutant  <ccoutant@google.com>
456
457         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
458         if we have pubnames/pubtypes.
459
460 2014-05-02  Cary Coutant  <ccoutant@google.com>
461
462         * defstd.cc (in_segment): Define __ehdr_start here...
463         * layout.cc (Layout::finalize): ...Instead of here.  Set the
464         output segment when known.
465         * resolve.cc (Symbol::override_base_with_special): Remember
466         the original binding.
467         * symtab.cc (Symbol::set_output_segment): New function.
468         (Symbol::set_undefined): New function.
469         * symtab.h (Symbol::is_weak_undefined): Check original undef
470         binding.
471         (Symbol::is_strong_undefined): New function.
472         (Symbol::set_output_segment): New function.
473         (Symbol::set_undefined): New function.
474         * target-reloc.h (is_strong_undefined): Remove.
475         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
476         Check for hidden undefs.
477         (relocate_section): Call Symbol::is_strong_undefined.
478
479         * testsuite/Makefile.am (ehdr_start_test_1)
480         (ehdr_start_test_2, ehdr_start_test_3)
481         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
482         * testsuite/Makefile.in: Regenerate.
483         * testsuite/ehdr_start_def.cc: New source file.
484         * testsuite/ehdr_start_test.cc: New source file.
485         * testsuite/ehdr_start_test.t: New linker script.
486         * testsuite/ehdr_start_test_4.sh: New shell script.
487
488 2014-04-23  Cary Coutant  <ccoutant@google.com>
489
490         PR gold/16870
491         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
492
493 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
494
495         * layout.cc (Layout::include_section): Allow a target to decide
496         whether to include a section.
497         * target.h (Target::should_include_section): New function.
498         (Target::do_should_include_section): New function.
499
500 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
501
502         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
503         inline into ...
504         (Copy_relocs::emit): ... here.
505         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
506         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
507         (Copy_reloc_entry::entries_): Change from private to protected.
508
509 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
510
511         * icf.cc (get_section_contents): Replace copies of reloc
512         vectors with const references.
513
514 2014-04-02  Cary Coutant  <ccoutant@google.com>
515
516         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
517         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
518         * configure: Regenerate.
519         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
520         -fno-use-linker-plugin.
521         (LINK1, CXXLINK1): Add it to the link command.
522         * testsuite/Makefile.in: Regenerate.
523
524 2014-03-12  Alan Modra  <amodra@gmail.com>
525
526         * Makefile.in: Regenerate.
527
528 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
529
530         * symtab.h (Symbol::set_nonvis): New function.
531
532 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
533
534         * symtab.cc (Sized_symbol<32>::init_output_data):
535         Instantiate the template.
536         (Sized_symbol<64>::init_output_data): Likewise.
537
538 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
539
540         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
541         adjust dynamic symbol value.
542         * target.h (Target::adjust_dyn_symbol): New function.
543         (Target::do_adjust_dyn_symbol): New function.
544
545 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
546
547         * output.cc (Output_data_dynamic::Dynamic_entry::write):
548         Get the value of DYNAMIC_CUSTOM dynamic entry.
549         * output.h (Output_data_dynamic::add_custom): New function.
550         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
551         dynamic entry.
552         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
553         * target.h (Target::dynamic_tag_custom_value): New function.
554         (Target::do_dynamic_tag_custom_value): New function.
555
556 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
557
558         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
559         dynsym indexes.
560         * target.h (Target::has_custom_set_dynsym_indexes): New function.
561         (Target::do_has_custom_set_dynsym_indexes): New function.
562         (Target::set_dynsym_indexes): New function.
563         (Target::do_set_dynsym_indexes): New function.
564
565 2014-03-07  Alan Modra  <amodra@gmail.com>
566
567         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
568         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
569         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
570         (Powerpc_relocate_functions::has_overflow_bitfield,
571         overflowed): Use the above.
572         (Target_powerpc::Relocate::relocate): Correct overflow checking
573         for a number of relocations.  Modify overflow test for 16-bit
574         fields in instructions to signed/unsigned according to whether
575         the field takes a signed or unsigned value.
576
577 2014-03-05  Alan Modra  <amodra@gmail.com>
578
579         Update copyright years.
580
581 2014-03-05  Alan Modra  <amodra@gmail.com>
582
583         * powerpc.cc (Target_powerpc::Scan::local, global): Support
584         R_PPC64_ADDR64_LOCAL.
585         (Target_powerpc::Relocate::relocate): Likewise.
586
587 2014-03-03  Alan Modra  <amodra@gmail.com>
588
589         * dwp.cc (print_version): Update copyright year to current.
590
591 2014-02-10  Alan Modra  <amodra@gmail.com>
592
593         * po/gold.pot: Regenerate.
594
595 2014-02-06  Cary Coutant  <ccoutant@google.com>
596
597         Fix problem where -u is ignored when a weak undef is seen.
598
599         * archive.cc (Library_base::should_include_member): Reorder
600         code to check for -u option if a weak undef has already been seen.
601         * testsuite/Makefile.am (weak_undef_test_2): New test case.
602         * testsuite/Makefile.in: Regenerate.
603         * testsuite/weak_undef_file3.cc: New file.
604         * testsuite/weak_undef_file4.cc: New file.
605         * testsuite/weak_undef_test_2.cc: New file.
606
607 2014-02-05  Cary Coutant  <ccoutant@google.com>
608
609         Fix issues with gold undefined symbol diagnostics.
610
611         PR binutils/15435
612         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
613         check to here.
614         * target-reloc.h (is_strong_undefined): New function.
615         (relocate_section): Move undef vtable symbol check from here.
616         Check for is_strong_undefined.
617
618 2014-02-05  Cary Coutant  <ccoutant@google.com>
619
620         Fix problems with the --dynamic-list option.
621
622         PR gold/13577
623         * options.cc (General_options::parse_dynamic_list):
624         Set have_dynamic_list_.
625         (General_options::General_options): Initialize have_dynamic_list_.
626         (General_options::finalize): Turn off -Bsymbolic and
627         -Bsymbolic-functions if --dynamic-list provided.
628         * options.h (General_options::have_dynamic_list): New function.
629         (General_options::have_dynamic_list_): New data member.
630         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
631         correctly.
632
633         PR gold/16530
634         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
635         in --dynamic-list, mark it.
636
637         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
638         (dynamic_list_2): New test case.
639         * testsuite/Makefile.in: Regenerate.
640         * testsuite/dynamic_list_2.cc: New file.
641         * testsuite/dynamic_list_2.t: New file.
642         * testsuite/dynamic_list_lib1.cc: New file.
643         * testsuite/dynamic_list_lib2.cc: New file.
644         * testsuite/gc_dynamic_list_test.c: New file.
645         * testsuite/gc_dynamic_list_test.sh: New file.
646         * testsuite/gc_dynamic_list_test.t: New file.
647
648 2014-01-28  Cary Coutant  <ccoutant@google.com>
649
650         Add .gdb_index version 7 support.
651
652         * gold/dwarf_reader.cc: include <utility> (for make_pair).
653         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
654         debug sections.
655         (Dwarf_ranges_table::read_ranges_table): Likewise.
656         (Dwarf_pubnames_table::read_section): Check for GNU-style
657         sections, and for compressed debug sections.
658         (Dwarf_pubnames_table::read_header): Compute end address of table.
659         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
660         for end of list by offset, not by offset == 0.
661         (Dwarf_info_reader::do_read_string_table): Check for compressed
662         debug sections.
663         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
664         Initialize new data members.
665         (Dwarf_pubnames_table::next_name): return flag_byte.
666         (Dwarf_pubnames_table::end_of_table_): New data member.
667         (Dwarf_pubnames_table::is_gnu_style_): New data member.
668         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
669         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
670         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
671         read skeleton type unit DIEs.
672         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
673         (Gdb_index::do_write): Write flag_byte.
674         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
675         (Gdb_index::Cu_vector): Store flags along with cu indexes.
676         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
677         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
678
679 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
680
681         * version.cc (print_version): Update copyright year to 2014.
682
683 2013-12-19  Dimitry Andric  <dimitry@andric.com>
684
685         * stringpool.cc (Stringpool_template::reserve): Add
686         HAVE_UNORDERED_MAP case.
687         * stringpool.cc (Stringpool_template::print_stats): Likewise.
688
689 2013-12-18  Cary Coutant  <ccoutant@google.com>
690
691         * configure.ac: Check for <unordered_set> and <unordered_map>.
692         * config.in: Regenerate.
693         * configure: Regenerate.
694         * system.h: Use <unordered_set> and <unordered_map> if available.
695
696 2013-12-10  Roland McGrath  <mcgrathr@google.com>
697
698         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
699         with $(INSTALL_PROGRAM_ENV).
700         * Makefile.in: Regenerate.
701
702 2013-11-22  Cary Coutant  <ccoutant@google.com>
703
704         * configure.ac: Add check for which library is needed for
705         dlopen.
706         * configure: Regenerate.
707
708 2013-11-22  Cary Coutant  <ccoutant@google.com>
709
710         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
711         assembler.
712         * testsuite/Makefile.in: Regenerate.
713
714 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
715
716         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
717         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
718         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
719         (Target_x86_64<size>::Scan::local): Likewise.
720         (Target_x86_64<size>::Scan::global): Likewise.
721         (Target_x86_64<size>::Relocate::relocate): Likewise.
722         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
723         Likewise.
724         (Target_x86_64<size>::Scan::check_non_pic(): Handle
725         R_X86_64_PC32_BND.
726
727         * testsuite/Makefile.am (check_PROGRAMS): Add
728         exception_x86_64_bnd_test.
729         (exception_x86_64_bnd_test_SOURCES): New macro.
730         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
731         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
732         (exception_x86_64_bnd_test_LDADD): Likewise.
733         (exception_x86_64_bnd_1.o): New rule.
734         (exception_x86_64_bnd_2.o): Likewise.
735         * testsuite/Makefile.in: Regenerated.
736
737 2013-11-15  Alan Modra  <amodra@gmail.com>
738
739         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
740         accessor.
741         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
742         Only call ppc64_local_entry_offset for 64-bit.  Restrict
743         symval_for_branch lookup to ELFv1.
744         (Stub_table::add_plt_call_entry): Use unsigned int off.
745         (Output_data_glink::Address, invalid_address): New.
746         (Output_data_glink::add_eh_frame): Move out of line.  Add
747         support for ELFv2.
748         (Output_data_glink::add_global_entry, find_global_entry,
749         global_entry_address): New functions.
750         (Output_data_glink::global_entry_stubs_, end_branch_table_,
751         ge_size): New variables.
752         (Output_data_glink::set_final_data_size): Add global entry
753         stub sizing.
754         (Output_data_glink::do_write): Write global entry stubs.
755         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
756         parameter.  Return true for ELFv2.  Adjust callers.
757         (Target_powerpc::Scan::local, global): Restrict opd lookup to
758         ELFv1.  Similarly for ifunc and dynamic relocation processing
759         specific to ELFv1.  Recognize that symbols are defined on
760         their plt entries for ELFv2.
761         (Target_powerpc::symval_for_branch): Assert if called for
762         ELFv2 or ppc32.
763         (Target_powerpc::Relocate::relocate): Use global entry plt
764         stub for symbol value if such exists on ELFv2.
765         (Target_powerpc::Relocate::relocate): Don't call
766         symval_for_branch when ELFv2.  Do adjust for local entry
767         offset when ELFv2.
768         (Target_powerpc::do_dynsym_value): Set symbols to global entry
769         plt stub for ELFv2.
770         (Target_powerpc::do_plt_address_for_global): Similarly.
771
772 2013-11-14  Cary Coutant  <ccoutant@google.com>
773
774         Revert patch -- this did not fix the problem, and there is
775         no race there.
776
777         2013-11-14  Cary Coutant  <ccoutant@google.com>
778
779             PR gold/14860
780             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
781             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
782             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
783             updating fde_offsets_.
784             (Eh_frame_hdr::lock_): New data member.
785
786 2013-11-14  Cary Coutant  <ccoutant@google.com>
787
788         * dwp.cc (Dwo_file_entry): New type.
789         (File_list): Use Dwo_file_entry.
790         (Dwo_file::verify): New function.
791         (Dwo_file::verify_dwo_list): New function.
792         (Dwo_file::sized_verify_dwo_list): New function.
793         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
794         list.
795         (Dwp_options): New enum type.
796         (dwp_options): Add --verify-only.
797         (usage): Likewise.
798         (main): Likewise.
799         * dwp.h (gold_info): Add declaration.
800
801 2013-11-14  Cary Coutant  <ccoutant@google.com>
802
803         PR gold/14860
804         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
805         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
806         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
807         updating fde_offsets_.
808         (Eh_frame_hdr::lock_): New data member.
809
810 2013-11-06  Cary Coutant  <ccoutant@google.com>
811
812         PR gold/15758
813         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
814         before reloc sections.
815
816 2013-11-04  Alan Modra  <amodra@gmail.com>
817
818         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
819         (Symbol::needs_dynamic_reloc): Test new flag.
820         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
821         (Target_powerpc::Scan::get_reference_flags): Add target param.
822         Return FUNC_DESC_ABI for 64-bit ELFv1.
823         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
824         call.
825         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
826         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
827
828 2013-10-31  Cary Coutant  <ccoutant@google.com>
829
830         Restore support for dwp v2 DWARF package file format.
831
832         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
833         tu_length parameter.  Adjust all callers.
834         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
835         * dwp.cc: Include dwarf.h.
836         (Section_bounds): New struct type.
837         (Unit_set): New struct type.
838         (Dwo_file::Dwo_file): Initialize new data member.
839         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
840         Combine and rename to...
841         (Dwo_file::read_unit_index): ...this.
842         (Dwo_file::sized_read_compunit_index)
843         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
844         (Dwo_file::sized_read_unit_index): ...this.
845         (Dwo_file::copy_section): Remove section_name, is_str_offsets
846         parameters; add section_id parameter.
847         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
848         (Dwo_file::add_unit_set): ...this.
849         (Dwo_file::shndx_map_): Remove.
850         (Dwo_file::sect_offsets_): New data member.
851         (Dwp_output_file::Dwp_output_file): Initialize new data members.
852         (Dwp_output_file::add_section): Rename to...
853         (Dwp_output_file::add_contribution): ...this.
854         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
855         (Dwp_output_file::add_tu_set): Likewise.
856         (Dwp_output_file::Contribution): New type.
857         (Dwp_output_file::Section::contributions): New data member.
858         (Dwp_output_file::Cu_or_tu_set): Remove.
859         (Dwp_output_file::Section::Section): New ctor.
860         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
861         (Dwp_output_file::Dwp_index::Section_table): New type.
862         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
863         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
864         parameter.
865         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
866         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
867         (Dwp_output_file::Dwp_index::section_table): New member function.
868         (Dwp_output_file::Dwp_index::section_table_end): New member function.
869         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
870         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
871         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
872         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
873         (Dwp_output_file::Dwp_index::section_table_): New data member.
874         (Dwp_output_file::Dwp_index::section_mask_): New data member.
875         (Dwp_output_file::add_output_section): New member function.
876         (Dwp_output_file::write_new_section): New member function.
877         (Dwp_output_file::write_contributions): New member function.
878         (Dwp_output_file::section_id_map_): New data member.
879         (class Dwo_id_info_reader): Remove.
880         (class Unit_reader): New class.
881         (get_dwarf_section_name): New function.
882         (Dwo_file::read_executable): Adjust initializations of class data.
883         (Dwo_file::read): Add support for v2 package file format.
884         (Dwo_file::read_unit_index): Likewise.
885         (Dwo_file::sized_read_unit_index): Likewise.
886         (Dwo_file::copy_section): Likewise.
887         (Dwo_file::add_unit_set): Likewise.
888         (Dwp_output_file::add_output_section): Likewise.
889         (Dwp_output_file::add_contribution): Likewise.
890         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
891         for empty slot.
892         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
893         file format.
894         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
895         slot.
896         (Dwp_output_file::initialize): Remove unused function.
897         (Dwp_output_file::finalize): Add support for v2 package file format.
898         (Dwp_output_file::write_index): Likewise.
899         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
900         function prototype.
901
902 2013-10-31  Cary Coutant  <ccoutant@google.com>
903
904         * configure.ac: Fix check for -fmerge-constants.
905         * configure.ac: Regenerate.
906
907 2013-10-30  Roland McGrath  <mcgrathr@google.com>
908
909         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
910         Correct 9-byte nop sequence to match what the assembler generates.
911
912 2013-10-30  Alan Modra  <amodra@gmail.com>
913
914         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
915         ppc64_local_entry_offset, ppc64_local_entry_offset,
916         do_read_symbols): New functions.
917         (Powerpc_relobj::e_flags_, st_other_): New vars.
918         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
919         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
920         (Powerpc_relobj::e_flags_): New var.
921         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
922         and adjust for ELFv2.
923         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
924         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
925         (Powerpc_dynobj::do_find_special_sections): Likewise.
926         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
927         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
928         to ELFv2 local entry.
929         (Target_powerpc::do_relax): No thread safe barriers needed for
930         ELFv2.
931         (Output_data_plt_powerpc::initial_plt_entry_size_,
932         plt_entry_size): Delete.  Replace all uses with
933         first_plt_entry_offset() and plt_entry_size().
934         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
935         reserved_size parm.  Update callers.
936         (Output_data_plt_powerpc::entry_count): Update.
937         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
938         and use Target_powerpc::first_plt_entry_offset().
939         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
940         rename to plt_entry_size.
941         (Output_data_plt_powerpc::add_ifunc_entry,
942         add_local_ifunc_entry): Adjust reloc for ELFv2.
943         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
944         (glink_eh_frame_fde_64v2): New.
945         (Stub_table::plt_call_size): Support ELFv2 sizing.
946         (Output_data_glink::add_eh_frame): Use the new FDE.
947         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
948         (Stub_table::do_write): Write ELFv2 stubs and glink.
949         (Target_powerpc::Relocate::relocate): Replaces nop after call
950         with ld 2,24(1) and adjust local offset destination for ELFv2.
951
952 2013-10-30  Alan Modra  <amodra@gmail.com>
953
954         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
955         (Target_powerpc::Scan::global, local): Likewise.
956         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
957         on all ppc64 @h and @ha relocs.
958
959 2013-10-14  Alan Modra  <amodra@gmail.com>
960
961         * output.h (Output_data_got::add_constant): Tidy.
962         (Output_data_got::add_constant_pair): New function.
963         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
964         methods used so as to first call reserve_ent().
965
966 2013-10-11  Roland McGrath  <mcgrathr@google.com>
967
968         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
969         add_got_entry and add_got_entry_pair.
970
971         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
972         (HAVE_PUBNAMES): Likewise.
973         * configure: Regenerate.
974
975         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
976         * testsuite/Makefile.in: Regenerate.
977
978         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
979         Remove const from declaration.
980         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
981         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
982         * output.h (Output_file_header): Remove const from member target_
983         and corresponding constructor argument.
984         * output.cc (Output_file_header::Output_file_header): Update prototype.
985         (Output_file_header::do_sized_write): Use this->target_ in place
986         of parameters()->target().
987
988         * testsuite/undef_symbol.cc (Foo::get_a): New method.
989
990         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
991         * configure: Regenerate.
992         * Makefile.in: Regenerate.
993         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
994         * testsuite/merge_string_literals_2.c: Likewise.
995         * testsuite/Makefile.am
996         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
997         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
998         literal -fmerge-constants.
999         * testsuite/Makefile.in: Regenerate.
1000
1001         * i386.cc (Target_i386): Remove unused member dynbss_.
1002         * arm.cc (Target_arm): Likewise.
1003         * powerpc.cc (Target_powerpc): Likewise.
1004         * sparc.cc (Target_sparc): Likewise.
1005         * tilegx.cc (Target_tilegx): Likewise.
1006         * x86_64.cc (Target_x86_64): Likewise.
1007         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1008         type_signature_, type_offset_.
1009         * plugin.h (Plugin_hook): Remove unused member layout_.
1010         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1011         mapfile_.
1012         (Read_member): Remove unused members input_objects_, symtab_,
1013         mapfile_, layout_.
1014         (Check_library): Remove unused member symtab_.
1015         * archive.h (Lib_group): Remove unused member lib_.
1016         * archive.cc (Lib_group::Lib_group): Update initializer.
1017         * incremental.h (Incremental_binary): Remove unused member target_.
1018         (Incremental_script_entry): Removed unused member script_.
1019         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1020         * icf.h (Icf): Remove unused member num_tracked_relocs.
1021
1022         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1023         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1024         its only use.
1025         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1026
1027         * archive.h: Use struct rather than class for forward declaration
1028         of Read_symbols_data.
1029
1030 2013-10-07  Cary Coutant  <ccoutant@google.com>
1031
1032         PR gold/16010
1033         * testsuite/Makefile.am (icf_test): Fix dependencies.
1034         (icf_safe_test): Likewise.
1035         (icf_safe_so_test): Likewise.
1036         (large_symbol_alignment): Add empty _LDADD rule.
1037         * testsuite/Makefile.in: Regenerate.
1038
1039 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1040
1041         PR gold/15927
1042         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1043         relocation for R_X86_64_32 on x32.
1044
1045 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1046
1047         * output.cc (Output_segment::set_section_addresses): Take new
1048         Target* argument.  If target->isolate_execinstr() and the segment
1049         is executable and starts at a target->abi_pagesize() boundary,
1050         pad its end out to a target->abi_pagesize() boundary with code fill.
1051         * output.h (Output_segment::set_section_addresses): Update decl.
1052         * layout.h (Layout::check_output_data_for_reset_values): Take new
1053         argument RELAX_OUTPUTS.
1054         (Layout): New member relax_output_list_.
1055         (Layout::add_relax_output): New method.
1056         * layout.cc (Layout::Layout): Update constructor.
1057         (Layout::reset_relax_output): New method.
1058         (Layout::clean_up_after_relaxation): Call it.
1059         (Layout::prepare_for_relaxation): Update caller.
1060         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1061         Call reset_relax_output before re-processing segments for
1062         isolate_execinstr case.
1063         (Layout::write_data): Handle relax_output_list_.
1064         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1065         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1066
1067 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1068
1069         PR binutils/15834
1070         * object.h: Fix typos.
1071
1072 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1073
1074         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1075         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1076
1077 2013-08-07  Cary Coutant  <ccoutant@google.com>
1078
1079         Revert support for v2 DWP files:
1080
1081         2013-03-01  Cary Coutant  <ccoutant@google.com>
1082
1083             Add dwp support for v2 DWARF package file format.
1084             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1085             tu_length parameter.  Adjust all callers.
1086             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1087             * dwp.cc: Include dwarf.h.
1088             (Section_bounds): New struct type.
1089             (Unit_set): New struct type.
1090             (Dwo_file::Dwo_file): Initialize new data member.
1091             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1092             Combine and rename to...
1093             (Dwo_file::read_unit_index): ...this.
1094             (Dwo_file::sized_read_compunit_index)
1095             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1096             (Dwo_file::sized_read_unit_index): ...this.
1097             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1098             parameters; add section_id parameter.
1099             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1100             (Dwo_file::add_unit_set): ...this.
1101             (Dwo_file::shndx_map_): Remove.
1102             (Dwo_file::sect_offsets_): New data member.
1103             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1104             (Dwp_output_file::add_section): Rename to...
1105             (Dwp_output_file::add_contribution): ...this.
1106             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1107             (Dwp_output_file::add_tu_set): Likewise.
1108             (Dwp_output_file::Contribution): New type.
1109             (Dwp_output_file::Section::contributions): New data member.
1110             (Dwp_output_file::Cu_or_tu_set): Remove.
1111             (Dwp_output_file::Section::Section): New ctor.
1112             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1113             (Dwp_output_file::Dwp_index::Section_table): New type.
1114             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1115             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1116             parameter.
1117             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1118             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1119             (Dwp_output_file::Dwp_index::section_table): New member function.
1120             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1121             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1122             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1123             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1124             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1125             (Dwp_output_file::Dwp_index::section_table_): New data member.
1126             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1127             (Dwp_output_file::add_output_section): New member function.
1128             (Dwp_output_file::write_new_section): New member function.
1129             (Dwp_output_file::write_contributions): New member function.
1130             (Dwp_output_file::section_id_map_): New data member.
1131             (class Dwo_id_info_reader): Remove.
1132             (class Unit_reader): New class.
1133             (get_dwarf_section_name): New function.
1134             (Dwo_file::read_executable): Adjust initializations of class data.
1135             (Dwo_file::read): Add support for v2 package file format.
1136             (Dwo_file::read_unit_index): Likewise.
1137             (Dwo_file::sized_read_unit_index): Likewise.
1138             (Dwo_file::copy_section): Likewise.
1139             (Dwo_file::add_unit_set): Likewise.
1140             (Dwp_output_file::add_output_section): Likewise.
1141             (Dwp_output_file::add_contribution): Likewise.
1142             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1143             for empty slot.
1144             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1145             file format.
1146             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1147             slot.
1148             (Dwp_output_file::initialize): Remove unused function.
1149             (Dwp_output_file::finalize): Add support for v2 package file format.
1150             (Dwp_output_file::write_index): Likewise.
1151             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1152             function prototype.
1153
1154 2013-07-31  Cary Coutant  <ccoutant@google.com>
1155
1156         * object.cc (Sized_relobj::do_output_section_address): New function.
1157         (Sized_relobj): Instantiate explicitly.
1158         * object.h (Object::output_section_address): New function.
1159         (Object::do_output_section_address): New function.
1160         (Sized_relobj::do_output_section_address): New function.
1161         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1162
1163 2013-07-30  Cary Coutant  <ccoutant@google.com>
1164             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1165
1166         * parameters.cc (Parameters::entry): Return target-specific entry
1167         symbol name.
1168         * target.h (Target::entry_symbol_name): New function.
1169         (Target_info::entry_symbol_name): New data member.
1170
1171         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1172         * i386.cc (Target_i386::i386_info): Likewise.
1173         (Target_i386_nacl::i386_nacl_info): Likewise.
1174         * sparc.cc (Target_sparc::sparc_info): Likewise.
1175         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1176         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1177         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1178         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1179
1180 2013-07-22  Sterling Augustine  <saugustine@google.com>
1181
1182         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1183         Convert parameter shndx to local variable. Add parameters symtab
1184         and symtab_size.  Scan over section names.  Find relocation
1185         section corresponding to current section.  Create and initialize
1186         reloc_mapper_ and reloc_type_.
1187         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1188         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1189         cu_offset_.
1190         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1191         Initialize new fields unit_length_ and cu_offset_.
1192         (Dwarf_pubnames_table::read_section): Update prototype.
1193         (Dwarf_pubnames_table::cu_offset): New member function.
1194         (Dwarf_pubnames_table::subsection_size): Likewise.
1195         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1196         New fields.
1197         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1198         member functions public.
1199         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1200         Update comment.  Rework logic.  Move repeated parts to...
1201         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1202         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1203         pubtypes_table_, and stmt_list_offset.
1204         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1205         Gdb_index::find_pubtype_offset,
1206         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1207         (Gdb_index::pubnames_read): Update prototype and rework logic.
1208         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1209         Forward declare.
1210         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1211         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1212         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1213         Gdb_index::map_pubtable_to_dies):
1214         Declare functions.
1215         (Gdb_index::pubnames_read): Update declaration.
1216         (Gdb_index::Pubname_offset_map): New type.
1217         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1218         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1219         Gdb_index::stmt_list_offset): Declare.
1220         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1221         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1222         Gdb_index::pubtypes_offset_): Remove.
1223
1224 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1225
1226         * options.h (General_options): Add -Trodata-segment option.
1227         * parameters.cc (Parameters::check_rodata_segment): New function.
1228         (Parameters::set_target_once): Call it.
1229         * parameters.h (Parameters): Declare it (private member function).
1230         * layout.cc (load_seg_unusable_for_headers): New function, broken
1231         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1232         then validate rodata segment rather than text segment.
1233         (relaxation_loop_body): Call that.
1234         (is_text_segment): New function.  Don't admit a non-executable
1235         segment if TARGET->isolate_execinstr().
1236         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1237
1238 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1239
1240         PR gold/15070
1241         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1242         * nacl.h (Sniff_file::View::View): Request aligned view.
1243
1244 2013-07-11  Cary Coutant  <ccoutant@google.com>
1245
1246         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1247         correct BRLT entry size.
1248
1249 2013-07-03  Alan Modra  <amodra@gmail.com>
1250
1251         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1252         comment.
1253
1254 2013-07-01  Cary Coutant  <ccoutant@google.com>
1255
1256         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1257         reloc_type_.
1258         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1259         (Dwarf_ranges_table::lookup_reloc): New function.
1260         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1261         reloc_type_.
1262         (Dwarf_ranges_table::lookup_reloc): New function.
1263         (Dwarf_ranges_table::reloc_type_): New data member.
1264
1265 2013-06-27  Jing Yu  <jingyu@google.com>
1266
1267         PR gold/15662
1268         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1269         function.
1270         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1271         (Target_powerpc::do_relax): Call the above.
1272
1273 2013-06-27  Cary Coutant  <ccoutant@google.com>
1274
1275         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1276         on garbage collected .opd section.
1277
1278 2013-06-27  Alan Modra  <amodra@gmail.com>
1279
1280         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1281         is non-zero.
1282         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1283         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1284
1285 2013-06-14  Cary Coutant  <ccoutant@google.com>
1286
1287         * resolve.cc (Symbol::override_base): Don't override st_type
1288         from plugin placeholder symbols.
1289         (Symbol_table::resolve): Likewise.
1290         (Symbol_table::should_override): Don't complain about TLS mismatch
1291         if the TO symbol is a plugin placeholder.
1292         * testsuite/Makefile.am (plugin_test_tls): New test.
1293         * testsuite/Makefile.in: Regenerate.
1294         * testsuite/plugin_test_tls.sh: New test script.
1295         * testsuite/two_file_test_2_tls.cc: New test source.
1296         * testsuite/two_file_test_tls.cc: New test source.
1297
1298 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1299
1300         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1301         the maximum segment alignment is larger than the page size.
1302         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1303         correctly aligns the symbols with large alignemnt.
1304         * testsuite/Makefile.in: Regenerate.
1305         * testsuite/large_symbol_alignment.cc: New file.
1306
1307 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1308             Sriraman Tallam  <tmsriram@google.com>
1309
1310         * options.h (sort_section): New option.
1311         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1312         Rename from Input_section_sort_section_name_special_ordering_compare.
1313         (Input_section_sort_section_name_compare): New struct.
1314         * output.cc (Output_section::Input_section_sort_section_name_compare::
1315         operator()): New function.
1316         (Output_section::sort_attached_input_sections): Use new sort function
1317         for .text if --sort-section=name is specified.
1318         * layout.cc (Layout::make_output_section):
1319         Add sorting by name when --sort-section=name is specified.
1320         * testsuite/Makefile.am (text_section_grouping): Test option
1321         --sort-section=name.
1322         * testsuite/Makefile.in: Regenerate.
1323         * testsuite/section_sorting_name.cc: New file.
1324         * testsuite/section_sorting_name.sh: New file.
1325
1326 2013-05-21  Cary Coutant  <ccoutant@google.com>
1327
1328         * symtab.h (Symbol::is_cxx_vtable): New function.
1329         * target-reloc.h (relocate_section): Check for vtable symbol.
1330         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1331         * testsuite/Makefile.in: Regenerate.
1332         * testsuite/missing_key_func.cc: New test source.
1333         * testsuite/missing_key_func.sh: New test script.
1334
1335 2013-05-21  Cary Coutant  <ccoutant@google.com>
1336
1337         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1338         type of enclosing symbol.
1339         (Relocate_info::location): Check symbol type when describing symbol.
1340         * object.h (Symbol_location_info): Remove unused line_number;
1341         add enclosing_symbol_type.
1342         * testsuite/debug_msg.sh: Adjust expected output.
1343
1344 2013-05-13  Cary Coutant  <ccoutant@google.com>
1345
1346         * configure.ac: Export DEFAULT_TARGET.
1347         * configure: Regenerate.
1348         * Makefile.in: Regenerate.
1349         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1350         * testsuite/Makefile.in: Regenerate.
1351         * testsuite/debug_msg.sh: Delete duplicate tests.
1352         Don't check undef_int error message match for powerpc where the
1353         source file and line number aren't available.
1354
1355 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1356
1357         * options.h (General_options): Add --rosegment-gap option.
1358         * options.cc (finalize): --rosegment-gap implies --rosegment.
1359         * layout.cc (set_segment_offsets): Let user option override
1360         target->rosegment_gap().
1361
1362 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1363
1364         * options.h (General_options): Remove leading space from help
1365         messages for -nostdlib and --rosegment.
1366
1367 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1368
1369         PR ld/15365
1370         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1371
1372 2013-05-03  Alan Modra  <amodra@gmail.com>
1373
1374         * merge.cc (Output_merge_string::do_add_input_section): Correct
1375         scan for number of strings.  Rename vars to avoid shadowing.
1376         Include missing terminator in input_size_.
1377
1378 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1379
1380         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1381         Restore empty string handling.
1382
1383 2013-05-01  Cary Coutant  <ccoutant@google.com>
1384
1385         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1386         uninitialized warning.
1387
1388 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1389
1390         * output.cc (Output_section::add_merge_input_section): Allow
1391         to merge sections if the alignment is more than character size.
1392         * merge.h (Output_merge_string::Output_merge_string): Remove
1393         assert.
1394         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1395         only not-null strings. Check the alignment of strings.
1396         * stringpool.h
1397         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1398         alignment as the argument.
1399         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1400         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1401         Align non-zero length strings according to the addralign_.
1402         (Stringpool_template<Stringpool_char>::set_string_offsets):
1403         Updating offsets according to the given alignment.
1404         * testsuite/Makefile.am (text_section_grouping): Test if string
1405         literals are getting merged.
1406         * testsuite/Makefile.in: Regenerate.
1407         * testsuite/merge_string_literals_1.c: New file.
1408         * testsuite/merge_string_literals_2.c: Ditto.
1409         * testsuite/merge_string_literals.sh: Ditto.
1410
1411 2013-04-26  Ian Lance Taylor  <iant@google.com>
1412
1413         * target-reloc.h (relocate_section): If the reloc offset is out of
1414         range, pass VIEW as NULL to relocate.relocate.
1415         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1416         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1417         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1418         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1419         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1420         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1421
1422 2013-04-26  Geoff Pike  <gpike@chromium.org>
1423
1424         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1425         * layout.cc (Hash_task): New class.
1426         (Layout::queue_build_id_tasks): New function.
1427         (Layout::write_build_id): Handle single-thread portion of build ID
1428         computation.  (In some cases, all of it is single-threaded.)  Replace
1429         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1430         functionality in fewer lines of code.
1431         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1432         * options.h (General_options): make "--build-id" default to tree
1433         rather than sha1.  Add two new options related to --build-id=tree:
1434         --build-id-chunk-size-for-treehash and
1435         --build-id-min-file-size-for-treehash.
1436         * Makefile.am: add testing of --build-id=tree and related new options
1437         (these tests will be invoked by "make check").
1438         * Makefile.in: Regenerate.
1439
1440 2013-04-25  Alan Modra  <amodra@gmail.com>
1441
1442         * configure.tgt: Add powerpcle and powerpc64le.
1443
1444 2013-04-22  Alan Modra  <amodra@gmail.com>
1445
1446         PR gold/15355
1447         * layout.cc (Layout::segment_precedes): Allow more than one
1448         segment with the same type and flags.
1449
1450 2013-04-15  Cary Coutant  <ccoutant@google.com>
1451
1452         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1453         allocate space in file for BSS sections.
1454
1455 2013-04-15  Cary Coutant  <ccoutant@google.com>
1456
1457         * script-sections.cc (Orphan_output_section): Reset address
1458         to zero after each orphaned section for relocatable links.
1459
1460 2013-04-15  Cary Coutant  <ccoutant@google.com>
1461
1462         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1463         section starting address for relocatable link.
1464         * testsuite/Makefile.am (script_test_11): New test.
1465         * testsuite/Makefile.in: Regenerate.
1466         * testsuite/script_test_11.c: New source file.
1467         * testsuite/script_test_11.t: New linker script.
1468
1469 2013-04-13  Alan Modra  <amodra@gmail.com>
1470
1471         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1472         owner when sections are not adjacent and exceed group size.
1473         (Target_powerpc::group_sections): Handle corner case.
1474         (Target_powerpc::Branch_info::make_stub): Handle case where
1475         stub table doesn't exist due to branches in non-exec sections.
1476         (Target_powerpc::Relocate::relocate): Likewise.
1477
1478 2013-04-11  Alan Modra  <amodra@gmail.com>
1479
1480         PR gold/15354
1481         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1482         .branch_lt to match bfd ld.  Adjust comments throughout file.
1483
1484 2013-04-04  Ian Lance Taylor  <iant@google.com>
1485
1486         GCC PR c++/56840
1487         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1488         sections before checking whether they are included in the link.
1489
1490 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1491
1492         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1493         object before calling the plugin claim_file handler.  Pass the elf
1494         object of the archive to the plugin. Delete the elf object if the
1495         plugin claims the file.
1496
1497 2013-03-21  Alan Modra  <amodra@gmail.com>
1498
1499         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1500         segment when omagic.
1501
1502 2013-03-21  Alan Modra  <amodra@gmail.com>
1503
1504         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1505         comparison warning.
1506         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1507         uninitialized" warning.
1508
1509 2013-03-20  Alan Modra  <amodra@gmail.com>
1510
1511         * symtab.h (Symbol::clear_version): New function.
1512         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1513         is_needed by weak references.  Clear version for symbols defined
1514         in as-needed objects that are not needed.
1515
1516 2013-03-15  Alan Modra  <amodra@gmail.com>
1517
1518         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1519         static and public.  Add report_err param.  Return false for data refs.
1520         (Target_powerpc::rela_dyn_section): New overloaded function.
1521         (Target_powerpc::plt_, iplt_): Elucidate.
1522         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1523         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1524         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1525         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1526         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1527         push_branch and make_plt_entry for ifunc syms when
1528         reloc_needs_plt_for_ifunc.
1529         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1530         for ifunc unless reloc_needs_plt_for_ifunc.
1531
1532 2013-03-15  Alan Modra  <amodra@gmail.com>
1533
1534         * gc.h (gc_process_relocs): Don't look through function descriptors.
1535         * icf.cc (get_section_contents): Do so here instead.
1536
1537 2013-03-13  Alan Modra  <amodra@gmail.com>
1538
1539         * powerpc.cc (is_branch_reloc): Forward declare.
1540         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1541         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1542         false for 64-bit, true for 32-bit non-branch relocs.
1543         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1544         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1545         nm output.
1546         (icf_safe_test): Generate linker map file as well as nm output.
1547         (icf_safe_so_test): Likewise.
1548         * testsuite/Makefile.in: Regenerate.
1549         * testsuite/icf_test.sh: Parse linker map file to determine
1550         section folding.
1551         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1552         * testsuite/icf_safe_so_test.sh: Likewise.
1553         (X86_32_or_ARM_specific_safe_fold): Merge into..
1554         (arch_specific_safe_fold): ..this.
1555         (X86_64_specific_safe_fold): Delete unused function.
1556
1557 2013-03-12  Alan Modra  <amodra@gmail.com>
1558
1559         * gc.h (gc_process_relocs): Look through function descriptors
1560         to determine shndx, symvalue and addend used by ICF.  Tidy
1561         variable duplication.
1562
1563 2013-03-11  Alan Modra  <amodra@gmail.com>
1564
1565         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1566         * layout.cc (Layout_task_runner::run): ..to here.
1567         * symtab.h (struct Symbol_location): Extract from..
1568         (class Symbol_table): ..here.
1569         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1570         * target.h (class Target): Add function_location and
1571         do_function_location functions.
1572         (class Sized_target): Add do_function_location.
1573         * object.h (class Sized_relobj_file): Move find_shdr..
1574         (class Object): ..to here.
1575         * object.cc: Likewise.  Update to suit.  Instantiate.
1576         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1577         * powerpc.cc (class Powerpc_dynobj): New.
1578         (Target_powerpc::do_function_location): New function.
1579         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1580         (Powerpc_dynobj::do_read_symbols): New function.
1581         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1582
1583 2013-03-08  Ian Lance Taylor  <iant@google.com>
1584
1585         * options.cc (General_options::string_to_object_format): Accept
1586         "default".
1587
1588 2013-03-08  Alan Modra  <amodra@gmail.com>
1589
1590         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1591         pointer to Post_fde.
1592         (struct Post_fde): Move definition to here..
1593         * ehframe.cc (struct Post_fde): ..from here.
1594         (Cie::write): Don't alloc Post_fde.
1595         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1596
1597 2013-03-07  Alan Modra  <amodra@gmail.com>
1598
1599         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1600         relocation referencing .LC0.
1601         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1602
1603 2013-03-07  Alan Modra  <amodra@gmail.com>
1604
1605         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1606         always_inline.  Add assembly for powerpc to avoid GOT.
1607
1608 2013-03-07  Alan Modra  <amodra@gmail.com>
1609
1610         * testsuite/script_test_10.sh: Don't test .bss section
1611         header number.
1612
1613 2013-03-06  Alan Modra  <amodra@gmail.com>
1614
1615         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1616         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1617         all callers.  Handle folded sections.
1618         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1619         to Powerpc_relobj.
1620         (Global_symbol_visitor_opd::operator()): Likewise.
1621
1622 2013-03-04  Alan Modra  <amodra@gmail.com>
1623
1624         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1625         * testsuite/Makefile.in: Regenerate.
1626
1627 2013-03-01  Cary Coutant  <ccoutant@google.com>
1628
1629         Add dwp support for v2 DWARF package file format.
1630         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1631         tu_length parameter.  Adjust all callers.
1632         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1633         * dwp.cc: Include dwarf.h.
1634         (Section_bounds): New struct type.
1635         (Unit_set): New struct type.
1636         (Dwo_file::Dwo_file): Initialize new data member.
1637         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1638         Combine and rename to...
1639         (Dwo_file::read_unit_index): ...this.
1640         (Dwo_file::sized_read_compunit_index)
1641         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1642         (Dwo_file::sized_read_unit_index): ...this.
1643         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1644         parameters; add section_id parameter.
1645         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1646         (Dwo_file::add_unit_set): ...this.
1647         (Dwo_file::shndx_map_): Remove.
1648         (Dwo_file::sect_offsets_): New data member.
1649         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1650         (Dwp_output_file::add_section): Rename to...
1651         (Dwp_output_file::add_contribution): ...this.
1652         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1653         (Dwp_output_file::add_tu_set): Likewise.
1654         (Dwp_output_file::Contribution): New type.
1655         (Dwp_output_file::Section::contributions): New data member.
1656         (Dwp_output_file::Cu_or_tu_set): Remove.
1657         (Dwp_output_file::Section::Section): New ctor.
1658         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1659         (Dwp_output_file::Dwp_index::Section_table): New type.
1660         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1661         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1662         parameter.
1663         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1664         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1665         (Dwp_output_file::Dwp_index::section_table): New member function.
1666         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1667         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1668         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1669         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1670         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1671         (Dwp_output_file::Dwp_index::section_table_): New data member.
1672         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1673         (Dwp_output_file::add_output_section): New member function.
1674         (Dwp_output_file::write_new_section): New member function.
1675         (Dwp_output_file::write_contributions): New member function.
1676         (Dwp_output_file::section_id_map_): New data member.
1677         (class Dwo_id_info_reader): Remove.
1678         (class Unit_reader): New class.
1679         (get_dwarf_section_name): New function.
1680         (Dwo_file::read_executable): Adjust initializations of class data.
1681         (Dwo_file::read): Add support for v2 package file format.
1682         (Dwo_file::read_unit_index): Likewise.
1683         (Dwo_file::sized_read_unit_index): Likewise.
1684         (Dwo_file::copy_section): Likewise.
1685         (Dwo_file::add_unit_set): Likewise.
1686         (Dwp_output_file::add_output_section): Likewise.
1687         (Dwp_output_file::add_contribution): Likewise.
1688         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1689         for empty slot.
1690         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1691         file format.
1692         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1693         slot.
1694         (Dwp_output_file::initialize): Remove unused function.
1695         (Dwp_output_file::finalize): Add support for v2 package file format.
1696         (Dwp_output_file::write_index): Likewise.
1697         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1698         function prototype.
1699
1700 2013-03-01  Cary Coutant  <ccoutant@google.com>
1701
1702         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1703         function into class definition in header file.
1704         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1705         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1706         New function.
1707         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1708
1709 2013-02-28  Alan Modra  <amodra@gmail.com>
1710
1711         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1712         * target.cc (Target::do_plt_fde_location): New function.
1713         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1714         accessor function, and constructor param.
1715         (struct Post_fde, Post_fdes): Declare.
1716         (Cie::write): Add post_fdes param.
1717         * ehframe.cc (Fde::write): Use plt_fde_location.
1718         (struct Post_fde): Define.
1719         (Cie::write): Stash FDEs added post merge mapping.
1720         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1721         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1722         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1723         other FDEs.
1724         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1725         (Target_powerpc::has_glink): New function.
1726         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1727         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1728         glink_eh_frame_fde_32, default_fde): New data.
1729         (Stub_table::eh_frame_added_): New var.
1730         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1731         Make const.
1732         (Stub_table::add_eh_frame): New function.
1733         (Output_data_glink::add_eh_frame): New function.
1734         (Target_powerpc::make_glink_section): Call add_eh_frame.
1735
1736 2013-02-15  Ian Lance Taylor  <iant@google.com>
1737
1738         * options.h (DEFINE_uint64_alias): Define.
1739         (class General_options): Add -Ttext-segment as an alias for
1740         -Ttext.
1741
1742 2013-02-15  Alan Modra  <amodra@gmail.com>
1743
1744         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1745         (Stub_table::do_write): ..here, two places.
1746         (Stub_table::plt_call_size): Use it here too.
1747
1748 2013-02-11  Ian Lance Taylor  <iant@google.com>
1749
1750         * descriptors.cc (Descriptors::close_all): New function.
1751         * descriptors.h (class Descriptors): Declare close_all.
1752         (close_all_descriptors): New inline function.
1753         * plugin.cc: Include "descriptors.h".
1754         (Plugin_manager::cleanup): Call close_all_descriptors.
1755
1756 2013-02-06  Alan Modra  <amodra@gmail.com>
1757
1758         * README: Update coding style link.
1759
1760 2013-01-28  Cary Coutant  <ccoutant@google.com>
1761
1762         * dwp.cc (File_list): New typedef.
1763         (Dwo_name_info_reader): New class.
1764         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1765         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1766         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1767         (Dwo_file::read_executable): New function.
1768         (Dwo_file::read): Move common setup code to ...
1769         (Dwo_file::make_object): ... here.
1770         (dwp_options): Add --exec/-e.
1771         (usage): Likewise.
1772         (main): Likewise.
1773
1774 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1775
1776         * layout.cc (Layout::layout): Check for option text_reorder.
1777         (Layout::make_output_section): Ditto.
1778         * options.h (text_reorder): New option.
1779         * output.cc (Input_section_sort_compare): Remove special ordering
1780         of section names.
1781         (Output_section::
1782          Input_section_sort_section_name_special_ordering_compare::
1783          operator()): New function.
1784         (Output_section::sort_attached_input_sections): Use new sort function
1785         for .text.
1786         * output.h (Input_section_sort_section_name_special_ordering_compare):
1787         New struct.
1788         * testsuite/Makefile.am (text_section_grouping): Test option
1789         --no-text-reorder
1790         * testsuite/Makefile.in: Regenerate.
1791         * testsuite/text_section_grouping.sh: Check order of functions without
1792         default text reordering.
1793
1794 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1795
1796         * options.h (General_options): Change default to true for new_dtags.
1797
1798 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1799
1800         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1801         when enable_new_dtags is false.  Only add DT_RUNPATH when
1802         enable_new_dtags is true.
1803
1804 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1805
1806         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1807         used in declaration and definition consistent.
1808         (Target_powerpc::symval_for_branch): Ditto.
1809
1810 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1811
1812         * testsuite/plugin_final_layout.cc: Fix comment.
1813
1814 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1815
1816         * layout.cc (Layout::layout): Do not do default sorting for
1817         text sections when section ordering is specified.
1818         (make_output_section): Ditto.
1819         * testsuite/plugin_final_layout.cc: Name the function sections
1820         to catch reordering issues.
1821
1822 2013-01-15  Alan Modra  <amodra@gmail.com>
1823
1824         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1825         plt-thread-safe.
1826
1827 2013-01-15  Alan Modra  <amodra@gmail.com>
1828
1829         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1830         * testsuite/Makefile.in: Regenerate.
1831
1832 2013-01-14  Alan Modra  <amodra@gmail.com>
1833
1834         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1835         * testsuite/Makefile.in: Regenerate.
1836
1837 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1838
1839         PR bfd/14430
1840         Fix mingw gold build with plugins enabled
1841         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1842         * configure.ac: Export DLOPEN_LIBS and add headers check.
1843         * plugin.cc: Handle non-dlfcn case.
1844         * Makefile.in: Regenerate.
1845         * config.in: Regenerate.
1846         * configure: Regenerate.
1847         * testsuite/Makefile.in: Regenerate.
1848
1849 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1850
1851         * output.h (sort_attached_input_sections): Change to be public.
1852         * script-sections.cc
1853         (Output_section_definition::set_section_addresses): Sort
1854         attached input sections according to section order before linker
1855         script assigns section addresses.
1856         (Orphan_output_section::set_section_addresses): Sort
1857         attached input sections according to section order before linker
1858         script assigns section addresses.
1859         * Makefile.am (final_layout.sh): Use a simple linker script to
1860         check if section ordering still works.
1861         * Makefile.in: Regenerate.
1862
1863 2013-01-09  Ben Cheng  <bccheng@google.com>
1864
1865         * arm.cc (Target_arm::attributes_accept_div): New function.
1866         (Target_arm::attributes_forbid_div): New function.
1867         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1868         attribute using the same new functions as what bfd/elf32_arm.c
1869         does.
1870
1871 2013-01-07  Cary Coutant  <ccoutant@google.com>
1872
1873         PR gold/14993
1874         * output.cc (Output_section::add_input_section): For incremental
1875         updates, don't track input sections that are allocated from patch
1876         space.
1877
1878 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1879             Ian Lance Taylor  <iant@google.com>
1880
1881         PR gold/14897
1882         * configure.ac (--enable-ld): Removed.
1883         (install_as_default): Set to yes only for --enable-gold=default
1884         or --disable-ld.
1885         * configure: Regenerated.
1886
1887 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1888
1889         * options.h (General_options): Add -fuse-ld= for GCC linker
1890         option compatibility.
1891
1892 2013-01-04  Cary Coutant  <ccoutant@google.com>
1893
1894         * configure.ac: Fix typo restoring CXXFLAGS.
1895         * configure: Regenerate.
1896
1897 2013-01-04  Cary Coutant  <ccoutant@google.com>
1898
1899         * testsuite/Makefile.am (CXXLINK_S): New macro.
1900         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1901         * testsuite/Makefile.in: Regenerate.
1902
1903 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1904
1905         * version.cc (print_version): Update copyright year to 2013.
1906
1907 2012-12-20  Ian Lance Taylor  <iant@google.com>
1908
1909         * layout.cc (Layout::special_ordering_of_input_section): New
1910         function.
1911         (Layout::layout): If input section requires special ordering, must
1912         sort input sections.
1913         (Layout::make_output_section): May sort .text input sections.
1914         (Layout::is_section_name_prefix_grouped): Remove.
1915         * layout.h (class Layout): Declare
1916         special_ordering_of_input_section.  Don't declare
1917         is_section_name_prefix_grouped.
1918         * output.cc (Output_section::add_input_section): Revert last
1919         change.
1920         (Output_section::Input_section_sort::match_file_name): Don't crash
1921         if called on output section data.
1922         (Output_section::Input_section_sort_compare): Sort based on
1923         special ordering.
1924         (Output_section::Input_section_sort_section_order_index_compare):
1925         Revert last patch.
1926         (Output_section::sort_attached_input_sections): Likewise.
1927
1928 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1929
1930         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1931         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1932         * output.cc (Output_section::add_input_section): Check if section
1933         name contains special prefix.  Keep input sections to sort such
1934         sections.
1935         (Output_section::Input_section_sort_section_order_index_compare
1936          ::operator()): Group sections according to prefixes.
1937         (Output_section::sort_attached_input_sections): Add condition to
1938         Input_section_entry constructor call.
1939         * testsuite/Makefile.am (text_section_grouping): New test.
1940         * testsuite/Makefile.in: Regenerate.
1941         * testsuite/text_section_grouping.cc: New file.
1942         * testsuite/text_section_grouping.sh: New file.
1943
1944 2012-12-17  Nick Clifton  <nickc@redhat.com>
1945
1946         * Makefile.am: Add copyright notice.
1947         * NEWS: Likewise.
1948         * README: Likewise.
1949         * configure.ac: Likewise.
1950         * ftruncate.c: Likewise.
1951         * Makefile.in: Regenerate.
1952
1953 2012-12-14  Cary Coutant  <ccoutant@google.com>
1954
1955         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1956         --no-as-needed flag.
1957         (exception_separate_shared_12_test): Likewise.
1958         (incremental_copy_test): Likewise.
1959         * testsuite/Makefile.in: Regenerate.
1960
1961 2012-12-14  Cary Coutant  <ccoutant@google.com>
1962
1963         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1964         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1965
1966 2012-12-12  Alan Modra  <amodra@gmail.com>
1967
1968         * powerpc.cc (class Track_tls): New.
1969         (class Relocate, class Scan): Inherit Track_tls.
1970         (Target_powerpc::Scan::local, global): Track tls optimization
1971         and avoid creating plt entry for __tls_get_addr if all uses
1972         are optimized away.
1973         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1974
1975 2012-12-12  Alan Modra  <amodra@gmail.com>
1976
1977         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1978         Replace no_toc_optimize with toc_optimize.
1979         * output.h (Output_section::input_sections): Provide non-const variant.
1980         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1981         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1982         accessors.
1983         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1984         (class Sort_toc_sections): New.
1985         (Target_powerpc::do_finalize_sections): Sort toc sections.
1986         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1987
1988 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1989
1990         * testsuite/binary_unittest.cc (read_all): New function.
1991         (Sized_binary_test): Use it instead of ::read.
1992         * fileread.cc (do_read): Don't assume pread always reads the whole
1993         amount in a single call.
1994
1995 2012-12-10  Alan Modra  <amodra@gmail.com>
1996
1997         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1998         Set EM_PPC64 or EM_PPC here.
1999         (Target_selector_powerpc::do_recognize): Delete.
2000
2001 2012-12-10  Alan Modra  <amodra@gmail.com>
2002
2003         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2004         stub_table_.
2005         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2006
2007 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2008
2009         * testsuite/binary_unittest.cc (Sized_binary_test):
2010         Use open_descriptor rather than ::open.
2011
2012 2012-12-07  Alan Modra  <amodra@gmail.com>
2013
2014         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2015         typedef and invalid_address constant.
2016         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2017         instantiate constants.
2018
2019 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2020
2021         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2022         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2023         * aclocal.m4: Regenerate.
2024         * configure: Regenerate.
2025         * Makefile.in: Regenerate.
2026         * testsuite/Makefile.in: Regenerate.
2027
2028 2012-12-07  Alan Modra  <amodra@gmail.com>
2029
2030         * options.h (General_options): Add no_toc_optimize.
2031         * powerpc.cc (ok_lo_toc_insn): New function.
2032         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2033
2034 2012-12-06  Alan Modra  <amodra@gmail.com>
2035
2036         * options.h (General_options): Add plt_align, plt_static_chain,
2037         plt_thread_safe.  Update stub_group_size help text.
2038         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2039         for new plt_thread_safe_ var.
2040         (use_plt_offset): Correct comments.
2041         (Target_powerpc::do_relax): Look for thread creation symbols to
2042         determine default plt_thread_safe value.  Clear plt call stubs
2043         as well as branch stubs each iteration.
2044         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2045         insn constants.
2046         (l, hi, ha, write_insn): Move earlier.
2047         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2048         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2049         plt stubs too.
2050         (Stub_table::update_size): Adjust.
2051         (Stub_table::prev_size, set_prev_size): Delete.
2052         (Stub_table::stub_align): Let --plt-align affect result.
2053         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2054         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2055         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2056         (Stub_table::do_write): Support more stub variants.
2057
2058 2012-12-04  Alan Modra  <amodra@gmail.com>
2059
2060         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2061         (Target_powerpc::do_define_standard_symbols): New function.
2062
2063 2012-12-03  Alan Modra  <amodra@gmail.com>
2064
2065         * output.h: Formatting, whitespace.
2066
2067 2012-12-03  Alan Modra  <amodra@gmail.com>
2068
2069         * layout.h (Layout::get_executable_sections): Declare.
2070         * layout.cc (Layout::get_executable_sections): New function.
2071         * arm.cc (Target_arm::group_sections): Use it.
2072         (Arm_output_section::group_sections): Delete now redundant test.
2073         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2074         param to handle relative relocs.
2075         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2076         (Output_data_reloc::add_absolute): Adjust.
2077         (Output_data_reloc::add_relative): New function.
2078         (Output_data::reset_data_size): New function.
2079         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2080         (Output_section::set_addralign): New function.
2081         (Output_section::checkpoint_set_addralign): New function.
2082         (Output_section::clear_section_offsets_need_adjustment): New function.
2083         (Output_section::input_sections): Make public.
2084         * powerpc.cc (class Output_data_brlt_powerpc): New.
2085         (class Stub_table, class Stub_control): New.
2086         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2087         stub_table_, set_stub_table, stub_table): New vectors and accessor
2088         functions.
2089         (Target_powerpc::do_may_relax, do_relax, push_branch,
2090         new_stub_table, stub_tables, brlt_section, group_sections,
2091         add_branch_lookup_table, find_branch_lookup_table,
2092         write_branch_lookup_table, make_brlt_section): New functions.
2093         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2094         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2095         branch_info_): New vars.
2096         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2097         make call stubs here.
2098         (Output_data_glink): Remove all call stub handling from this class.
2099         (Target_powerpc::Scan::local, global): Save interesting branch
2100         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2101         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2102         functions on final link.
2103         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2104         Handle long branch destinations too.
2105         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2106         do_plt_address_for_local): Adjust lookup of plt call stubs.
2107
2108 2012-11-30  Alan Modra  <amodra@gmail.com>
2109
2110         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2111         relocs against protected symbols when building 32-bit shared libs.
2112
2113 2012-11-30  Alan Modra  <amodra@gmail.com>
2114
2115         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2116         param.  Call got_section() to make .got.  Update all callers
2117         and their callers and so on.
2118
2119 2012-11-30  Alan Modra  <amodra@gmail.com>
2120
2121         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2122         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2123         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2124         value if it already exists.
2125
2126 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2127
2128         PR gold/14858
2129         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2130
2131 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2132
2133         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2134         than bfc instruction for data sandboxing.
2135
2136 2012-11-08  Alan Modra  <amodra@gmail.com>
2137
2138         * po/POTFILES.in: Regenerate.
2139
2140 2012-11-05  Alan Modra  <amodra@gmail.com>
2141
2142         * configure.ac: Apply 2012-09-10 change to config.in here.
2143         * configure: Regenerate.
2144
2145 2012-11-05  Alan Modra  <amodra@gmail.com>
2146
2147         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2148         (struct Opd_ent): Use "Address" rather than "Offset".
2149         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2150         (Target_powerpc::got_section): Make public.
2151         (Target_powerpc::scan_relocs): Move code setting symbols..
2152         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2153         Create _SDA_BASE_ only when referenced.
2154
2155 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2156
2157         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2158         from last change.
2159
2160 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2161
2162         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2163         for offset_in_output_section parameter.
2164         (Sized_target::relocate_special_relocatable): Likewise.
2165         * arm.cc (Target_arm::relocate_relocs): Likewise.
2166         (Target_arm::relocate_special_relocatable): Likewise.
2167         * i386.cc (Target_i386::relocate_relocs): Likewise.
2168         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2169         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2170         * target-reloc.h (relocate_relocs): Likewise.
2171         * testsuite/testfile.cc (Target_test): Likewise.
2172         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2173         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2174
2175         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2176         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2177
2178         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2179         parameter, which is unused in the [!F_SETFD] case.
2180
2181         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2182         SYMNDX to off_t before comparing it to this->data_size().
2183         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2184         * incremental.cc (Output_section_incremental_inputs::do_write):
2185         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2186
2187         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2188
2189 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2190
2191         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2192         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2193         in EABI_VER5.
2194
2195 2012-10-29  Cary Coutant  <ccoutant@google.com>
2196
2197         * dwp.cc (usage): Add file and exit status parameters;
2198         add --help and --version options.
2199         (print_version): New function.
2200         (main): Add --help and --version options.
2201
2202 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2203
2204         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2205         final_layout_sequence.txt.
2206         * testsuite/Makefile.in: Regenerated.
2207
2208 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2209
2210         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2211         COMPILE generated by automake.
2212         (LINK1): Likewise.
2213         (CXXCOMPILE1): Likewise.
2214         (CXXLINK1): Likewise.
2215         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2216         (LINK): Likewise.
2217         (CXXCOMPILE): Likewise.
2218         (CXXLINK): Likewise.
2219         * testsuite/Makefile.in: Regenerated.
2220
2221 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2222
2223         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2224         on bad fwrite return.
2225
2226 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2227
2228         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2229         on val.
2230
2231 2012-10-23  Cary Coutant  <ccoutant@google.com>
2232
2233         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2234         * testsuite/Makefile.in: Regenerate.
2235         * testsuite/dwp_test.h: New source file.
2236         * testsuite/dwp_test_1.cc: New source file.
2237         * testsuite/dwp_test_1.s: New source file.
2238         * testsuite/dwp_test_1.sh: New source file.
2239         * testsuite/dwp_test_1b.cc: New source file.
2240         * testsuite/dwp_test_1b.s: New source file.
2241         * testsuite/dwp_test_2.cc: New source file.
2242         * testsuite/dwp_test_2.s: New source file.
2243         * testsuite/dwp_test_2.sh: New source file.
2244         * testsuite/dwp_test_main.cc: New source file.
2245         * testsuite/dwp_test_main.s: New source file.
2246
2247 2012-10-23  Cary Coutant  <ccoutant@google.com>
2248
2249         * dwp.h: New header file.
2250         * dwp.cc: New source file.
2251         * gold.h: Move shared declarations to system.h.
2252         * system.h: New header file.
2253         * Makefile.am: Add dwp.
2254         * Makefile.in: Regenerate.
2255
2256 2012-10-23  Cary Coutant  <ccoutant@google.com>
2257
2258         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2259         Dwarf_info_reader::read_from_pointer.
2260         (Dwarf_pubnames_table::read_header): Likewise.
2261         (Dwarf_pubnames_table::next_name): Likewise.
2262         (Dwarf_die::read_attributes): Likewise.
2263         (Dwarf_die::skip_attributes): Likewise.
2264         (Dwarf_info_reader::read_from_pointer): New function template.
2265         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2266         (Dwarf_pubnames_table): Likewise.
2267         (Dwarf_info_reader::read_from_pointer): New function template.
2268         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2269         Dwarf_pubnames_table ctor.
2270
2271 2012-10-23  Cary Coutant  <ccoutant@google.com>
2272
2273         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2274         abbrev_shndx.
2275         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2276         abbrev_shndx_.
2277         (Dwarf_info_reader::set_abbrev_shndx): New method.
2278         (Dwarf_info_reader::abbrev_shndx_): New data member.
2279
2280 2012-10-23  Cary Coutant  <ccoutant@google.com>
2281
2282         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2283         from object, not parameters.
2284         (Dwarf_info_reader::parse): Likewise.
2285         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2286         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2287         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2288         methods.
2289
2290 2012-10-23  Cary Coutant  <ccoutant@google.com>
2291
2292         * fileread.cc (Input_file::Input_file): New constructor.
2293         * fileread.h (class Input_file): Add new constructor.
2294
2295 2012-10-18  Alan Modra  <amodra@gmail.com>
2296
2297         PR gold/14727
2298         * object.cc (Relobj::is_section_name_included): Also match
2299         .sdata personality section.
2300
2301 2012-10-18  Alan Modra  <amodra@gmail.com>
2302
2303         * target-reloc.h (class Default_comdat_behavior): New, package up..
2304         (get_comdat_behaviour): ..this.
2305         (relocate_section): Add Relocate_comdat_behavior template arg,
2306         adjust code to suit.
2307         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2308         (Target_arm::scan_reloc_section): Likewise.
2309         * i386.cc (Target_i386::relocate_section): Likewise.
2310         * sparc.cc (Target_sparc::relocate_section): Likewise.
2311         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2312         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2313         * powerpc.cc (class Relocate_comdat_behavior): New.
2314         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2315         gold::relocate_section with new template arg.
2316
2317 2012-10-18  Alan Modra  <amodra@gmail.com>
2318
2319         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2320         dynamic relocs for GOT_TPREL got entries, without symbol if
2321         resolving locally.
2322         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2323         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2324         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2325
2326 2012-10-17  Alan Modra  <amodra@gmail.com>
2327
2328         PR gold/14726
2329         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2330
2331 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2332
2333         * layout.cc (Layout::include_section): Keep sections marked
2334         SHF_EXCLUDE when doing relocatable links.
2335
2336 2012-10-16  Alan Modra  <amodra@gmail.com>
2337
2338         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2339         (Target_powerpc::do_finalize_sections): Call it.
2340         (Output_data_save_res): New class and supporting functions.
2341         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2342         normal symbols defined in object files.
2343
2344 2012-10-12  Alan Modra  <amodra@gmail.com>
2345
2346         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2347         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2348         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2349         section if scan_opd_relocs not yet called.
2350         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2351
2352 2012-10-12  Alan Modra  <amodra@gmail.com>
2353
2354         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2355         add_local_ifunc_entry): Revert last change.
2356         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2357
2358 2012-10-05  Alan Modra  <amodra@gmail.com>
2359
2360         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2361         do_plt_address_for_global): New functions.
2362         (Output_data_got_powerpc::do_write): Don't segfault when linking
2363         statically.
2364         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2365         add_local_ifunc_entry): Return true on adding entry..
2366         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2367         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2368         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2369         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2370         set up symbols here.
2371         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2372         syms here.  Do so even when no .iplt.  Don't segfault when linking
2373         statically.
2374         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2375         new variants without reloc param.
2376         (Glink_sym_ent::Glink_sym_ent): Likewise.
2377         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2378         reloc when refs will resolve to plt call stub.
2379         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2380         R_PPC_PLTREL24 to resolve locally.
2381         (Target_powerpc::Scan::global): Correct ifunc handling.
2382         (Target_powerpc::Relocate::relocate): Correct local sym glink
2383         lookup.  Don't destroy "value" when we have a plt call stub,
2384         and when checking plt call validity.
2385         (Target_powerpc::do_dynsym_value): Simplify.
2386
2387 2012-10-05  Alan Modra  <amodra@gmail.com>
2388
2389         * i386.cc (Output_data_plt_i386::address_for_global,
2390         address_for_local): Add plt offset to returned value.  Adjust uses.
2391         * sparc.cc (Output_data_plt_sparc::address_for_global,
2392         address_for_local): Likewise.
2393         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2394         address_for_local): Likewise.
2395         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2396         address_for_local): Likewise.
2397         * target.h (Target::plt_address_for_global, plt_address_for_local):
2398         Update comment.
2399         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2400         (Output_data_got::Got_entry::write): Nor here.
2401         * output.h: Comment fix.
2402
2403 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2404
2405         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2406         global_offset_table_ value for larget got.
2407         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2408
2409 2012-09-29  Alan Modra  <amodra@gmail.com>
2410
2411         * powerpc.cc (Target_powerpc::iplt_): New output section.
2412         (Target_powerpc::iplt_section, make_iplt_section,
2413         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2414         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2415         Target_powerpc::plt_entry_count): Count iplt entries too.
2416         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2417         reloc section in constructor.  New params.
2418         (Target_powerpc::make_plt_section): Create reloc section here instead.
2419         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2420         functions.
2421         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2422         (Output_data_glink::add_entry, find_entry): New functions to
2423         deal with local syms.
2424         (Glink_sym_ent): Add support for local syms.
2425         (Output_data_glink::do_write): Handle ifunc plt entries.
2426         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2427         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2428         (Target_powerpc::Relocate::relocate): Likewise.
2429         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2430
2431 2012-09-25  Alan Modra  <amodra@gmail.com>
2432
2433         * object.h (Sized_relobj_file::adjust_local_symbol,
2434         do_adjust_local_symbol): New functions.
2435         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2436         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2437         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2438         and irregular opd entry spacing.
2439         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2440         (Global_symbol_visitor_opd): New functor.
2441         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2442         on deleted opd entries.
2443
2444 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2445
2446         * tilegx.cc: New file.
2447         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2448         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2449         * configure.tgt: Add entries for tilegx*.
2450         * configure.ac: Likewise.
2451         * Makefile.in: Rebuild.
2452         * configure: Likewise.
2453         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2454         tilegx.
2455
2456 2012-09-13  Alan Modra  <amodra@gmail.com>
2457
2458         * target-reloc.h (scan_relocs): Call scan.local for relocs
2459         against symbols in discarded sections.  Pass is_discarded
2460         param.
2461         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2462         Add is_discarded param.
2463         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2464         is_discarded to flag opd entry as discarded.  Don't emit dyn
2465         relocs on such entries.
2466         (Target_powerpc::Scan::global): Similarly detect and handle
2467         such opd entries.
2468         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2469         opd_ent_.  Update all uses.
2470         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2471         (Target_powerpc::relocate_section): Zero out discarded opd
2472         entry relocs.
2473
2474 2012-09-12  Ian Lance Taylor  <iant@google.com>
2475
2476         PR gold/14570
2477         * output.cc: Rename Output_data_got template parameter from size
2478         to got_size for all functions.  Compile all variants of
2479         Output_data_got.
2480         (Output_data_got::Got_entry::write): Correct use of size for
2481         symbol value.  Use local_is_tls rather than casting to
2482         Sized_relobj_file.
2483         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2484         (class Sized_relobj_file): Add do_local_is_tls.
2485         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2486
2487 2012-09-11  Alan Modra  <amodra@gmail.com>
2488
2489         PR gold/14566
2490         * layout.cc (Layout::set_segment_offsets): When using
2491         common-page-size alignment, ensure we are on a new max-page-size
2492         page.
2493         * output.cc (Output_segment::set_section_addresses): Use
2494         abi_pagesize, not common_pagesize for relro boundary.
2495         (Output_segment::set_offset): Likewise.
2496
2497 2012-09-11  Alan Modra  <amodra@gmail.com>
2498
2499         * output.h (Output_data_got::add_global_tls, add_local_tls,
2500         add_local_tls_pair): New functions.
2501         (Output_data_got::add_local_pair_with_rel): Remove second
2502         reloc param.  Expand comment.
2503         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2504         use_plt_or_tls_offset_, similarly for constructor param.
2505         (Output_data_got::Got_entry::write): Add got_index param.
2506         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2507         add_local_tls_pair): New functions.
2508         (Output_data_got::Got_entry::write): Handle tls symbols
2509         with use_plt_or_tls_offset_ set specially.
2510         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2511         (Output_data_got::do_write): Replace iterator with index, pass
2512         index to entry write function.
2513         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2514         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2515         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2516         call.
2517         * i386.cc (Target_i386::Scan::local): Likewise.
2518         * sparc.cc (Target_sparc::Scan::local): Likewise.
2519         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2520         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2521         do_tls_offset_for_global): New functions.
2522         (Target_powerpc::Scan::local): Correct TLS relocations and got
2523         entry values.
2524         (Target_powerpc::Scan::global): Don't emit unnecessary
2525         dynamic relocations on TLS GOT entries.
2526
2527 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2528
2529         * config.in: Disable sanity check for kfreebsd.
2530
2531 2012-09-10  Sterling Augustine  <saugustine@google.com>
2532
2533         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2534         (Gdb_index::pubtypes_read): New parameter.
2535         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2536         to calls.
2537         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2538         pubtypes_object_.
2539
2540 2012-09-09  Alan Modra  <amodra@gmail.com>
2541
2542         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2543         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2544         * gc.h (gc_process_relocs): Call target gc_add_reference.
2545         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2546         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2547         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2548         unnecessary cast.
2549         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2550         to cater for when we don't need code offset.  Update use.
2551         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2552         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2553         set_opd_valid): New functions.
2554         (Target_powerpc::do_gc_add_reference): New function.
2555         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2556         stashed refs.
2557         (Target_powerpc::do_gc_mark_symbol): New function.
2558
2559 2012-09-06  Cary Coutant  <ccoutant@google.com>
2560
2561         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2562         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2563         (Dwarf_die::skip_attributes): Likewise.
2564         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2565         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2566         (main): Call it.
2567         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2568
2569 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2570
2571         * testsuite/script_test_3.t: Add .got.plt output section
2572         statement.
2573         * testsuite/script_test_4.t: Likewise.
2574
2575 2012-09-05  Alan Modra  <amodra@gmail.com>
2576
2577         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2578         update all uses and lose "enum" when using type.
2579
2580 2012-09-05  Alan Modra  <amodra@gmail.com>
2581
2582         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2583         * configure: Regenerate.
2584         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2585         (plugin_final_layout.stdout): Likewise.
2586         (memory_test): Set page sizes to 0x1000.
2587         * testsuite/Makefile.in: Regenerate.
2588         * testsuite/discard_locals_test.sh: Add FIXME comment.
2589         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2590         * testsuite/pr14265.t: Add .got output section statement.
2591         * testsuite/script_test_2.t: Likewise.
2592         * testsuite/script_test_3.t: Likewise.
2593         * testsuite/script_test_4.t: Likewise.
2594         * testsuite/script_test_5.t: Likewise.
2595         * testsuite/script_test_6.t: Likewise.
2596         * testsuite/script_test_7.t: Likewise.
2597         * testsuite/script_test_9.t: Likewise.
2598
2599 2012-09-05  Alan Modra  <amodra@gmail.com>
2600
2601         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2602         (Powerpc_relocate_functions::Status): New typedef.
2603         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2604         (Target_powerpc::Scan::local): Handle REL64.
2605         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2606         for REL32 and REL64.
2607         (Target_powerpc::symval_for_branch): New function, extracted from..
2608         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2609         checks.  Report overflow errors.
2610
2611 2012-09-05  Alan Modra  <amodra@gmail.com>
2612
2613         * object.h (Sized_relobj_file::emit_relocs): Delete.
2614         (Sized_relobj_file::emit_relocs_reltype): Delete.
2615         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2616         relocate_relocs for --emit-relocs.
2617         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2618         * output.h: Update comment.
2619         (Output_segment::first_section): New function.
2620         (Output_segment::first_section_load_address): Use first_section.
2621         * output.cc (Output_segment::first_section): New function extracted..
2622         (Output_segment::first_section_load_address): ..from here.  Delete.
2623         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2624         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2625         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2626         adjust call to target.h function.
2627         * i386.cc (Target_i386): Likewise.
2628         * sparc.cc (Target_sparc): Likewise.
2629         * x86_64.cc (Target_x86_64): Likewise.
2630         * powerpc.cc (Target_powerpc): Likewise.
2631         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2632         first tls section has section symbol for optimised local dynamic
2633         output relocs.
2634         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2635         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2636         optimised tls code.
2637         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2638         Rename to relocate_relocs.  Update error message.
2639
2640 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2641
2642         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2643         --just-symbols.
2644
2645 2012-08-31  Alan Modra  <amodra@gmail.com>
2646
2647         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2648         (Powerpc_relobj::toc_base_offset): New stub function.
2649         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2650         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2651         (Target_powerpc::Relocate::enum skip_tls): New.
2652         (Target_powerpc::call_tls_get_addr_): New var.
2653         (Target_powerpc::is_branch_reloc): Move to file scope.
2654         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2655         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2656         New functions.
2657         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2658         (powerpc_info): Correct common_pagesize for ppc64.
2659         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2660         (Powerpc_relocate_functions): Add overflow check enums and functions.
2661         Add non-shift version of rela, rela_ua.  Delete all rel public
2662         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2663         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2664         addr16_ha3, addr14 functions.
2665         (Output_data_got_powerpc::add_constant_pair): New function.
2666         (Output_data_got_powerpc::got_base_offset): Likewise.
2667         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2668         (instruction constants): Sort, add some more.
2669         (Output_data_glink::do_write): Add and use Address typedef.  Use
2670         object->toc_base_offset() stub for 64-bit.
2671         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2672         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2673         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2674         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2675         Always treat .opd relocs as against locally defined symbol.
2676         Correct condition for RELATIVE relocs.
2677         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2678         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2679         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2680         calculations.  Handle TLS relocs, and more.  Add overflow
2681         checking and adjust for Powerpc_relocate_functions changes.
2682         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2683         Reinstate --emit-relocs code with FIXME.
2684
2685 2012-08-30  Alan Modra  <amodra@gmail.com>
2686
2687         * layout.cc (Layout::set_segment_offsets): Set p_align to
2688         abi_pagesize, not common_pagesize.
2689         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2690         to determine whether file header can go in segment.
2691
2692 2012-08-30  Alan Modra  <amodra@gmail.com>
2693
2694         * output.h (Output_reloc::Output_reloc <output section>): Add
2695         is_relative param.  Adjust calls.
2696         (Output_reloc::add_output_section_relative): New functions.
2697         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2698         is_relative.
2699         (Output_reloc::symbol_value): Handle SECTION_CODE.
2700
2701 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2702
2703         * gold.cc (queue_middle_tasks): Call layout again when unique
2704         segments for sections is desired.
2705         * layout.cc (Layout::Layout): Initialize new members.
2706         (Layout::get_output_section_flags): New function.
2707         (Layout::choose_output_section): Call get_output_section_flags.
2708         (Layout::layout): Make output section for mapping to a unique segment.
2709         (Layout::insert_section_segment_map): New function.
2710         (Layout::attach_allocated_section_to_segment): Make unique segment for
2711         output sections marked so.
2712         (Layout::segment_precedes): Check for unique segments when sorting.
2713         * layout.h (Layout::Unique_segment_info): New struct.
2714         (Layout::Section_segment_map): New typedef.
2715         (Layout::insert_section_segment_map): New function.
2716         (Layout::get_output_section_flags): New function.
2717         (Layout::is_unique_segment_for_sections_specified): New function.
2718         (Layout::set_unique_segment_for_sections_specified): New function.
2719         (Layout::unique_segment_for_sections_specified_): New member.
2720         (Layout::section_segment_map_): New member.
2721         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2722         Rename is_gc_pass_one to is_pass_one.
2723         Rename is_gc_pass_two to is_pass_two.
2724         Rename is_gc_or_icf to is_two_pass.
2725         Check for which pass based on whether symbols data is present.
2726         Make it two pass when unique segments for sections is desired.
2727         * output.cc (Output_section::Output_section): Initialize new
2728         members.
2729         * output.h (Output_section::is_unique_segment): New function.
2730         (Output_section::set_is_unique_segment): New function.
2731         (Output_section::is_unique_segment_): New member.
2732         (Output_section::extra_segment_flags): New function.
2733         (Output_section::set_extra_segment_flags): New function.
2734         (Output_section::extra_segment_flags_): New member.
2735         (Output_section::segment_alignment): New function.
2736         (Output_section::set_segment_alignment): New function.
2737         (Output_section::segment_alignment_): New member.
2738         (Output_segment::Output_segment): Initialize is_unique_segment_.
2739         (Output_segment::is_unique_segment): New function.
2740         (Output_segment::set_is_unique_segment): New function.
2741         (Output_segment::is_unique_segment_): New member.
2742         * plugin.cc (allow_unique_segment_for_sections): New function.
2743         (unique_segment_for_sections): New function.
2744         (Plugin::load): Add new functions to transfer vector.
2745         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2746         * Makefile.in: Regenerate.
2747         * testsuite/plugin_final_layout.sh: Check if unique segment
2748         functionality works.
2749         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2750         are available.
2751         (allow_unique_segment_for_sections): New global.
2752         (unique_segment_for_sections): New global.
2753         (claim_file_hook): Call allow_unique_segment_for_sections.
2754         (all_symbols_read_hook): Call unique_segment_for_sections.
2755
2756 2012-08-22  Cary Coutant  <ccoutant@google.com>
2757
2758         * layout.cc (Layout::include_section): Don't assert on GROUP
2759         sections with --emit-relocs.
2760
2761 2012-08-21  Cary Coutant  <ccoutant@google.com>
2762
2763         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2764         if --export-dynamic-symbol names an undef symbol.
2765
2766 2012-08-18  Alan Modra  <amodra@gmail.com>
2767
2768         * powerpc.cc: Formatting and white space.
2769         (Powerpc_relobj): Rename got2_section_ to special_.
2770         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2771         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2772         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2773         (Target_powerpc): Add Address typedef and invalid_address.  Use
2774         throughout.
2775         (Target_powerpc::is_branch_reloc): New function.
2776         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2777         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2778         for dst_mask, value and addend.
2779         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2780         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2781         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2782         uint16_t for 24-bit offset.  Use get_output_section_offset and
2783         check return.
2784         (Target_powerpc::Scan::local): Handle more relocs.
2785         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2786         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2787         Plug in toc restoring insn after plt calls.  Translate branches
2788         to function descriptor symbols to corresponding entry point.
2789         (Target_powerpc::relocate_for_relocatable): Check return from
2790         get_output_section_offset.
2791         * symtab.h: Comment typo.
2792
2793 2012-08-14  Ian Lance Taylor  <iant@google.com>
2794
2795         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2796         unsupported_relocal_local to call unsupported_reloc_global.
2797
2798 2012-08-14  Nick Clifton  <nickc@redhat.com>
2799
2800         PR ld/14265
2801         * script-sections.cc (Sections_element::output_section_name): Add
2802         keep return parameter.
2803         (Output_section_element::match_name): Add keep return parameter.
2804         Return the value of the keep_ member.
2805         * script-sections.h (class Output_section): Update
2806         output_section_name prototype.
2807         * layout.cc (Layout::keep_input_section): New public member
2808         function.
2809         (Layout::choose_output_section): Pass keep parameter to
2810         output_section_name.
2811         * layout.h (class Layout): Add keep_input_section.
2812         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2813         sections.
2814         * testsuite/Makefile.am: Add a test.
2815         * testsuite/Makefile.in: Regenerate.
2816         * testsuite/pr14265.c: Source file for the test.
2817         * testsuite/pr14265.t: Linker script for the test.
2818         * testsuite/pr14265.sh: Shell script for the test.
2819
2820 2012-08-14  Alan Modra  <amodra@gmail.com>
2821
2822         * target.h (Target::output_section_name): New function.
2823         (Target::do_output_section_name): New function.
2824         * layout.cc (Layout::choose_output_section): Call the above.
2825         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2826
2827 2012-08-14  Alan Modra  <amodra@gmail.com>
2828
2829         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2830         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2831         for replace_constant call.
2832         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2833         (Output_data_glink::do_print_to_mapfile): New function.
2834         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2835         (Target_powerpc::Relocate::relocate): Likewise.
2836
2837 2012-08-14  Alan Modra  <amodra@gmail.com>
2838
2839         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2840         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2841         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2842         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2843         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2844         here.
2845         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2846         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2847         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2848         here.
2849         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2850         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2851
2852 2012-08-12  Alan Modra  <amodra@gmail.com>
2853
2854         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2855         (glink insn constants): Use uint32_t.
2856         (Output_data_glink::add_entry): Use insert, not [] operator.
2857
2858 2012-08-11  Alan Modra  <amodra@gmail.com>
2859
2860         * object.h (Sized_relobj_file::find_shdr): New function.
2861         (Sized_relobj_file::find_special_sections): New function.
2862         * object.cc (Sized_relobj_file::find_shdr): New function.
2863         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2864         (Sized_relobj_file::find_special_sections): New function, split out..
2865         (Sized_relobj_file::do_read_symbols): ..from here.
2866         * output.h (Output_data_got::replace_constant): New function.
2867         (Output_data_got::num_entries): New function.
2868         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2869         (Output_data_got::got_offset): Protected rather than private.
2870         (Output_data_got::replace_got_entry): New function.
2871         * output.cc (Output_data_got::replace_got_entry): New function.
2872         * powerpc.cc (class Powerpc_relobj): New.
2873         (class Powerpc_relocate_functions): Delete all psymval variants or
2874         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2875         Implement _ha functions using corresponding _hi function.
2876         (Powerpc_relobj::find_special_sections): New function.
2877         (Target_powerpc::do_make_elf_object): New function.
2878         (class Output_data_got_powerpc): New.
2879         (class Output_data_glink): New.
2880         (class Powerpc_scan_relocatable_reloc): New.
2881         Many more changes througout file.
2882
2883 2012-08-09  Nick Clifton  <nickc@redhat.com>
2884
2885         * po/vi.po: Updated Vietnamese translation.
2886
2887 2012-08-07  Ian Lance Taylor  <iant@google.com>
2888
2889         * layout.cc (Layout::add_target_dynamic_tags): If
2890         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2891         plt_rel.
2892
2893 2012-07-30  Nick Clifton  <nickc@redhat.com>
2894
2895         * po/gold.pot: Updated template.
2896         * po/es.po: Updated Spanish translation.
2897
2898 2012-07-18  Cary Coutant  <ccoutant@google.com>
2899
2900         PR gold/14344
2901         * configure.ac: Add check for -gpubnames support.
2902         * configure: Regenerate.
2903         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2904         support; force -gno-pubnames.
2905         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2906         support.
2907         (gdb_index_test_4): New test.
2908         * testsuite/Makefile.in: Regenerate.
2909         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2910         * testsuite/gdb_index_test_2.sh: Likewise.
2911         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2912         * testsuite/gdb_index_test_4.sh: New script.
2913         * testsuite/gdb_index_test_comm.sh: New script with common code;
2914         don't look for space after colon.
2915
2916 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2917
2918         * gold.cc (queue_middle_tasks): Update function order only after
2919         deferred objects due to plugins are processed.
2920
2921 2012-07-11  Ian Lance Taylor  <iant@google.com>
2922
2923         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2924         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2925         (Target_arm::scan_reloc_for_stub): Likewise.
2926         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2927         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2928         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2929         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2930         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2931
2932 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2933             Ian Lance Taylor  <iant@google.com>
2934
2935         PR gold/14309
2936         * configure.ac: Test whether std::tr1::hash<off_t> works.
2937         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2938         needed.
2939         * output.h (class Output_fill): Add virtual destructor.
2940         * configure, config.in: Rebuild.
2941
2942 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2943
2944         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2945
2946 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2947
2948         * plugin.cc (Plugin::load): Handle position independent executables.
2949
2950 2012-06-06  Cary Coutant  <ccoutant@google.com>
2951
2952         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2953         add .debug_macro.
2954         (lines_only_debug_sections): Likewise.
2955         (gdb_fast_lookup_sections): New static array.
2956         (is_gdb_debug_section): Rename formal parameter.
2957         (is_lines_only_debug_section): Likewise.
2958         (is_gdb_fast_lookup_section): New function.
2959         (Layout::include_section): Check for ".zdebug_" prefix; pass
2960         section name suffix to is_gdb_debug_section, et al.; check for
2961         fast-lookup sections when building .gdb_index.
2962         * options.h (--strip-debug-gdb): Update GDB version number.
2963
2964 2012-06-06  Cary Coutant  <ccoutant@google.com>
2965
2966         * configure.ac: Add check for fallocate.
2967         * configure: Regenerate.
2968         * config.in: Regenerate.
2969
2970         * options.h (class General_options): Add --mmap-output-file and
2971         --posix-fallocate options.
2972         * output.cc: (posix_fallocate): Remove; replace with...
2973         (gold_fallocate): New function.
2974         (Output_file::map_no_anonymous): Call gold_fallocate.
2975         (Output_file::map): Check --mmap-output-file option.
2976
2977 2012-06-05  Jing Yu  <jingyu@google.com>
2978
2979         * gold.h (textdomain): Add do {} to empty while(0).
2980         (bindtextdomain): Likewise.
2981
2982 2012-06-04  Cary Coutant  <ccoutant@google.com>
2983
2984         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2985         has_dynsym_index.
2986
2987 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2988
2989         * symtab.cc (Symbol_table::define_special_symbol):
2990         Initialize *poldsym to prevent uninitialized variable errors.
2991
2992 2012-05-23  Cary Coutant  <ccoutant@google.com>
2993
2994         * layout.cc (Layout::section_name_mapping): Add rules to handle
2995         exact match on .data.rel.ro.local or .data.rel.ro.
2996         (Layout::output_section_name): Check for exact matches.
2997
2998 2012-05-23  Cary Coutant  <ccoutant@google.com>
2999
3000         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3001         more carefully.
3002
3003 2012-05-22  Cary Coutant  <ccoutant@google.com>
3004
3005         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3006         object before exporting symbol.
3007
3008 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3009
3010         * testsuite/tls_test.cc: Include "config.h" first.
3011         * testsuite/tls_test_c.c: Likewise.
3012
3013 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3014             Nick Clifton  <nickc@redhat.com>
3015
3016         PR 14072
3017         * configure.in: Add check that sysdep.h has been included before
3018         any system header files.
3019         * configure: Regenerate.
3020         * config.in: Regenerate.
3021
3022 2012-05-14  Cary Coutant  <ccoutant@google.com>
3023
3024         * layout.cc (Layout::make_output_section): Mark .tdata section
3025         as RELRO.
3026         * testsuite/relro_test.cc: Add a TLS variable.
3027
3028 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3029
3030         PR gold/14091
3031         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3032         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3033         R_X86_64_64.
3034
3035 2012-05-08  Cary Coutant  <ccoutant@google.com>
3036
3037         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3038         (lines_only_debug_sections): Likewise.
3039
3040 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3041
3042         * nacl.cc: New file.
3043         * nacl.h: New file.
3044         * Makefile.am (CCFILES, HFILES): Add them.
3045         * Makefile.in: Regenerate.
3046         * i386.cc (Output_data_plt_i386_nacl): New class.
3047         (Output_data_plt_i386_nacl_exec): New class.
3048         (Output_data_plt_i386_nacl_dyn): New class.
3049         (Target_i386_nacl): New class.
3050         (Target_selector_i386_nacl): New class.
3051         (target_selector_i386): Use it instead of Target_selector_i386.
3052         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3053         (Target_x86_64_nacl): New class.
3054         (Target_selector_x86_64_nacl): New class.
3055         (target_selector_x86_64, target_selector_x32): Use it instead of
3056         Target_selector_x86_64.
3057         * arm.cc (Output_data_plt_arm_nacl): New class.
3058         (Target_arm_nacl): New class.
3059         (Target_selector_arm_nacl): New class.
3060         (target_selector_arm, target_selector_armbe): Use it instead of
3061         Target_selector_arm.
3062
3063         * target-select.cc (select_target): Take new Input_file* and off_t
3064         arguments, pass them on to recognize method of selector.
3065         * object.cc (make_elf_sized_object): Update caller.
3066         * parameters.cc (parameters_force_valid_target): Likewise.
3067         * incremental.cc (make_sized_incremental_binary): Likewise.
3068         * target-select.h: Update decl.
3069         (Target_selector::recognize): Take new Input_file* argument,
3070         pass it on to do_recognize.
3071         (Target_selector::do_recognize): Take new Input_file* argument.
3072         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3073         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3074         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3075         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3076
3077         * target.h (Target::Target_info): New members isolate_execinstr
3078         and rosegment_gap.
3079         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3080         * arm.cc (Target_arm::arm_info): Update initializer.
3081         * i386.cc (Target_i386::i386_info): Likewise.
3082         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3083         * sparc.cc (Target_sparc::sparc_info): Likewise.
3084         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3085         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3086         * layout.cc (Layout::attach_allocated_section_to_segment):
3087         Take new const Target* argument.  If target->isolate_execinstr(), act
3088         like --rosegment.
3089         (Layout::find_first_load_seg): Take new const Target* argument;
3090         if target->isolate_execinstr(), reject PF_X segments.
3091         (Layout::relaxation_loop_body): Update caller.
3092         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3093         reset file offset to zero when we hit LOAD_SEG, and then do a second
3094         loop over the segments before LOAD_SEG to reassign offsets after
3095         addresses have been determined.  Handle target->rosegment_gap().
3096         (Layout::attach_section_to_segment): Take new const Target* argument;
3097         pass it to attach_allocated_section_to_segment.
3098         (Layout::make_output_section): Update caller.
3099         (Layout::attach_sections_to_segments): Take new const Target* argument;
3100         pass it to attach_section_to_segment.
3101         * gold.cc (queue_middle_tasks): Update caller.
3102         * layout.h (Layout): Update method decls with new arguments.
3103
3104         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3105         Target_info pointer to use.
3106         (Target_arm::do_make_data_plt): New virtual method.
3107         (Target_arm::make_data_plt): New method that calls it.
3108         (Target_arm::make_plt_entry): Use it.
3109         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3110         for the section alignment.
3111         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3112         method.
3113         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3114         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3115         method.
3116         (Output_data_plt_arm::get_plt_entry_size): Call it.
3117         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3118         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3119         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3120         method.
3121         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3122         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3123         method instead of sizeof(plt_entry).
3124         (Output_data_plt_arm::add_entry): Likewise.
3125         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3126         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3127         than static method.
3128         (Target_arm::plt_entry_size): Likewise.
3129         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3130         Move to ...
3131         (Output_data_plt_arm_standard): ... here, new class.
3132         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3133         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3134         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3135
3136         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3137         Take additional argument for the PLT entry size.
3138         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3139         Use get_plt_entry_size method rather than plt_entry_size variable.
3140         (Output_data_plt_x86_64::reserve_slot): Likewise.
3141         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3142         (Output_data_plt_x86_64::add_entry): Likewise.
3143         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3144         (Output_data_plt_x86_64::address_for_global): Likewise.
3145         (Output_data_plt_x86_64::address_for_local): Likewise.
3146         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3147         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3148         Make method non-static.
3149         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3150         method.
3151         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3152         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3153         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3154         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3155         virtual method.
3156         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3157         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3158         virtual method.
3159         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3160         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3161         virtual method.
3162         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3163         (Output_data_plt_x86_64::plt_entry_size)
3164         (Output_data_plt_x86_64::first_plt_entry)
3165         (Output_data_plt_x86_64::plt_entry)
3166         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3167         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3168         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3169         (Output_data_plt_x86_64_standard): ... here, new class.
3170         (Target_x86_64::Target_x86_64): Take optional argument for the
3171         Target_info pointer to use.
3172         (Target_x86_64::do_make_data_plt): New virtual method.
3173         (Target_x86_64::make_data_plt): New method to call it.
3174         (Target_x86_64::init_got_plt_for_update): Use that.
3175         Call this->plt_->add_eh_frame method here.
3176         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3177         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3178         rather than static method.
3179         (Target_x86_64::plt_entry_size): Likewise.
3180         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3181         rather than plt_entry_size variable.  Move guts of PLT filling to...
3182         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3183         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3184         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3185
3186         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3187         additional argument for the section alignment.
3188         Don't do add_eh_frame_for_plt here.
3189         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3190         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3191         variable.
3192         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3193         method.
3194         (Output_data_plt_i386::get_plt_entry_size): Call it.
3195         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3196         (Output_data_plt_i386::add_eh_frame): New method to call it.
3197         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3198         method.
3199         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3200         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3201         method.
3202         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3203         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3204         method instead of plt_entry_size.
3205         (Output_data_plt_i386::plt_entry_size)
3206         (Output_data_plt_i386::plt_eh_frame_fde_size)
3207         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3208         (Output_data_plt_i386_standard): ... here, new class.
3209         (Output_data_plt_i386_exec): New class.
3210         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3211         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3212         (Output_data_plt_i386::exec_plt_entry): Move to ...
3213         (Output_data_plt_i386_exec::plt_entry): ... here.
3214         (Output_data_plt_i386_dyn): New class.
3215         (Output_data_plt_i386::first_plt_entry): Move to ...
3216         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3217         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3218         (Output_data_plt_i386_dyn::plt_entry): ... here.
3219         (Target_i386::Target_i386): Take optional argument for the Target_info
3220         pointer to use.
3221         (Target_i386::do_make_data_plt): New virtual method.
3222         (Target_i386::make_data_plt): New method to call it.
3223         (Target_i386::make_plt_section): Use that.
3224         Call this->plt_->add_eh_frame method here.
3225         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3226         rather than plt_entry_size variable.
3227         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3228         (Output_data_plt_i386::address_for_local): Likewise.
3229         (Output_data_plt_i386::do_write): Likewise.
3230         Move guts of PLT filling to...
3231         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3232         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3233         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3234         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3235
3236 2012-05-01  Cary Coutant  <ccoutant@google.com>
3237
3238         * dwarf_reader.cc (Dwarf_die::read_attributes)
3239         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3240         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3241         * reduced_debug_output.cc
3242         (Output_reduced_debug_info_section::get_die_end): Remove
3243         DW_FORM_GNU_ref_index.  Add default case.
3244
3245 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3246
3247         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3248         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3249         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3250         DW_AT_high_pc as offset from DW_AT_low_pc.
3251
3252         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3253         * testsuite/Makefile.in: Regenerate.
3254         * testsuite/gdb_index_test_3.c: New test source file.
3255         * testsuite/gdb_index_test_3.sh: New test source file.
3256
3257 2012-04-25  Ian Lance Taylor  <iant@google.com>
3258
3259         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3260         pointer.
3261         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3262         as a class, not a struct.
3263         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3264         (Target_arm::apply_cortex_a8_workaround): Likewise.
3265         * gc.h: Declare Reloc_types as a struct, not a class.
3266         * object.h: Declare Symbols_data as a struct.
3267         * reloc.h: Declare Read_relocs_data as a struct.
3268         * target.h: Declare Relocate_info as a struct.
3269
3270 2012-04-24  David S. Miller  <davem@davemloft.net>
3271
3272         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3273         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3274         and R_SPARC_WPLT30.
3275
3276 2012-04-24  Cary Coutant  <ccoutant@google.com>
3277
3278         * incremental-dump.cc (find_input_containing_global): Replace
3279         magic number with symbolic constant.
3280         (dump_incremental_inputs): Update version number.
3281         * incremental.cc (Output_section_incremental_inputs): Update version
3282         number; import symbolic constants from Incremental_inputs_reader.
3283         (Incremental_inputs::create_data_sections): Align relocations
3284         section correctly for 64-bit targets.
3285         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3286         constants; add padding.
3287         (Output_section_incremental_inputs::write_header): Add assert for
3288         header_size.
3289         (Output_section_incremental_inputs::write_input_files): Add assert
3290         for input_entry_size.
3291         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3292         add assert for object_info_size, input_section_entry_size,
3293         global_sym_entry_size.
3294         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3295         for data structure sizes; use them.
3296         (Incremental_input_entry_reader): Import symbolic constants from
3297         Incremental_inputs_reader; use them.
3298
3299 2012-04-23  David S. Miller  <davem@davemloft.net>
3300
3301         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3302         and elf_flags_set_.
3303         (Target_sparc::Target_sparc): Initialize new fields.
3304         (Target_sparc::do_make_elf_object): New function.
3305         (Target_sparc::do_adjust_elf_header): New function.
3306
3307 2012-04-23  Cary Coutant  <ccoutant@google.com>
3308
3309         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3310         CU range table of gdb index.
3311
3312 2012-04-20  David S. Miller  <davem@davemloft.net>
3313
3314         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3315         instead of false.
3316
3317 2012-04-16  David S. Miller  <davem@davemloft.net>
3318
3319         * sparc.cc (Target_sparc::got_address): New function.
3320         (Sparc_relocate_functions::gdop_hix22): New function.
3321         (Sparc_relocate_functions::gdop_lox10): New function.
3322         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3323         relocs.
3324         (Target_sparc::Scan::local): Likewise if the global symbol is not
3325         preemptible and is not IFUNC.
3326         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3327         transformations for local and non-preemptible non-IFUNC global
3328         symbols.
3329
3330         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3331         writing out 64-bit part of ranges.
3332
3333         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3334         -fpic and -fpie respectively.
3335         * Makefile.in: Regenerate.
3336
3337         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3338         (Target_sparc::Target_sparc): Initialize new field.
3339         (Target_sparc::do_plt_section_for_global): New function.
3340         (Target_sparc::do_plt_section_for_local): New function.
3341         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3342         (Target_sparc::make_plt_section): New function, broken out of
3343         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3344         (Target_sparc::make_plt_entry): Call make_plt_section.
3345         (Target_sparc::make_local_ifunc_plt_entry): New function.
3346         (Target_sparc::rela_ifunc_section): New function.
3347         (Target_sparc::plt_section): Remove const.
3348         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3349         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3350         and ifunc_count_ fields.
3351         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3352         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3353         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3354         (Output_data_plt_sparc::rela_ifunc): New function.
3355         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3356         (Output_data_plt_sparc::has_ifunc_section): New function.
3357         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3358         (Output_data_plt_sparc::address_for_global): New function.
3359         (Output_data_plt_sparc::address_for_local): New function.
3360         (Output_data_plt_sparc::plt_index_to_offset): New function.
3361         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3362         and entry_count.
3363         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3364         entry_count.
3365         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3366         R_SPARC_JMP_IREL to switch.
3367         (Target_sparc::Scan::check_non_pic): Likewise.
3368         (Target_sparc::Scan::local): Handle IFUNC symbols.
3369         (Target_sparc::Scan::local): Likewise.
3370         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3371         and plt_address_for_local.
3372         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3373         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3374
3375         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3376         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3377         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3378         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3379         global relocs too.
3380         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3381         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3382         calls.
3383         * sparc.cc (Target_sparc::Scan::global): Likewise.
3384         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3385
3386 2012-04-16  Cary Coutant  <ccoutant@google.com>
3387
3388         * archive.cc (Library_base::should_include_member): Check for
3389         --export-dynamic-symbol.
3390         * options.h (class General_options): Add --export-dynamic-symbol.
3391         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3392         --export-dynamic-symbol.
3393         (Symbol_table::gc_mark_undef_symbols): Likewise.
3394         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3395
3396 2012-04-12  David S. Miller  <davem@davemloft.net>
3397
3398         * sparc.cc (Reloc::wdisp10): New relocation method.
3399         (Reloc::h34): Likewise.
3400         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3401         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3402         R_SPARC_WDISP10.
3403         (Target_sparc::Scan::local): Likewise.
3404         (Target_sparc::Scan::global): Likewise.
3405         (Target_sparc::Relocate::relocate): Likewise.
3406
3407 2012-04-09  Cary Coutant  <ccoutant@google.com>
3408
3409         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3410         low_pc == 0.
3411
3412 2012-04-06  Ian Lance Taylor  <iant@google.com>
3413
3414         * timer.cc: #include <unistd.h>.
3415
3416 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3417
3418         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3419         * config.in: Regenerate.
3420         * configure: Regenerate.
3421
3422 2012-04-05  Nick Clifton  <nickc@redhat.com>
3423
3424         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3425         (AM_LC_MESSAGES): Add.
3426         * aclocal.m4: Regenerate.
3427         * config.in: Regenerate.
3428         * configure: Regenerate.
3429
3430 2012-03-21  Cary Coutant  <ccoutant@google.com>
3431
3432         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3433         * Makefile.in: Regenerate.
3434         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3435         (Sized_elf_reloc_mapper::symbol_section): New function.
3436         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3437         (make_elf_reloc_mapper): New function.
3438         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3439         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3440         (Dwarf_abbrev_table::do_get_abbrev): New function.
3441         (Dwarf_ranges_table::read_ranges_table): New function.
3442         (Dwarf_ranges_table::read_range_list): New function.
3443         (Dwarf_pubnames_table::read_section): New function.
3444         (Dwarf_pubnames_table::read_header): New function.
3445         (Dwarf_pubnames_table::next_name): New function.
3446         (Dwarf_die::Dwarf_die): New function.
3447         (Dwarf_die::read_attributes): New function.
3448         (Dwarf_die::skip_attributes): New function.
3449         (Dwarf_die::set_name): New function.
3450         (Dwarf_die::set_linkage_name): New function.
3451         (Dwarf_die::attribute): New function.
3452         (Dwarf_die::string_attribute): New function.
3453         (Dwarf_die::int_attribute): New function.
3454         (Dwarf_die::uint_attribute): New function.
3455         (Dwarf_die::ref_attribute): New function.
3456         (Dwarf_die::child_offset): New function.
3457         (Dwarf_die::sibling_offset): New function.
3458         (Dwarf_info_reader::check_buffer): New function.
3459         (Dwarf_info_reader::parse): New function.
3460         (Dwarf_info_reader::do_parse): New function.
3461         (Dwarf_info_reader::do_read_string_table): New function.
3462         (Dwarf_info_reader::lookup_reloc): New function.
3463         (Dwarf_info_reader::get_string): New function.
3464         (Dwarf_info_reader::visit_compilation_unit): New function.
3465         (Dwarf_info_reader::visit_type_unit): New function.
3466         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3467         Sized_elf_reloc_mapper.
3468         (Sized_dwarf_line_info::symbol_section): Remove function.
3469         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3470         (Sized_dwarf_line_info::read_line_mappings): Remove object
3471         parameter, adjust callers.
3472         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3473         * dwarf_reader.h: Include <sys/types.h>.
3474         (class Track_relocs): Remove forward declaration.
3475         (class Elf_reloc_mapper): New class.
3476         (class Sized_elf_reloc_mapper): New class.
3477         (class Dwarf_abbrev_table): New class.
3478         (class Dwarf_range_list): New class.
3479         (class Dwarf_ranges_table): New class.
3480         (class Dwarf_pubnames_table): New class.
3481         (class Dwarf_die): New class.
3482         (class Dwarf_info_reader): New class.
3483         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3484         (Sized_dwarf_line_info::symbol_section): Remove member function.
3485         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3486         base class.
3487         * gdb-index.cc: New source file.
3488         * gdb-index.h: New source file.
3489         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3490         and .debug_types sections, call Layout::add_to_gdb_index.
3491         (Sized_relobj_incr::do_section_name): Implement.
3492         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3493         return type; Implement.
3494         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3495         return type.
3496         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3497         parameter list and return type.
3498         (Sized_incr_dynobj::do_section_contents): Likewise.
3499         * layout.cc: Include gdb-index.h.
3500         (Layout::Layout): Initialize gdb_index_data_.
3501         (Layout::init_fixed_output_section): Check for .gdb_index section.
3502         (Layout::add_to_gdb_index): New function. Instantiate.
3503         * layout.h: Add forward declaration for class Gdb_index.
3504         (Layout::add_to_gdb_index): New member function.
3505         (Layout::gdb_index_data_): New data member.
3506         * main.cc: Include gdb-index.h.
3507         (main): Print statistics for gdb index.
3508         * object.cc (Object::section_contents): Move code into
3509         do_section_contents.
3510         (need_decompressed_section): Check for sections needed when building
3511         gdb index.
3512         (build_compressed_section_map): Likewise.
3513         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3514         gdb index.
3515         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3516         sections; call Layout::add_to_gdb_index.
3517         (Sized_relobj_file::do_decompressed_section_contents): Call
3518         do_section_contents directly.
3519         * object.h (Object::do_section_contents): Adjust parameter list and
3520         return type.
3521         (Object::do_decompressed_section_contents): Call do_section_contents
3522         directly.
3523         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3524         return type.
3525         * options.h (class General_options): Add --gdb-index option.
3526         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3527         list and return type.
3528         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3529         * reloc.h (Track_relocs::checkpoint): New function.
3530         (Track_relocs::reset): New function.
3531
3532         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3533         New test cases.
3534         * testsuite/Makefile.in: Regenerate.
3535         * testsuite/gdb_index_test.cc: New test source file.
3536         * testsuite/gdb_index_test_1.sh: New test source file.
3537         * testsuite/gdb_index_test_2.sh: New test source file.
3538
3539 2012-03-19  Doug Kwan  <dougkwan@google.com>
3540
3541         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3542         (Target_arm::do_finalize_sections): Remove code which defines
3543         __exidx_start and __exidx_end.  Make symbol table parameter
3544         anonymous as it is not used.
3545         * gold.cc (queue_middle_tasks): Call target hook to define any
3546         target-specific symbols.
3547         * target.h (Target::define_standard_symbols): New method.
3548         (Target::do_define_standard_symbols): Same.
3549         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3550         * testsuite/Makefile.in: Regenerate.
3551         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3552         and __exidx_end.
3553         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3554         relocations are generated for __exidx_start and __exidx_end.
3555
3556 2012-03-16  Doug Kwan  <dougkwan@google.com>
3557
3558         * testsuite/Makefile.am: Disable test initpri3b.
3559         * testsuite/Makefile.in: Regenerate.
3560
3561 2012-03-15  Doug Kwan  <dougkwan@google.com>
3562
3563         * arm.cc (Target_arm::got_section): Make .got section read-only
3564         if -z now is given.
3565
3566 2012-03-15  Ian Lance Taylor  <iant@google.com>
3567
3568         PR gold/13850
3569         * layout.cc (Layout::make_output_section): Correctly mark
3570         SHT_INIT_ARRAY, et. al., as relro.
3571
3572 2012-03-14  Doug Kwan  <dougkwan@google.com>
3573
3574         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3575         dynamic relocations for protected symbols in shared objects.
3576
3577 2012-03-13  Ian Lance Taylor  <iant@google.com>
3578
3579         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3580         keep the larger alignment.
3581
3582 2012-03-12  Cary Coutant  <ccoutant@google.com>
3583
3584         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3585         handling of DW_LNE_define_file.
3586
3587 2012-03-12  Cary Coutant  <ccoutant@google.com>
3588
3589         * reduced_debug_output.cc
3590         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3591         codes to switch.
3592
3593 2012-02-29  Cary Coutant  <ccoutant@google.com>
3594
3595         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3596
3597 2012-02-29  Cary Coutant  <ccoutant@google.com>
3598
3599         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3600         Call Object::decompressed_section_contents.
3601         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3602         New dtor.
3603         (Sized_dwarf_line_info::buffer_start_): New data member.
3604         * merge.cc (Output_merge_data::do_add_input_section): Call
3605         Object::decompressed_section_contents.
3606         (Output_merge_string::do_add_input_section): Likewise.
3607         * object.cc (need_decompressed_section): New function.
3608         (build_compressed_section_map): Decompress sections needed later.
3609         (Sized_relobj_file::do_decompressed_section_contents): New function.
3610         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3611         * object.h (Object::decompressed_section_contents): New function.
3612         (Object::discard_decompressed_sections): New function.
3613         (Object::do_decompressed_section_contents): New function.
3614         (Object::do_discard_decompressed_sections): New function.
3615         (Compressed_section_info): New type.
3616         (Compressed_section_map): Include decompressed section contents.
3617         (Sized_relobj_file::do_decompressed_section_contents): New function.
3618         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3619
3620 2012-02-16  Cary Coutant  <ccoutant@google.com>
3621
3622         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3623         * testsuite/Makefile.in: Regenerate.
3624
3625 2012-02-14  Cary Coutant  <ccoutant@google.com>
3626
3627         * options.cc (General_options::finalize): Disallow -pie and -static.
3628
3629 2012-02-03  Doug Kwan  <dougkwan@google.com>
3630
3631         * arm.cc (Arm_relocate_functions::abs8,
3632         Arm_relocate_functions::abs16): Use
3633         Bits::has_signed_unsigned_overflow32.
3634         (Arm_relocate_functions::thm_abs8): Correct range of
3635         overflow check.
3636         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3637         in assertions.
3638
3639 2012-02-02  Doug Kwan  <dougkwan@google.com>
3640
3641         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3642         position independent outputs, not just shared objects.
3643
3644 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3645
3646         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3647         * configure: Regenerated.
3648
3649 2012-01-27  Ian Lance Taylor  <iant@google.com>
3650
3651         * reloc.h (Bits): New class with static functions, copied from
3652         namespace utils in arm.cc.
3653         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3654         instead.
3655
3656 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3657
3658         * incremental.cc (write_info_blocks): Correct relocation offset.
3659
3660 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3661
3662         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3663         (Relocate::tls_gd_to_le): Likewise.
3664
3665 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3666
3667         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3668
3669 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3670
3671         * configure.ac: Check if -mcmodel=medium works.
3672         * configure: Regenerated.
3673
3674 2012-01-24  Cary Coutant  <ccoutant@google.com>
3675
3676         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3677         definition and ...
3678         (read_unsigned_LEB_128_x): ... this new function.
3679         (read_signed_LEB_128): Replaced with inline definition and ...
3680         (read_signed_LEB_128_x): ... this new function.
3681         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3682         (read_unsigned_LEB_128): Add inline definition.
3683         (read_signed_LEB_128_x): New function.
3684         (read_signed_LEB_128): Add inline definition.
3685         * testsuite/Makefile.am (leb128_unittest): New unit test.
3686         * testsuite/Makefile.in: Regenerate.
3687         * testsuite/leb128_unittest.cc: New unit test.
3688
3689 2012-01-23  Ian Lance Taylor  <iant@google.com>
3690
3691         PR gold/13617
3692         * i386.cc (Target_i386::do_code_fill): When using a jmp
3693         instruction, pad with nop instructions.
3694         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3695
3696 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3697
3698         * x86_64.cc (gc_process_relocs): Add typename on types used in
3699         template.
3700         (scan_relocs): Likewise.
3701         (relocate_section): Likewise.
3702         (apply_relocation): Likewise.
3703
3704 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3705
3706         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3707         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3708         under x32.
3709
3710 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3711
3712         * x86_64.cc: Initial support for x32.
3713
3714 2012-01-03  Cary Coutant  <ccoutant@google.com>
3715
3716         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3717         Use abstract base class for GOT.
3718         * gold/output.h (class Output_data_got_base): New abstract base class.
3719         (class Output_data_got): Derive from new base class, adjust ctors.
3720         (Output_data_got::reserve_slot): Make virtual; rename to
3721         do_reserve_slot; Adjust callers.
3722         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3723         pointer to abstract base class.
3724         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3725
3726 2011-12-18  Ian Lance Taylor  <iant@google.com>
3727
3728         * object.h (Relobj::local_symbol_value): New function.
3729         (Relobj::local_plt_offset): New function.
3730         (Relobj::local_has_got_offset): New function.
3731         (Relobj::local_got_offset): New function.
3732         (Relobj::set_local_got_offset): New function.
3733         (Relobj::do_local_symbol_value): New pure virtual function.
3734         (Relobj::do_local_plt_offset): Likewise.
3735         (Relobj::do_local_has_got_offset): Likewise.
3736         (Relobj::do_local_got_offset): Likewise.
3737         (Relobj::do_set_local_got_offset): Likewise.
3738         (Sized_relobj::do_local_has_got_offset): Rename from
3739         local_has_got_offset.
3740         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3741         (Sized_relobj::do_set_local_got_offset): Rename from
3742         set_local_got_offset.
3743         (Sized_relobj_file::do_local_plt_offset): Rename from
3744         local_plt_offset.
3745         (Sized_relobj_file::do_local_symbol_value): New function.
3746         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3747         local_plt_offset.
3748         * output.cc (Output_data_got::Got_entry::write): Change object to
3749         Relobj.  Use local_symbol_value.
3750         (Output_data_got::add_global_with_rel): Change rel_dyn to
3751         Output_data_reloc_generic*.  Use add_global_generic.
3752         (Output_data_got::add_global_with_rela): Remove.  Change all
3753         callers to use add_global_with_rel.
3754         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3755         Output_data_reloc_generic*.  Use add_global_generic.
3756         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3757         callers to use add_global_pair_with_rel.
3758         (Output_data_got::add_local): Change object to Relobj*.
3759         (Output_data_got::add_local_plt): Likewise.
3760         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3761         change rel_dyn to Output_data_reloc_generic*.  Use
3762         add_local_generic.
3763         (Output_data_got::add_local_with_rela): Remove.  Change all
3764         callers to use all_local_with_rel.
3765         (Output_data_got::add_local_pair_with_rel): Change object to
3766         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3767         add_output_section_generic.
3768         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3769         callers to use add_local_pair_with_rel.
3770         (Output_data_got::reserve_local): Change object to Relobj*.
3771         * output.h: (class Output_data_reloc_generic): Add pure virtual
3772         declarations for add_global_generic, add_local_generic,
3773         add_output_section_generic.
3774         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3775         functions for Output_data_reloc_generic.  Update declarations for
3776         changes listed in output.cc.
3777         (class Output_data_got): Change template parameter to got_size.
3778         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3779         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3780         function.
3781         (Sized_relobj_incr::do_local_plt_offset): New function.
3782         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3783         add_global_generic.
3784
3785 2011-12-17  Cary Coutant  <ccoutant@google.com>
3786
3787         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3788         * resolve.cc (Symbol_table::resolve): Likewise.
3789         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3790         arrays.
3791         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3792
3793 2011-12-16  Ian Lance Taylor  <iant@google.com>
3794
3795         * output.h (Output_data_reloc_generic::add): Only call
3796         add_dynamic_reloc if this is a dynamic reloc section.
3797
3798 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3799
3800         PR gold/13505
3801         * target-reloc.h (apply_relocation): Replace <64, false> with
3802         <size, big_endian>.
3803
3804 2011-11-25  Nick Clifton  <nickc@redhat.com>
3805
3806         * po/it.po: New Italian translation.
3807
3808 2011-11-17  Sterling Augustine  <saugustine@google.com>
3809
3810         * script.cc (script_include_directive): Implement.
3811         (read_script_file): New local variables name and search_path. Update
3812         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3813         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3814         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3815
3816 2011-11-11  Sterling Augustine  <saugustine@google.com>
3817
3818         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3819         (file_or_sections_cmd): Likewise.
3820
3821 2011-11-11  Doug Kwan  <dougkwan@google.com>
3822
3823         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3824         if --just-symbols is given.
3825
3826 2011-11-10  Doug Kwan  <dougkwan@google.com>
3827
3828         PR gold/13362
3829         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3830         when processing data relocs.
3831         * reloc.h (Relocate_functions::rel_unaligned): New method.
3832         (Relocate_functions::pcrel_unaligned): Ditto.
3833         (Relocate_functions::rel32_unaligned): Ditto.
3834         (Relocate_functions::pcrel32_unaligned): Ditto.
3835
3836 2011-11-09  Doug Kwan  <dougkwan@google.com>
3837
3838         PR gold/13362
3839         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3840         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3841         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3842         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3843         (Relocate_functions::rel_unaligned): New.
3844         (Relocate_functions::rel32_unaligned): New.
3845         * target-reloc.h (relocate_for_relocatable): Add code to handle
3846         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3847         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3848         arm_unaligned_reloc_r): New targets.
3849         * testsuite/Makefile.in: Regenerate.
3850         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3851         linking.
3852
3853 2011-11-02  Ian Lance Taylor  <iant@google.com>
3854
3855         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3856         NATIVE_LINKER.
3857         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3858         * options.cc (General_options::finalize): Use library search path
3859         from configure script if specified.  If not native and no sysroot,
3860         only search TOOLLIBDIR.
3861         * options.h (Search_directory::Search_directory): Change name to
3862         const std::string&.
3863         (General_options::add_to_library_path_with_sysroot): Change arg to
3864         const std::string&.
3865         * configure, Makefile.in, config.in: Rebuild.
3866
3867 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3868
3869         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3870         we are working around the ARM1176 Erratum.
3871         * options.h (General_options::fix_arm1176): Add option.
3872         * testsuite/Makefile.am: Add testcases, and keep current ones
3873         working.
3874         * testsuite/Makefile.in: Regenerate.
3875         * testsuite/arm_fix_1176.s: New file.
3876         * testsuite/arm_fix_1176.sh: Likewise.
3877
3878 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3879
3880         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3881         may_use_blx_.
3882         (Target_arm::may_use_blx): Remove method.
3883         (Target_arm::set_may_use_blx): Likewise.
3884         (Target_arm::may_use_v4t_interworking): New method.
3885         (Target_arm::may_use_v5t_interworking): Likewise.
3886         (Target_arm::may_use_blx_): Remove member variable.
3887         (Arm_relocate_functions::arm_branch_common): Check for v5T
3888         interworking.
3889         (Arm_relocate_functions::thumb_branch_common): Likewise.
3890         (Reloc_stub::stub_type_for_reloc): Likewise.
3891         (Target_arm::do_finalize_sections): Correct interworking checks.
3892         * testsuite/Makefile.am: Add new tests.
3893         * testsuite/Makefile.in: Regenerate.
3894         * testsuite/arm_farcall_arm_arm.s: New test.
3895         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3896         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3897         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3898         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3899         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3900         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3901         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3902
3903 2011-10-31  Cary Coutant  <ccoutant@google.com>
3904
3905         PR gold/13023
3906         * expression.cc (Expression::eval_with_dot): Add
3907         is_section_dot_assignment parameter.
3908         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3909         absolute and assigning to dot within a section.
3910         * script-sections.cc
3911         (Output_section_element_assignment::set_section_addresses): Pass
3912         dot_section to set_if_absolute.
3913         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3914         as is_section_dot_assignment flag to eval_with_dot.
3915         (Output_section_element_dot_assignment::set_section_addresses):
3916         Likewise.
3917         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3918         parameter.  Also set value if relative to dot_section; set the
3919         symbol's output_section.
3920         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3921         parameter.  Adjust all callers.
3922         (Expression::eval_maybe_dot): Likewise.
3923         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3924         Adjust all callers.
3925         * testsuite/script_test_2.t: Test assignment of an absolute value
3926         to dot within an output section element.
3927
3928 2011-10-31  Cary Coutant  <ccoutant@google.com>
3929
3930         * options.h (class General_options): Add --[no-]gnu-unique options.
3931         * symtab.cc (Symbol_table::sized_write_globals): Convert
3932         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3933
3934 2011-10-31  Cary Coutant  <ccoutant@google.com>
3935
3936         PR gold/13359
3937         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3938         unnecessary assertion.
3939         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3940
3941 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3942
3943         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3944         gc_mark_symbol.
3945         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3946         gc_mark_symbol.
3947         Change to just keep the section associated with symbol.
3948         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3949         they are externally visible and --export-dynamic is turned on.
3950         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3951
3952 2011-10-19  Ian Lance Taylor  <iant@google.com>
3953
3954         PR gold/13163
3955         * script-sections.cc
3956         (Output_section_element_dot_assignment::needs_output_section): New
3957         function.
3958
3959 2011-10-19  Ian Lance Taylor  <iant@google.com>
3960
3961         PR gold/13204
3962         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3963         --section-start option was seen.
3964         * options.h (General_options::any_section_start): New function.
3965
3966 2011-10-18  David S. Miller  <davem@davemloft.net>
3967
3968         PR binutils/13301
3969         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3970         member to track relocation locations that have moved during TLS
3971         reloc optimizations.
3972         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3973         (Target_sparc::Relocate::relocate): Adjust view down by 4
3974         bytes if it matches reloc_adjust_addr_.
3975         (Target_sparc::Relocate::relocate_tls): Always move the
3976         __tls_get_addr call delay slot instruction forward 4 bytes when
3977         performing relaxation.
3978
3979 2011-10-18  Cary Coutant  <ccoutant@google.com>
3980
3981         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3982         (Output_file::map_no_anonymous): Check for non-zero
3983         return code from posix_fallocate.
3984
3985 2011-10-17  Cary Coutant  <ccoutant@google.com>
3986
3987         PR gold/13245
3988         * plugin.cc (is_visible_from_outside): Check for symbols
3989         referenced from dynamic objects.
3990         * resolve.cc (Symbol_table::resolve): Don't count references
3991         from dynamic objects as references from real ELF files.
3992         * testsuite/plugin_test_2.sh: Adjust expected result.
3993
3994 2011-10-17  Cary Coutant  <ccoutant@google.com>
3995
3996         * gold.cc: Include timer.h.
3997         (queue_middle_tasks): Stamp time.
3998         (queue_final_tasks): Likewise.
3999         * main.cc (main): Store timer in parameters.  Print timers
4000         for each pass.
4001         * parameters.cc (Parameters::Parameters): Initialize timer_.
4002         (Parameters::set_timer): New function.
4003         (set_parameters_timer): New function.
4004         * parameters.h (Parameters::set_timer): New function.
4005         (Parameters::timer): New function.
4006         (Parameters::timer_): New data member.
4007         (set_parameters_timer): New function.
4008         * timer.cc (Timer::stamp): New function.
4009         (Timer::get_pass_time): New function.
4010         * timer.h (Timer::stamp): New function.
4011         (Timer::get_pass_time): New function.
4012         (Timer::pass_times_): New data member.
4013
4014 2011-10-17  Cary Coutant  <ccoutant@google.com>
4015
4016         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4017         task for members of lib groups.
4018
4019 2011-10-17  Cary Coutant  <ccoutant@google.com>
4020
4021         PR gold/13288
4022         * fileread.cc (File_read::find_view): Add assert.
4023         (File_read::make_view): Move bounds check (replace with assert)...
4024         (File_read::find_or_make_view): ... to here.
4025
4026 2011-10-12  Cary Coutant  <ccoutant@google.com>
4027
4028         * output.cc (Output_file::open_base_file): Handle case where
4029         ::read returns less than requested size.
4030
4031 2011-10-10  Cary Coutant  <ccoutant@google.com>
4032
4033         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4034         Initialize defined_count_.
4035         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4036         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4037         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4038         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4039         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4040         * incremental.h (Sized_relobj_incr::defined_count_): New data
4041         member.
4042         (Sized_incr_dynobj::defined_count_): New data member.
4043         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4044         Return zeroes instead of internal error.
4045
4046 2011-10-10  Cary Coutant  <ccoutant@google.com>
4047
4048         PR gold/13249
4049         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4050         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4051         * output.h (class Output_reloc): Add use_plt_offset flag.
4052         (Output_reloc::type_): Adjust size of bit field.
4053         (Output_reloc::use_plt_offset_): New bit field.
4054         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4055         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4056         flag.  Adjust all callers.
4057         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4058         creating RELATIVE relocations.
4059
4060 2011-10-10  Nick Clifton  <nickc@redhat.com>
4061
4062         * po/es.po: Updated Spanish translation.
4063         * po/fi.po: Updated Finnish translation.
4064
4065 2011-10-03   Diego Novillo  <dnovillo@google.com>
4066
4067         * options.cc (parse_uint): Fix dereference of RETVAL.
4068
4069 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4070
4071         * layout.h (section_order_map_): New member.
4072         (get_section_order_map): New member function.
4073         * output.cc (Output_section::add_input_section): Check for patterns
4074         only when --section-ordering-file is specified.
4075         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4076         output_sections have been formed.
4077         * layout.cc (Layout_Layout): Initialize section_order_map_.
4078         * plugin.cc (update_section_order): Store order in order_map. Do not
4079         update the order.
4080         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4081         * testsuite/Makefile.in: Regenerate.
4082         * testsuite/plugin_section_order.c: New file.
4083         * testsuite/plugin_final_layout.cc: New file.
4084         * testsuite/plugin_final_layout.sh: New file.
4085
4086 2011-09-29  Cary Coutant  <ccoutant@google.com>
4087
4088         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4089         Check for NULL.
4090         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4091         symbols during incremental update.
4092         (Symbol_table::add_from_dynobj): Likewise.
4093
4094 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4095             Ian Lance Taylor  <iant@google.com>
4096
4097         * symtab.cc (Symbol_table::define_special_symbol): Always
4098         canonicalize version string.
4099
4100 2011-09-26  Cary Coutant  <ccoutant@google.com>
4101
4102         * gold.cc (queue_initial_tasks): Move option checks ...
4103         * options.cc (General_options::finalize): ... to here. Disable
4104         some options; make others fatal.
4105
4106 2011-09-26  Cary Coutant  <ccoutant@google.com>
4107
4108         gcc PR lto/47247
4109         * plugin.cc (get_symbols_v2): New function.
4110         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4111         (is_referenced_from_outside): New function.
4112         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4113         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4114         (get_symbols): Pass version parameter.
4115         (get_symbols_v2): New function.
4116         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4117         parameter.
4118         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4119         (onload): Add LDPT_GET_SYMBOLS_V2.
4120         (all_symbols_read_hook): Use get_symbols_v2; check for
4121         LDPR_PREVAILING_DEF_IRONLY_EXP.
4122         * testsuite/plugin_test_3.sh: Update expected results.
4123
4124 2011-09-23  Simon Baldwin  <simonb@google.com>
4125
4126         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4127         configuration options.
4128         * configure: Regenerate.
4129         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4130         * Makefile.in: Regenerate.
4131         * testsuite/Makefile.in: Regenerate.
4132
4133 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4134
4135         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4136
4137 2011-09-19  Cary Coutant  <ccoutant@google.com>
4138
4139         * incremental.cc (can_incremental_update): Fix typo in comment.
4140         * incremental.h (can_incremental_update): Likewise.
4141
4142 2011-09-18  Cary Coutant  <ccoutant@google.com>
4143
4144         * incremental.cc (can_incremental_update): New function.
4145         * incremental.h (can_incremental_update): New function.
4146         * layout.cc (Layout::init_fixed_output_section): Call it.
4147         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4148         * object.cc (Sized_relobj_file::do_layout): Call
4149         can_incremental_update.
4150
4151 2011-09-13  Cary Coutant  <ccoutant@google.com>
4152
4153         * configure.ac: Check for glibc support for gnu_indirect_function
4154         support with static linking, setting automake conditional
4155         IFUNC_STATIC.
4156         * Makefile.in: Regenerate.
4157         * configure: Regenerate.
4158
4159         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4160         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4161         for IFUNC_STATIC.
4162         * testsuite/Makefile.in: Regenerate.
4163
4164 2011-09-13  Cary Coutant  <ccoutant@google.com>
4165
4166         * incremental.cc (Sized_relobj_incr::do_layout): Call
4167         report_comdat_group for kept comdat sections.
4168         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4169         * testsuite/Makefile.in: Regenerate.
4170         * testsuite/incr_comdat_test_1.cc: New source file.
4171         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4172         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4173         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4174
4175 2011-09-13  Ian Lance Taylor  <iant@google.com>
4176
4177         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4178         variable external_symbols_offset.
4179
4180 2011-09-12  Ian Lance Taylor  <iant@google.com>
4181
4182         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4183         triggered if object has no symbols.
4184
4185 2011-09-09  David S. Miller  <davem@davemloft.net>
4186
4187         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4188         (Output_fill_debug_line::do_write): Likewise.
4189
4190 2011-08-29  Cary Coutant  <ccoutant@google.com>
4191
4192         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4193         casts to match formatting specs.
4194         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4195
4196 2011-08-26  Cary Coutant  <ccoutant@google.com>
4197
4198         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4199         remaining hole size when allocating.
4200         (Layout::make_output_section): Set fill methods for debug sections.
4201         * layout.h (Free_list::Free_list_node): Move from private to
4202         public.
4203         (Free_list::set_min_hole_size): New function.
4204         (Free_list::begin, Free_list::end): New functions.
4205         (Free_list::min_hole_): New data member.
4206         * output.cc: Include dwarf.h.
4207         (Output_fill_debug_info::do_minimum_hole_size): New function.
4208         (Output_fill_debug_info::do_write): New function.
4209         (Output_fill_debug_line::do_minimum_hole_size): New function.
4210         (Output_fill_debug_line::do_write): New function.
4211         (Output_section::Output_section): Initialize new data member.
4212         (Output_section::set_final_data_size): Ensure patch space is larger
4213         than minimum hole size.
4214         (Output_section::do_write): Fill holes in debug sections.
4215         * output.h (Output_fill): New class.
4216         (Output_fill_debug_info): New class.
4217         (Output_fill_debug_line): New class.
4218         (Output_section::set_free_space_fill): New function.
4219         (Output_section::free_space_fill_): New data member.
4220         * testsuite/Makefile.am (incremental_test_3): Add
4221         --incremental-patch option.
4222         (incremental_test_4): Likewise.
4223         (incremental_test_5): Likewise.
4224         (incremental_test_6): Likewise.
4225         (incremental_copy_test): Likewise.
4226         (incremental_common_test_1): Likewise.
4227         * testsuite/Makefile.in: Regenerate.
4228
4229 2011-08-26  Nick Clifton  <nickc@redhat.com>
4230
4231         * po/es.po: Updated Spanish translation.
4232
4233 2011-08-01  Cary Coutant  <ccoutant@google.com>
4234
4235         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4236         * gold/testsuite/Makefile.in: Regenerate.
4237         * gold/testsuite/justsyms_exec.c: New source file.
4238         * gold/testsuite/justsyms_lib.c: New source file.
4239
4240 2011-08-01  Cary Coutant  <ccoutant@google.com>
4241
4242         * layout.cc (Layout::set_segment_offsets): Don't realign text
4243         segment if -Ttext was specified.
4244         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4245         file type.
4246         * object.h (Sized_relobj_file::e_type): New function.
4247         (Sized_relobj_file::e_type_): New data member.
4248         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4249         base address for ET_EXEC files.
4250         * target.cc (Target::do_make_elf_object_implementation): Allow
4251         ET_EXEC files with --just-symbols option.
4252
4253 2011-07-28  Cary Coutant  <ccoutant@google.com>
4254
4255         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4256         Add thread_number parameter.
4257         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4258         * workqueue-threads.cc
4259         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4260         current thread if its thread number is greater than desired thread
4261         count.
4262         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4263         Add thread_number parameter.
4264         (Workqueue::should_cancel_thread): Likewise.
4265         (Workqueue::find_runnable_or_wait): Pass thread_number to
4266         should_cancel_thread.
4267         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4268         parameter.
4269
4270 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4271
4272         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4273         only after checking if it cannot be forced local.
4274         * symtab.h (is_externally_visible): Check if the symbol is not forced
4275         local.
4276
4277 2011-07-15  Ian Lance Taylor  <iant@google.com>
4278
4279         * options.h (class General_options): Add --print-output-format.
4280         Move -EL next to -EB, for  better --help output.
4281         * target-select.cc: Include <cstdio>, "options.h", and
4282         "parameters.h".
4283         (Target_selector::do_target_bfd_name): New function.
4284         (print_output_format): New function.
4285         * target-select.h (class Target_selector): Update declarations.
4286         (Target_selector::target_bfd_name): New function.
4287         (print_output_format): Declare.
4288         * main.cc: Include "target-select.h".
4289         (main): Handle --print-output-format.
4290         * gold.cc: Include "target-select.h".
4291         (queue_initial_tasks): Handle --print-output-format when there are
4292         no input files.
4293         * parameters.cc (parameters_force_valid_target): Give a better
4294         error message if -EB/-EL does not match target.
4295         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4296         function.
4297
4298 2011-07-15  Ian Lance Taylor  <iant@google.com>
4299
4300         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4301         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4302         (Output_data_plt_i386::do_write): Write address of .dynamic
4303         section to first entry in .got.plt section.
4304         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4305         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4306         Initialize layout_.
4307         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4308         section to first entry in .got.plt section.
4309         * layout.h (Layout::dynamic_section): New function.
4310
4311 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4312
4313         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4314         to claim_file call.
4315         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4316         input_section_position_, and input_section_glob_.
4317         (read_layout_from_file): Call function section_ordering_specified.
4318         * layout.h (is_section_ordering_specified): New function.
4319         (section_ordering_specified): New function.
4320         (section_ordering_specified_): New boolean member.
4321         * main.cc(main): Call load_plugins after layout object is defined.
4322         * output.cc (Output_section::add_input_section): Use
4323         function section_ordering_specified to check if section ordering is
4324         needed.
4325         * output.cc (Output_section::add_relaxed_input_section): Use
4326         function section_ordering_specified to check if section ordering is
4327         needed.
4328         (Output_section::update_section_layout): New function.
4329         (Output_section::sort_attached_input_sections): Check if input section
4330         must be reordered.
4331         * output.h (Output_section::update_section_layout): New function.
4332         * plugin.cc (get_section_count): New function.
4333         (get_section_type): New function.
4334         (get_section_name): New function.
4335         (get_section_contents): New function.
4336         (update_section_order): New function.
4337         (allow_section_ordering): New function.
4338         (Plugin::load): Add the new interfaces to the transfer vector.
4339         (Plugin_manager::load_plugins): New parameter.
4340         (Plugin_manager::all_symbols_read): New parameter.
4341         (Plugin_manager::claim_file): New parameter. Save the elf object for
4342         unclaimed objects.
4343         (Plugin_manager::get_elf_object): New function.
4344         (Plugin_manager::get_view): Change to directly use the bool to check
4345         if get_view is called from claim_file_hook.
4346         * plugin.h (input_objects): New function
4347         (Plugin__manager::load_plugins): New parameter.
4348         (Plugin_manager::claim_file): New parameter.
4349         (Plugin_manager::get_elf_object): New function.
4350         (Plugin_manager::in_claim_file_handler): New function.
4351         (Plugin_manager::in_claim_file_handler_): New member.
4352         (layout): New function.
4353         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4354         handler with an extra parameter. Make the elf object before calling
4355         claim_file handler.
4356         * testsuite/plugin_test.c (get_section_count): New function pointer.
4357         (get_section_type): New function pointer.
4358         (get_section_name): New function pointer.
4359         (get_section_contents): New function pointer.
4360         (update_section_order): New function pointer.
4361         (allow_section_ordering): New function pointer.
4362         (onload): Check if the new interfaces exist.
4363
4364 2011-07-13  Ian Lance Taylor  <iant@google.com>
4365
4366         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4367         relro section.
4368         * x86_64.cc (Target_x86_64::got_section): Likewise.
4369         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4370         (relro_now_test_SOURCES): New variable.
4371         (relro_now_test_DEPENDENCIES): New variable.
4372         (relro_now_test_LDFLAGS): New variable.
4373         (relro_now_test_LDADD): New variable.
4374         (relro_now_test.so): New target.
4375         * testsuite/Makefile.in: Rebuild.
4376
4377 2011-07-12  Ian Lance Taylor  <iant@google.com>
4378
4379         PR gold/12980
4380         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4381         GLOB_DAT relocation rather than a RELATIVE relocation for a
4382         protected symbol when creating a shared library.
4383         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4384         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4385         * testsuite/protected_main_1.cc (main): Test that protected
4386         function has same address.
4387
4388 2011-07-11  Ian Lance Taylor  <iant@google.com>
4389
4390         PR gold/12979
4391         * options.h (class General_options): Add -Bgroup.
4392         * options.cc (General_options::finalize): If -Bgroup is set,
4393         default to --unresolved-symbols=report-all.
4394         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4395         * target-reloc.h (issue_undefined_symbol_error): Handle
4396         --unresolved-symbols=report-all.
4397
4398 2011-07-08  Ian Lance Taylor  <iant@google.com>
4399
4400         PR gold/11985
4401         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4402         if linker script discards key sections.
4403         (Layout::create_dynamic_symtab): Likewise.
4404         (Layout::assign_local_dynsym_offsets): Likewise.
4405         (Layout::sized_create_version_sections): Likewise.
4406         (Layout::create_interp): Likewise.
4407         (Layout::finish_dynamic_section): Likewise.
4408         (Layout::set_dynamic_symbol_size): Likewise.
4409
4410 2011-07-08  Ian Lance Taylor  <iant@google.com>
4411
4412         PR gold/12386
4413         * options.h (class General_options): Add --unresolved-symbols.
4414         * target-reloc.h (issue_undefined_symbol_error): Check
4415         --unresolved-symbols.  Add comments.
4416
4417 2011-07-08  Ian Lance Taylor  <iant@google.com>
4418
4419         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4420         expression more complex.
4421
4422 2011-07-08  Ian Lance Taylor  <iant@google.com>
4423
4424         PR gold/11317
4425         * target-reloc.h (issue_undefined_symbol_error): New inline
4426         function, broken out of relocate_section.
4427         (relocate_section): Call issue_undefined_symbol_error.
4428         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4429         there is no TLS segment if we are about to issue an undefined
4430         symbol error.
4431         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4432
4433 2011-07-08  Ian Lance Taylor  <iant@google.com>
4434
4435         PR gold/12279
4436         * resolve.cc (Symbol_table::should_override): Add fromtype
4437         parameter.  Change all callers.  Give error when linking together
4438         TLS and non-TLS symbol.
4439         (Symbol_table::should_override_with_special): Add fromtype
4440         parameter.  Change all callers.
4441         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4442         there is no TLS segment if we have reported some errors.
4443         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4444
4445 2011-07-08  Ian Lance Taylor  <iant@google.com>
4446
4447         PR gold/12372
4448         * target.h (Target::plt_address_for_global): New function.
4449         (Target::plt_address_for_local): New function.
4450         (Target::plt_section_for_global): Remove.
4451         (Target::plt_section_for_local): Remove.
4452         (Target::do_plt_address_for_global): New virtual function.
4453         (Target::do_plt_address_for_local): New virtual function.
4454         (Target::do_plt_section_for_global): Remove.
4455         (Target::do_plt_section_for_local): Remove.
4456         (Target::register_global_plt_entry): Add Symbol_table and Layout
4457         parameters.
4458         * output.cc (Output_data_got::Got_entry::write): Use
4459         plt_address_for_global and plt_address_for_local.
4460         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4461         address of output section.
4462         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4463         got_irelative_, and irelative_count_ fields.  Update
4464         declarations.
4465         (Output_data_plt_i386::has_irelative_section): New function.
4466         (Output_data_plt_i386::entry_count): Add irelative_count_.
4467         (Output_data_plt_i386::set_final_data_size): Likewise.
4468         (class Target_i386): Add got_irelative_ and rel_irelative_
4469         fields.  Update declarations.
4470         (Target_i386::Target_i386): Initialize new fields.
4471         (Target_i386::do_plt_address_for_global): New function replacing
4472         do_plt_section_for_global.
4473         (Target_i386::do_plt_address_for_local): New function replacing
4474         do_plt_section_for_local.
4475         (Target_i386::got_section): Create got_irelative_.
4476         (Target_i386::rel_irelative_section): New function.
4477         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4478         fields.  Don't define __rel_iplt_{start,end}.
4479         (Output_data_plt_i386::add_entry): Add symtab and layout
4480         parameters.  Change all callers.  Use different PLT and GOT for
4481         IFUNC symbols.
4482         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4483         layout parameters.  Change all callers.  Use different PLT and
4484         GOT.
4485         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4486         (Output_data_plt_i386::rel_irelative): New function.
4487         (Output_data_plt_i386::address_for_global): New function.
4488         (Output_data_plt_i386::address_for_local): New function.
4489         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4490         IRELATIVE GOT when changing IFUNC GOT entries.
4491         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4492         reloc.
4493         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4494         if we didn't create an IRELATIVE GOT.
4495         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4496         plt_address_for_local.
4497         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4498         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4499         got_irelative_, and irelative_count_ fields.  Update
4500         declarations.
4501         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4502         Initialize new fields.  Remove symtab parameter.  Change all
4503         callers.
4504         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4505         irelative_count_.
4506         (Output_data_plt_x86_64::has_irelative_section): New function.
4507         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4508         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4509         fields.  Update declarations.
4510         (Target_x86_64::Target_x86_64): Initialize new fields.
4511         (Target_x86_64::do_plt_address_for_global): New function replacing
4512         do_plt_section_for_global.
4513         (Target_x86_64::do_plt_address_for_local): New function replacing
4514         do_plt_section_for_local.
4515         (Target_x86_64::got_section): Create got_irelative_.
4516         (Target_x86_64::rela_irelative_section): New function.
4517         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4518         all callers.  Don't create __rel_iplt_{start,end}.
4519         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4520         parameters.  Change all callers.  Use different PLT and GOT for
4521         IFUNC symbols.
4522         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4523         layout parameters.  Change all callers.  Use different PLT and
4524         GOT.
4525         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4526         parameters.  Change all callers.  Use different PLT and GOT for
4527         IFUNC symbols.
4528         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4529         (Output_data_plt_x86_64::rela_irelative): New function.
4530         (Output_data_plt_x86_64::address_for_global): New function.
4531         (Output_data_plt_x86_64::address_for_local): New function.
4532         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4533         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4534         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4535         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4536         parameters.
4537         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4538         reloc.
4539         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4540         symbols if we didn't create an IRELATIVE GOT.
4541         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4542         plt_address_for_local.
4543         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4544         * testsuite/ifuncvar1.c: New test file.
4545         * testsuite/ifuncvar2.c: New test file.
4546         * testsuite/ifuncvar3.c: New test file.
4547         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4548         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4549         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4550         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4551         * testsuite/Makefile.in: Rebuild.
4552
4553 2011-07-07  Cary Coutant  <ccoutant@google.com>
4554
4555         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4556         (two_file_test_1_ndebug.o): Likewise.
4557         (two_file_test_1b_ndebug.o): Likewise.
4558         (two_file_test_2_ndebug.o): Likewise.
4559         (two_file_test_main_ndebug.o): Likewise.
4560         (incremental_test_2): Link with no-debug versions.
4561
4562 2011-07-06  Cary Coutant  <ccoutant@google.com>
4563
4564         * gold/incremental.cc
4565         (Output_section_incremental_inputs::write_info_blocks): Check for
4566         hidden and internal symbols.
4567
4568 2011-07-06  Cary Coutant  <ccoutant@google.com>
4569
4570         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4571         Check disposition for startup file.
4572         (Incremental_inputs::report_command_line): Ignore
4573         --incremental-startup-unchanged option.
4574         * options.cc (General_options::parse_incremental_startup_unchanged):
4575         New function.
4576         (General_options::General_options): Initialize new data member.
4577         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4578         (General_options): Add --incremental-startup-unchanged option.
4579         (General_options::incremental_startup_disposition): New function.
4580         (General_options::incremental_startup_disposition_): New data member.
4581
4582 2011-07-06  Cary Coutant  <ccoutant@google.com>
4583
4584         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4585         input file index to Script_info ctor.
4586         (Sized_incremental_binary::do_file_has_changed): Find the
4587         command-line argument for files named in scripts.
4588         * incremental.h (Script_info::Script_info): New ctor
4589         with input file index.
4590         (Script_info::input_file_index): New function.
4591         (Script_info::input_file_index_): New data member.
4592         (Incremental_binary::get_library): Add const.
4593         (Incremental_binary::get_script_info): Add const.
4594         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4595         * testsuite/Makefile.am (incremental_test_5): New test case.
4596         (incremental_test_6): New test case.
4597         * testsuite/Makefile.in: Regenerate.
4598
4599 2011-07-06  Cary Coutant  <ccoutant@google.com>
4600
4601         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4602         debug output when command lines differ.
4603
4604 2011-07-06  Cary Coutant  <ccoutant@google.com>
4605
4606         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4607         --incremental-patch option.
4608         * layout.cc (Free_list::allocate): Extend allocation beyond original
4609         end if enabled.
4610         (Layout::make_output_section): Mark sections that should get
4611         patch space.
4612         * options.cc (parse_percent): New function.
4613         * options.h (parse_percent): New function.
4614         (DEFINE_percent): New macro.
4615         (General_options): Add --incremental-patch option.
4616         * output.cc (Output_section::Output_section): Initialize new data
4617         members.
4618         (Output_section::add_input_section): Print section name when out
4619         of patch space.
4620         (Output_section::add_output_section_data): Likewise.
4621         (Output_section::set_final_data_size): Add patch space when
4622         doing --incremental-full.
4623         (Output_section::do_reset_address_and_file_offset): Remove patch
4624         space.
4625         (Output_segment::set_section_list_addresses): Print debug output
4626         only if --incremental-update.
4627         * output.h (Output_section::set_is_patch_space_allowed): New function.
4628         (Output_section::is_patch_space_allowed_): New data member.
4629         (Output_section::patch_space_): New data member.
4630         * parameters.cc (Parameters::incremental_full): New function.
4631         * parameters.h (Parameters::incremental_full): New function
4632         * testsuite/Makefile.am (incremental_test_2): Add test for
4633         --incremental-patch option.
4634         * testsuite/Makefile.in: Regenerate.
4635         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4636         (t18): Remove function body.
4637
4638 2011-07-05  Doug Kwan  <dougkwan@google.com>
4639
4640         PR gold/12771
4641         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4642         Arm_Address type for relocation result.
4643         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4644         overflow check.
4645         (Arm_relocate_functions::abs32): Use unaligned access.
4646         (Arm_relocate_functions::rel32): Ditto.
4647         (Arm_relocate_functions::prel31): Ditto.
4648         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4649         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4650         static data relocations.
4651         * testsuite/Makefile.in: Regnerate.
4652         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4653
4654 2011-07-05  Ian Lance Taylor  <iant@google.com>
4655
4656         PR gold/12392
4657         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4658         symbols if necessary.
4659         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4660
4661 2011-07-05  Ian Lance Taylor  <iant@google.com>
4662
4663         PR gold/12952
4664         * resolve.cc (Symbol::override_base_with_special): Simply override
4665         version with special symbol version, ignoring previous version.
4666
4667 2011-07-05  Ian Lance Taylor  <iant@google.com>
4668
4669         * object.cc (Sized_relobj_file::include_section_group): Add
4670         information to comment about signature location.
4671
4672 2011-07-02  Ian Lance Taylor  <iant@google.com>
4673
4674         PR gold/12957
4675         * options.h (class General_options): Add -f and -F.
4676         * options.cc (General_options::finalize): Fatal error if -f/-F
4677         are used without -shared.
4678         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4679
4680 2011-07-02  Ian Lance Taylor  <iant@google.com>
4681
4682         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4683
4684 2011-07-01  Ian Lance Taylor  <iant@google.com>
4685
4686         PR gold/12525
4687         PR gold/12952
4688         * resolve.cc (Symbol::override_base_with_special): Don't override
4689         the version if the overriding symbol has a different name.
4690         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4691         all callers.  If we give an error about an undefined version,
4692         define the base version if necessary.
4693         * dynobj.h (class Versions): Update declaration.
4694         * testsuite/weak_alias_test_5.cc: New file.
4695         * testsuite/weak_alias_test.script: New file.
4696         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4697         and versioned_alias have the right value, and call t2.
4698         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4699         weak_alias_test_5.so.
4700         (weak_alias_test_LDADD): Likewise.
4701         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4702         * testsuite/Makefile.in: Rebuild.
4703
4704 2011-07-01  Ian Lance Taylor  <iant@google.com>
4705
4706         PR gold/12525
4707         * options.h (class General_options): Support -z notext.
4708         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4709         -Wl,-z,notext.
4710         (two_file_shared_nonpic.so): Likewise.
4711         (two_file_shared_mixed.so): Likewise.
4712         (two_file_shared_mixed_1.so): Likewise.
4713         (weak_undef_lib_nonpic.so): Likewise.
4714         (alt/weak_undef_lib_nonpic.so): Likewise.
4715         (tls_test_shared_nonpic.so): Likewise.
4716         * testsuite/Makefile.in: Rebuild.
4717
4718 2011-07-01  Ian Lance Taylor  <iant@google.com>
4719
4720         PR gold/12525
4721         * configure.ac: Test whether static linking works, setting
4722         the automake conditional HAVE_STATIC.
4723         * testsuite/Makefile.am: Disable tests using -static if
4724         HAVE_STATIC is not true.
4725         * configure, testsuite/Makefile.in: Rebuild.
4726
4727 2011-07-01  Ian Lance Taylor  <iant@google.com>
4728
4729         PR gold/12525
4730         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4731         Assert if we see DW_EH_PE_indirect.
4732         * target.h (Target::ehframe_datarel_base): New function.
4733         (Target::do_ehframe_datarel_base): New target function.
4734         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4735         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4736         function.
4737
4738 2011-07-01  Ian Lance Taylor  <iant@google.com>
4739
4740         PR gold/12571
4741         * options.h (class General_options): Add
4742         --ld-generated-unwind-info.
4743         * ehframe.cc (Fde::write): Add address parameter.  Change all
4744         callers.  If associated with PLT, fill in address and size.
4745         (Cie::set_output_offset): Only add merge mapping if there is an
4746         object.
4747         (Cie::write): Add address parameter.  Change all callers.
4748         (Eh_frame::add_ehframe_for_plt): New function.
4749         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4750         input_offset_ fields into union u_, with new plt field.
4751         (Fde::Fde): Adjust for new union field.
4752         (Fde::Fde) [Output_data version]: New constructor.
4753         (Fde::add_mapping): Only add merge mapping if there is an object.
4754         (class Cie): Update declarations.
4755         (class Eh_frame): Declare add_ehframe_for_plt.
4756         * layout.cc (Layout::layout_eh_frame): Break out code into
4757         make_eh_frame_section, and call it.
4758         (Layout::make_eh_frame_section): New function.
4759         (Layout::add_eh_frame_for_plt): New function.
4760         * layout.h (class Layout): Update declarations.
4761         * merge.cc (Merge_map::add_mapping): Add assertion.
4762         * i386.cc: Include "dwarf.h".
4763         (class Output_data_plt_i386): Make first_plt_entry,
4764         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4765         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4766         and plt_eh_frame_fde.
4767         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4768         boundary.  Call add_eh_frame_for_plt if appropriate.
4769         * x86_64.cc: Include "dwarf.h".
4770         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4771         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4772         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4773         and plt_eh_frame_fde.
4774         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4775         appropriate.
4776
4777 2011-06-29  Ian Lance Taylor  <iant@google.com>
4778
4779         PR gold/12629
4780         * object.cc (Sized_relobj_file::layout_section): Change shdr
4781         parameter to be const.
4782         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4783         out of do_layout.
4784         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4785         appropriate.  Call layout_eh_frame_section.
4786         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4787         sections.
4788         * object.h (class Sized_relobj_file): Update declarations.
4789
4790 2011-06-29  Ian Lance Taylor  <iant@google.com>
4791
4792         PR gold/12652
4793         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4794         modifier.
4795         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4796
4797 2011-06-29  Ian Lance Taylor  <iant@google.com>
4798
4799         PR gold/12675
4800         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4801         SHT_X86_64_UNWIND.
4802         * layout.cc (Layout::layout_eh_frame): Likewise.
4803
4804 2011-06-29  Ian Lance Taylor  <iant@google.com>
4805
4806         PR gold/12695
4807         * layout.cc (Layout::symtab_section_shndx): New function.
4808         * layout.h (class Layout): Declare symtab_section_shndx.
4809         * output.cc (Output_section::write_header): Call it.
4810
4811 2011-06-29  Ian Lance Taylor  <iant@google.com>
4812
4813         PR gold/12818
4814         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4815         symbols which are not used in a relocation.
4816
4817 2011-06-28  Ian Lance Taylor  <iant@google.com>
4818
4819         PR gold/12898
4820         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4821         script create indistinguishable segments.
4822         (Layout::set_segment_offsets): Use stable_sort when sorting
4823         segments.  Pass this to Compare_segments constructor.
4824         * layout.h (class Layout): Make segment_precedes non-static.
4825         (class Compare_segments): Change from struct to class.  Add
4826         layout_ field.  Add constructor.
4827         * script-sections.cc
4828         (Script_sections::attach_sections_using_phdrs_clause): Rename
4829         local orphan to is_orphan.  Don't report failure to put empty
4830         section in segment.  On attachment failure, report name of
4831         section, and attach to first PT_LOAD segment.
4832
4833 2011-06-28  Ian Lance Taylor  <iant@google.com>
4834
4835         PR gold/12934
4836         * target-select.cc (Target_selector::Target_selector): Add
4837         emulation parameter.  Change all callers.
4838         (select_target_by_bfd_name): Rename from select_target_by_name.
4839         Change all callers.
4840         (select_target_by_emulation): New function.
4841         (supported_emulation_names): New function.
4842         * target-select.h (class Target_selector): Add emulation_ field.
4843         Update declarations.
4844         (Target_selector::recognize_by_bfd_name): Rename from
4845         recognize_by_name.  Change all callers.
4846         (Target_selector::supported_bfd_names): Rename from
4847         supported_names.  Change all callers.
4848         (Target_selector::recognize_by_emulation): New function.
4849         (Target_selector::supported_emulations): New function.
4850         (Target_selector::emulation): New function.
4851         (Target_selector::do_recognize_by_bfd_name): Rename from
4852         do_recognize_by_name.  Change all callers.
4853         (Target_selector::do_supported_bfd_names): Rename from
4854         do_supported_names.  Change all callers.
4855         (Target_selector::do_recognize_by_emulation): New function.
4856         (Target_selector::do_supported_emulations): New function.
4857         (select_target_by_bfd_name): Change name in declaration.
4858         (select_target_by_emulation): Declare.
4859         (supported_emulation_names): Declare.
4860         * parameters.cc (parameters_force_valid_target): Try to find
4861         target based on emulation from -m option.
4862         * options.h (class General_options): Change doc string for -m.
4863         * options.cc (help): Print emulations.
4864         (General_options::parse_V): Likewise.
4865         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4866         Add emulation parameter.  Change all callers.
4867
4868 2011-06-28  Ian Lance Taylor  <iant@google.com>
4869
4870         * target.h (class Target): Add osabi_ field.
4871         (Target::osabi): New function.
4872         (Target::set_osabi): New function.
4873         (Target::Target): Initialize osabi_.
4874         (Target::do_adjust_elf_header): Make pure virtual.
4875         (Sized_target::do_adjust_elf_header): Declare.
4876         * target.cc (Sized_target::do_adjust_elf_header): New function.
4877         (class Sized_target): Instantiate all versions.
4878         * freebsd.h (class Target_freebsd): Remove.
4879         (Target_selector_freebsd::do_recognize): Call set_osabi on
4880         Target.
4881         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4882         (Target_selector_freebsd::set_osabi): Remove.
4883         * i386.cc (class Target_i386): Inherit from Sized_target rather
4884         than Target_freebsd.
4885         * x86_64.cc (class Target_x86_64): Likewise.
4886
4887 2011-06-28  Ian Lance Taylor  <iant@google.com>
4888
4889         * target.h (Target::can_check_for_function_pointers): Rewrite.
4890         Make non-virtual.
4891         (Target::can_icf_inline_merge_sections): Likewise.
4892         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4893         (Target::Target_info): Add can_icf_inline_merge_sections field.
4894         (Target::do_can_check_for_function_pointers): New virtual
4895         function.
4896         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4897         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4898         from can_check_for_function_pointers, move in file.
4899         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4900         section_may_have_icf_unsafe_poineters, move in file.
4901         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4902         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4903         Rename from can_check_for_function_pointers, move in file.
4904         (Target_i386::can_icf_inline_merge_sections): Remove.
4905         (Target_i386::i386_info): Initialize
4906         can_icf_inline_merge_sections.
4907         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4908         Initialize can_icf_inline_merge_sections.
4909         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4910         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4911         Rename from can_check_for_function_pointers, move in file.
4912         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4913         (Target_x86_64::x86_64_info): Initialize
4914         can_icf_inline_merge_sections.
4915         * testsuite/testfile.cc (Target_test::test_target_info):
4916         Likewise.
4917         * icf.cc (get_section_contents): Correct formatting.
4918
4919 2011-06-27  Ian Lance Taylor  <iant@google.com>
4920
4921         * symtab.cc (Symbol::versioned_name): New function.
4922         (Symbol_table::add_to_final_symtab): Use versioned_name when
4923         appropriate.
4924         (Symbol_table::sized_write_symbol): Likewise.
4925         * symtab.h (class Symbol): Declare versioned_name.
4926         * stringpool.h (class Stringpool_template): Add variant of add
4927         which takes a std::basic_string.
4928         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4929         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4930         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4931         (ver_test_12.o): New target.
4932         * testsuite/Makefile.in: Rebuild.
4933
4934 2011-06-27  Doug Kwan  <dougkwan@google.com>
4935
4936         * arm.cc (Arm_relocate_functions::thm_jump8,
4937         Arm_relocate_functions::thm_jump11): Use a wider signed
4938         type to compute offset.
4939         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4940         arm_thm_jump8.
4941         * testsuite/Makefile.in: Regenerate.
4942         * testsuite/arm_branch_in_range.sh: Check test results of
4943         arm_thm_jump11 and arm_thm_jump8.
4944         * testsuite/arm_thm_jump11.s: New test source file.
4945         * testsuite/arm_thm_jump11.t: New linker script.
4946         * testsuite/arm_thm_jump8.s: New test source file.
4947         * testsuite/arm_thm_jump8.t: New linker script.
4948
4949 2011-06-24  Ian Lance Taylor  <iant@google.com>
4950
4951         * layout.cc: Include "object.h".
4952         (ctors_sections_in_init_array): New static variable.
4953         (Layout::is_ctors_in_init_array): New function.
4954         (Layout::layout): Add entry to ctors_sections_in_init_array if
4955         appropriate.
4956         * layout.h (class Layout): Declare is_ctors_in_init_array.
4957         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4958         is_ctors_reverse_view is set.
4959         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4960         all callers.  Set is_ctors_reverse_view field of View_size.
4961         (Sized_relobj_file::reverse_words): New function.
4962         * object.h (Sized_relobj_file::View_size): Add
4963         is_ctors_reverse_view field.
4964         (class Sized_relobj_file): Update declarations.
4965         * testsuite/initpri3.c: New test.
4966         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4967         initpri3b.
4968         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4969         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4970         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4971         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4972         * testsuite/Makefile.in: Rebuild.
4973
4974 2011-06-24  Cary Coutant  <ccoutant@google.com>
4975
4976         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4977         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4978         (debug_msg_cdebug.err): New targets.
4979         * testsuite/Makefile.in: Regenerate.
4980         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4981         Fix checks for link with shared library.
4982
4983 2011-06-24  Doug Kwan  <dougkwan@google.com>
4984
4985         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4986         skip empty text sections.
4987         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4988
4989 2011-06-22  Ian Lance Taylor  <iant@google.com>
4990
4991         PR gold/12910
4992         * options.h (class General_options): Add --ctors-in-init-array.
4993         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4994         friends as SHT_PROGBITS for merging sections.
4995         (Layout::layout): Remove special handling of .init_array and
4996         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4997         and .dtors if ctors_in_init_array.
4998         (Layout::make_output_section): Force correct section types for
4999         .init_array and friends.  Don't sort if doing relocatable link,
5000         Don't sort .ctors and .dtors if ctors_in_init_array.
5001         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5002         (Layout::output_section_name): Add relobj parameter.  Change all
5003         callers.  Handle .ctors. and .dtors. in code rather than table.
5004         Handle .ctors and .dtors if ctors_in_init_array.
5005         (Layout::match_file_name): New function, moved from output.cc.
5006         * layout.h (class Layout): Update declarations.
5007         * output.cc: Include "layout.h".
5008         (Input_section_sort_entry::get_priority): New function.
5009         (Input_section_sort_entry::match_file_name): Just call
5010         Layout::match_file_name.
5011         (Output_section::Input_section_sort_init_fini_compare::operator()):
5012         Handle .ctors and .dtors.  Sort by explicit priority rather than
5013         by name.
5014         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5015         * testsuite/initpri2.c: New test.
5016         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5017         (check_PROGRAMS): Add initpri2.
5018         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5019         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5020         * configure, testsuite/Makefile.in: Rebuild.
5021
5022 2011-06-19  Ian Lance Taylor  <iant@google.com>
5023
5024         PR gold/12880
5025         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5026         .interp section to a PT_INTERP segment even if we have seen a
5027         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5028         clause in a linker script.
5029         (Layout::finalize): Don't create a .interp section if we've
5030         already create a PT_INTERP segment.
5031         (Layout::create_interp): Always call choose_output_section (revert
5032         patch of 2011-06-17).  Don't create PT_INTERP segment.
5033         * script-sections.cc
5034         (Script_sections::create_note_and_tls_segments): Add a .interp
5035         section to a PT_INTERP segment even if we have seen a
5036         --dynamic-linker option.
5037
5038 2011-06-18  Ian Lance Taylor  <iant@google.com>
5039
5040         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5041         merely because a non-PT_LOAD segment has a dynamic reloc.
5042
5043 2011-06-18  Ian Lance Taylor  <iant@google.com>
5044
5045         * layout.cc (Layout::finish_dynamic_section): Don't create
5046         DT_FLAGS entry if not needed.
5047
5048 2011-06-18  Ian Lance Taylor  <iant@google.com>
5049
5050         PR gold/12745
5051         * layout.cc (Layout::layout_eh_frame): Correct handling of
5052         writable .eh_frame section.
5053
5054 2011-06-17  Ian Lance Taylor  <iant@google.com>
5055
5056         PR gold/12893
5057         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5058         symbol is redefined with the exact same object and value.
5059
5060 2011-06-17  Ian Lance Taylor  <iant@google.com>
5061
5062         PR gold/12880
5063         * layout.h (class Layout): Add interp_segment_ field.
5064         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5065         (Layout::attach_allocated_section_to_segment): If making shared
5066         library, put .interp section in PT_INTERP segment.
5067         (Layout::finalize): Also call create_interp if -dynamic-linker
5068         option was used.
5069         (Layout::create_interp): Assert that there is no PT_INTERP
5070         segment.  If not using a SECTIONS clause, use make_output_section.
5071         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5072         * script-sections.cc
5073         (Script_sections::create_note_and_tls_segments): If making shared
5074         library, put .interp section in PT_INTERP segment.
5075
5076 2011-06-17  Ian Lance Taylor  <iant@google.com>
5077
5078         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5079         when making a shared library.
5080
5081 2011-06-17  Ian Lance Taylor  <iant@google.com>
5082
5083         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5084         parameter.  Change all callers.  Don't issue warning about PC32
5085         against locally defined symbol.
5086
5087 2011-06-16  Ian Lance Taylor  <iant@google.com>
5088
5089         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5090         occurs in same object.
5091
5092 2011-06-14  Alan Modra  <amodra@gmail.com>
5093
5094         * po/POTFILES.in: Regenerate.
5095
5096 2011-06-09  Ian Lance Taylor  <iant@google.com>
5097
5098         * script-sections.cc
5099         (Orphan_output_section::set_section_addresses): For a relocatable
5100         link set address to 0.
5101
5102 2011-06-09  Cary Coutant  <ccoutant@google.com>
5103
5104         PR gold/12804
5105         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5106         used with --compress-debug-sections.
5107         * gold/object.cc (Sized_relobj_file::do_layout): Report
5108         uncompressed size of compressed input sections.
5109
5110 2011-06-08  Cary Coutant  <ccoutant@google.com>
5111
5112         PR gold/12804
5113         * testsuite/two_file_test_2_v1.cc: Change initialization of
5114         v2 to keep it in .data.
5115
5116 2011-06-07  Cary Coutant  <ccoutant@google.com>
5117
5118         * common.cc (Symbol_table::do_allocate_commons_list): Call
5119         gold_fallback.
5120         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5121         (Errors::fallback): New function.
5122         (gold_fallback): New function.
5123         * errors.h (Errors::fallback): New function.
5124         * gold.cc (gold_exit): Change status parameter to enum; adjust
5125         all callers.
5126         (queue_initial_tasks): Call gold_fallback.
5127         * gold.h: Include cstdlib.
5128         (Exit_status): New enum type.
5129         (gold_exit): Change status parameter to enum.
5130         (gold_fallback): New function.
5131         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5132         (Layout::create_symtab_sections): Likewise.
5133         (Layout::create_shdrs): Likewise.
5134         * main.cc (main): Adjust call to gold_exit.
5135         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5136         (Output_data_got::add_got_entry_pair): Likewise.
5137         (Output_section::add_input_section): Likewise.
5138         (Output_section::add_output_section_data): Likewise.
5139         (Output_segment::set_section_list_addresses): Likewise.
5140         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5141
5142 2011-06-07  Cary Coutant  <ccoutant@google.com>
5143
5144         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5145         for incremental links.
5146         * output.cc (Output_segment::set_section_list_addresses): Remove
5147         FIXME and test for TLS or BSS.
5148
5149 2011-06-07  Cary Coutant  <ccoutant@google.com>
5150
5151         * testsuite/Makefile.am: Add incremental_copy_test,
5152         incremental_common_test_1.
5153         * testsuite/Makefile.in: Regenerate.
5154         * testsuite/common_test_1_v1.c: New source file.
5155         * testsuite/common_test_1_v2.c: New source file.
5156         * testsuite/copy_test_v1.cc: New source file.
5157
5158 2011-06-07  Cary Coutant  <ccoutant@google.com>
5159
5160         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5161         update, allocate common from bss section's free list.
5162         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5163         linker-defined symbols.
5164         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5165         Skip GOT and PLT entries that are no longer referenced.
5166         (Output_section_incremental_inputs::write_info_blocks): Mark
5167         linker-defined symbols.
5168         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5169         * output.cc (Output_section::allocate): New function.
5170         * output.h (Output_section::allocate): New function.
5171         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5172         linker-defined symbols.
5173         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5174         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5175         (Symbol::init_base_output_data): Likewise.
5176         (Symbol::init_base_output_segment): Likewise.
5177         (Symbol::init_base_constant): Likewise.
5178         (Sized_symbol::init_output_data): Likewise.
5179         (Sized_symbol::init_output_segment): Likewise.
5180         (Sized_symbol::init_constant): Likewise.
5181         (Symbol_table::do_define_in_output_data): Likewise.
5182         (Symbol_table::do_define_in_output_segment): Likewise.
5183         (Symbol_table::do_define_as_constant): Likewise.
5184         * symtab.h (Symbol::is_predefined): New function.
5185         (Symbol::init_base_output_data): Add is_predefined parameter.
5186         (Symbol::init_base_output_segment): Likewise.
5187         (Symbol::init_base_constant): Likewise.
5188         (Symbol::is_predefined_): New data member.
5189         (Sized_symbol::init_output_data): Add is_predefined parameter.
5190         (Sized_symbol::init_output_segment): Likewise.
5191         (Sized_symbol::init_constant): Likewise.
5192         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5193
5194 2011-06-07  Cary Coutant  <ccoutant@google.com>
5195
5196         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5197         instead of emit_copy_reloc.
5198         (Copy_relocs::emit_copy_reloc): Refactor.
5199         (Copy_relocs::make_copy_reloc): New function.
5200         (Copy_relocs::add_copy_reloc): Remove.
5201         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5202         section.
5203         (Copy_relocs::make_copy_reloc): New function.
5204         (Copy_relocs::add_copy_reloc): Remove.
5205         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5206         unchanged input files.
5207         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5208         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5209         Reserve BSS space for COPY relocations.
5210         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5211         (Output_section_incremental_inputs::write_info_blocks): Record
5212         whether a symbol is copied from a shared object.
5213         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5214         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5215         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5216         (Incremental_input_entry_reader::get_output_symbol_index): Add
5217         is_copy parameter.
5218         (Incremental_binary::emit_copy_relocs): New function.
5219         (Incremental_binary::do_emit_copy_relocs): New function.
5220         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5221         new data member.
5222         (Sized_incremental_binary::add_copy_reloc): New function.
5223         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5224         (Sized_incremental_binary::Copy_reloc): New struct.
5225         (Sized_incremental_binary::Copy_relocs): New typedef.
5226         (Sized_incremental_binary::copy_relocs_): New data member.
5227         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5228         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5229         * target.h (Sized_target::emit_copy_reloc): New function.
5230         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5231
5232 2011-06-02  Cary Coutant  <ccoutant@google.com>
5233
5234         PR gold/12163
5235         * gold/archive.cc (Archive::Archive): Initialize new data member.
5236         (Archive::include_all_members): Return if archive has already been
5237         included.
5238         * gold/archive.h (Archive::include_all_members_): New data member.
5239
5240 2011-06-02  Nick Clifton  <nickc@redhat.com>
5241
5242         * dynobj.h: Fix spelling mistake in comment.
5243         * output.cc: Likewise.
5244
5245 2011-05-31  Doug Kwan  <dougkwan@google.com>
5246             Asier Llano
5247
5248         PR gold/12826
5249         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5250         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5251         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5252         redundant arm_exidx_test.so.
5253         * testsuite/Makefile.in: Regenerate.
5254         (check_SCRIPTS): Add pr12826.sh
5255         (check_DATA): Add pr12826.stdout
5256         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5257         * testsuite/pr12826.sh: New file.
5258         * testsuite/pr12826_1.s: Ditto.
5259         * testsuite/pr12826_1.s: Ditto.
5260
5261 2011-05-30  Ian Lance Taylor  <iant@google.com>
5262
5263         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5264         sections.
5265
5266 2011-05-29  Ian Lance Taylor  <iant@google.com>
5267
5268         PR gold/12804
5269         * testsuite/Makefile.am: Use different file name for two_file_test
5270         temporary file for each incremental test.
5271         * testsuite/Makefile.in: Rebuild.
5272
5273 2011-05-29  Ian Lance Taylor  <iant@google.com>
5274
5275         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5276         binary input file is empty.
5277
5278 2011-05-27  Ian Lance Taylor  <iant@google.com>
5279
5280         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5281         (ver_test_9.so): Likewise.
5282         * testsuite/Makefile.in: Rebuild.
5283
5284 2011-05-26 Cary Coutant  <ccoutant@google.com>
5285
5286         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5287         * incremental.cc (Incremental_inputs::report_input_section): Fix
5288         comment, indentation.
5289         (Incremental_inputs::report_comdat_group): New function.
5290         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5291         of data for incremental input file entry.
5292         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5293         group count, COMDAT group signatures.
5294         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5295         an unchanged input file.
5296         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5297         Initialize new data member.
5298         (Incremental_object_entry::add_comdat_group): New function.
5299         (Incremental_object_entry::get_comdat_group_count): New function.
5300         (Incremental_object_entry::get_comdat_signature_key): New function.
5301         (Incremental_object_entry::groups_): New data member.
5302         (Incremental_inputs::report_comdat_group): New function.
5303         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5304         data for incremental input file entry.
5305         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5306         (Incremental_input_entry_reader::get_input_section): Adjust size of
5307         data for incremental input file entry.
5308         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5309         (Incremental_input_entry_reader::get_comdat_group_signature): New
5310         function.
5311         * object.cc (Sized_relobj::include_section_group): Report kept
5312         COMDAT groups for incremental links.
5313
5314 2011-05-24  David Meyer  <pdox@google.com>
5315
5316         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5317         with name parameter.  Add found_name parameter.
5318         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5319         * dirsearch.h (class Dirsearch): Update declaration.
5320
5321 2011-05-24  Ian Lance Taylor  <iant@google.com>
5322
5323         * archive.cc (Library_base::should_include_member): Pull in object
5324         from archive if it defines the entry symbol.
5325         * parameters.cc (Parameters::entry): New function.
5326         * parameters.h (class Parameters): Declare entry.
5327         * output.h (class Output_file_header): Remove entry_ field.
5328         * output.cc (Output_file_header::Output_file_header): Remove entry
5329         parameter.  Change all callers.
5330         (Output_file_header::entry): Use parameters->entry.
5331         * gold.cc (queue_middle_tasks): Likewise.
5332         * plugin.cc (Plugin_hook::run): Likewise.
5333
5334 2011-05-24 Cary Coutant  <ccoutant@google.com>
5335
5336         * gold.cc (queue_initial_tasks): Pass incremental base filename
5337         to Output_file::open_base_file; don't print error message.
5338         * incremental-dump.cc (main): Adjust call to
5339         Output_file::open_for_modification.
5340         * incremental-dump.cc (main): Likewise.
5341         * incremental.cc (Incremental_inputs::report_command_line):
5342         Ignore --incremental-base option when comparing command lines.
5343         Ignore parameter when given as separate argument.
5344         * options.h (class General_options): Add --incremental-base.
5345         * output.cc (Output_file::Output_file):
5346         (Output_file::open_base_file): Add base_name and writable parameters;
5347         read base file into new file; print error message here.
5348         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5349         callers.
5350         * output.h (Output_file::open_for_modification): Rename to...
5351         (Output_file::open_base_file): ...this; add base_name and
5352         writable parameters; adjust all callers.
5353         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5354         callers.
5355         * testsuite/Makefile.am (incremental_test_4): Test
5356         --incremental-base.
5357         * testsuite/Makefile.in: Regenerate.
5358
5359 2011-05-24 Cary Coutant  <ccoutant@google.com>
5360
5361         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5362         incremental_test_4.
5363         * testsuite/Makefile.in: Regenerate.
5364         * testsuite/two_file_test_1_v1.cc: New test source file.
5365         * testsuite/two_file_test_1b_v1.cc: New test source file.
5366         * testsuite/two_file_test_2_v1.cc: New test source file.
5367
5368 2011-05-24 Cary Coutant  <ccoutant@google.com>
5369
5370         * dynobj.h (Dynobj::do_dynobj): New function.
5371         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5372         flag and soname for shared objects.
5373         * incremental.cc (Incremental_inputs::report_object): Make
5374         either Incremental_object_entry or Incremental_dynobj_entry; add
5375         soname to string table.
5376         (Incremental_inputs::report_input_section): Add assertion.
5377         (Output_section_incremental_inputs::set_final_data_size): Adjust
5378         type of input file entry for shared libraries; adjust size of
5379         shared library info entry.
5380         (Output_section_incremental_inputs::write_input_files): Write
5381         as_needed flag for shared libraries.
5382         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5383         of input file entry for shared libraries; write soname.
5384         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5385         soname from incremental info.
5386         * incremental.h (enum Incremental_input_flags): Add
5387         INCREMENTAL_INPUT_AS_NEEDED.
5388         (Incremental_input_entry::Incremental_input_entry): Initialize new
5389         data member.
5390         (Incremental_input_entry::set_as_needed): New function.
5391         (Incremental_input_entry::as_needed): New function.
5392         (Incremental_input_entry::do_dynobj_entry): New function.
5393         (Incremental_input_entry::as_needed_): New data member.
5394         (Incremental_object_entry::Incremental_object_entry): Don't check
5395         for shared library.
5396         (Incremental_object_entry::do_type): Likewise.
5397         (class Incremental_dynobj_entry): New class.
5398         (Incremental_input_entry_reader::as_needed): New function.
5399         (Incremental_input_entry_reader::get_soname): New function.
5400         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5401         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5402         size of shared library info entry.
5403         * layout.cc (Layout::finish_dynamic_section): Don't test for
5404         incremental link when adding DT_NEEDED entries.
5405         * object.h (Object::Object): Initialize new data member.
5406         (Object::dynobj): New function.
5407         (Object::set_as_needed): New function.
5408         (Object::as_needed): New function.
5409         (Object::do_dynobj): New function.
5410         (Object::as_needed_): New data member.
5411
5412 2011-05-24 Cary Coutant  <ccoutant@google.com>
5413
5414         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5415         info; adjust display of GOT entries.
5416         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5417         vector of input objects; remove file_status_.
5418         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5419         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5420         got_plt reader; call target hooks to reserve GOT entries.
5421         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5422         of input file info header and GOT info entry.
5423         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5424         relocation info.
5425         (Got_plt_view_info::got_descriptor): Remove.
5426         (Got_plt_view_info::sym_index): New data member.
5427         (Got_plt_view_info::input_index): New data member.
5428         (Local_got_offset_visitor::visit): Write input file index.
5429         (Global_got_offset_visitor::visit): Write 0 for input file index.
5430         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5431         with sym_index and input_index.
5432         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5433         incremental info GOT entry; replace got_descriptor with input_index.
5434         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5435         map from input file index to object.
5436         (Sized_relobj_incr::do_layout): Replace direct data member reference
5437         with accessor function.
5438         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5439         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5440         Adjust size of input file info header.
5441         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5442         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5443         (Incremental_input_entry_reader::get_input_section): Adjust size of
5444         input file info header.
5445         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5446         of incremental info GOT entry.
5447         (Incremental_got_plt_reader::get_got_desc): Remove.
5448         (Incremental_got_plt_reader::get_got_symndx): New function.
5449         (Incremental_got_plt_reader::get_got_input_index): New function.
5450         (Sized_incremental_binary::Sized_incremental_binary): Remove
5451         file_status_; add input_objects_.
5452         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5453         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5454         (Sized_incremental_binary::file_is_unchanged): Remove.
5455         (Sized_incremental_binary::set_input_object): New function.
5456         (Sized_incremental_binary::input_object): New function.
5457         (Sized_incremental_binary::file_status_): Remove.
5458         (Sized_incremental_binary::input_objects_): New data member.
5459         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5460         references.
5461         (Sized_relobj_incr::invalid_address): Move to base class.
5462         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5463         class.
5464         (Sized_relobj_incr::do_output_section_offset): Likewise.
5465         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5466         (Sized_relobj_incr::section_offsets_): Likewise.
5467         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5468         function.
5469         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5470         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5471         with accessor function.
5472         (Sized_relobj_file::do_layout): Likewise.
5473         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5474         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5475         (Sized_relobj_file::compute_final_local_value): Replace refs to
5476         section_offsets_ with accessor function.
5477         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5478         * object.h (Relobj::Relobj): Initialize new data members.
5479         (Relobj::add_dyn_reloc): New function.
5480         (Relobj::first_dyn_reloc): New function.
5481         (Relobj::dyn_reloc_count): New function.
5482         (Relobj::first_dyn_reloc_): New data member.
5483         (Relobj::dyn_reloc_count_): New data member.
5484         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5485         references.
5486         (Sized_relobj::Address): New typedef.
5487         (Sized_relobj::invalid_address): Move here from child class.
5488         (Sized_relobj::Sized_relobj): Initialize new data members.
5489         (Sized_relobj::sized_relobj): New function.
5490         (Sized_relobj::is_output_section_offset_invalid): Move here from
5491         child class.
5492         (Sized_relobj::get_output_section_offset): Likewise.
5493         (Sized_relobj::local_has_got_offset): Likewise.
5494         (Sized_relobj::local_got_offset): Likewise.
5495         (Sized_relobj::set_local_got_offset): Likewise.
5496         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5497         (Sized_relobj::clear_got_offsets): New function.
5498         (Sized_relobj::section_offsets): Move here from child class.
5499         (Sized_relobj::do_output_section_offset): Likewise.
5500         (Sized_relobj::do_set_section_offset): Likewise.
5501         (Sized_relobj::Local_got_offsets): Likewise.
5502         (Sized_relobj::local_got_offsets_): Likewise.
5503         (Sized_relobj::section_offsets_): Likewise.
5504         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5505         references.
5506         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5507         class.
5508         (Sized_relobj_file::sized_relobj): New function
5509         (Sized_relobj_file::local_has_got_offset): Move to base class.
5510         (Sized_relobj_file::local_got_offset): Likewise.
5511         (Sized_relobj_file::set_local_got_offset): Likewise.
5512         (Sized_relobj_file::get_output_section_offset): Likewise.
5513         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5514         (Sized_relobj_file::do_output_section_offset): Likewise.
5515         (Sized_relobj_file::do_set_section_offset): Likewise.
5516         (Sized_relobj_file::Local_got_offsets): Likewise.
5517         (Sized_relobj_file::local_got_offsets_): Likewise.
5518         (Sized_relobj_file::section_offsets_): Likewise.
5519         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5520         (all constructors).
5521         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5522         (Output_reloc::get_symbol_index): Likewise.
5523         (Output_reloc::local_section_offset): Likewise.
5524         (Output_reloc::get_address): Likewise.
5525         (Output_reloc::symbol_value): Likewise.
5526         (Output_data_got::reserve_slot): Move to class definition.
5527         (Output_data_got::reserve_local): New function.
5528         (Output_data_got::reserve_slot_for_global): Remove.
5529         (Output_data_got::reserve_global): New function.
5530         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5531         (all constructors, two instantiations).
5532         (Output_reloc::get_relobj): New function (two instantiations).
5533         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5534         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5535         (Output_data_reloc::add_global): Adjust type of relobj.
5536         (Output_data_reloc::add_global_relative): Likewise.
5537         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5538         (Output_data_reloc::add_local): Likewise.
5539         (Output_data_reloc::add_local_relative): Likewise.
5540         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5541         (Output_data_reloc::add_local_section): Likewise.
5542         (Output_data_reloc::add_output_section): Likewise.
5543         (Output_data_reloc::add_absolute): Likewise.
5544         (Output_data_reloc::add_target_specific): Likewise.
5545         (Output_data_got::reserve_slot): Move definition here.
5546         (Output_data_got::reserve_local): New function.
5547         (Output_data_got::reserve_global): New function.
5548         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5549         section_offsets_ with accessor function.
5550         (Sized_relobj_file::write_sections): Likewise.
5551         (Sized_relobj_file::do_relocate_sections): Likewise.
5552         * target.h (Sized_target::reserve_local_got_entry): New function.
5553         (Sized_target::reserve_global_got_entry): New function.
5554         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5555         (Target_x86_64::reserve_global_got_entry): New function.
5556         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5557
5558 2011-05-23 Cary Coutant  <ccoutant@google.com>
5559
5560         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5561         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5562         bit when checking got_type.
5563         * incremental.cc (Sized_incremental_binary::setup_readers):
5564         Store symbol table and string table locations; initialize bit vector
5565         of file status flags.
5566         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5567         unchanged files.
5568         (Sized_incremental_binary::do_process_got_plt): New function.
5569         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5570         (Output_section_incremental_inputs::set_final_data_size): Record
5571         file index for each input file.
5572         (Output_section_incremental_inputs::write_got_plt): Store file index
5573         instead of input entry offset for each GOT entry.
5574         * incremental.h
5575         (Incremental_input_entry::Incremental_input_entry): Initialize new
5576         data member.
5577         (Incremental_input_entry::set_offset): Store file index.
5578         (Incremental_input_entry::get_file_index): New function.
5579         (Incremental_input_entry::file_index_): New data member.
5580         (Incremental_binary::process_got_plt): New function.
5581         (Incremental_binary::do_process_got_plt): New function.
5582         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5583         data members.
5584         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5585         (Sized_incremental_binary::set_file_is_unchanged): New function.
5586         (Sized_incremental_binary::file_is_unchanged): New function.
5587         (Sized_incremental_binary::do_process_got_plt): New function.
5588         (Sized_incremental_binary::file_status_): New data member.
5589         (Sized_incremental_binary::main_symtab_loc_): New data member.
5590         (Sized_incremental_binary::main_strtab_loc_): New data member.
5591         * output.cc (Output_data_got::Got_entry::write): Add case
5592         RESERVED_CODE.
5593         (Output_data_got::add_global): Call add_got_entry.
5594         (Output_data_got::add_global_plt): Likewise.
5595         (Output_data_got::add_global_with_rel): Likewise.
5596         (Output_data_got::add_global_with_rela): Likewise.
5597         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5598         (Output_data_got::add_global_pair_with_rela): Likewise.
5599         (Output_data_got::add_local): Call add_got_entry.
5600         (Output_data_got::add_local_plt): Likewise.
5601         (Output_data_got::add_local_with_rel): Likewise.
5602         (Output_data_got::add_local_with_rela): Likewise.
5603         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5604         (Output_data_got::add_local_pair_with_rela): Likewise.
5605         (Output_data_got::reserve_slot): New function.
5606         (Output_data_got::reserve_slot_for_global): New function.
5607         (Output_data_got::add_got_entry): New function.
5608         (Output_data_got::add_got_entry_pair): New function.
5609         (Output_section::add_output_section_data): Edit FIXME.
5610         * output.h
5611         (Output_section_data_build::Output_section_data_build): New
5612         constructor with size parameter.
5613         (Output_data_space::Output_data_space): Likewise.
5614         (Output_data_got::Output_data_got): Initialize new data member; new
5615         constructor with size parameter.
5616         (Output_data_got::add_constant): Call add_got_entry.
5617         (Output_data_got::reserve_slot): New function.
5618         (Output_data_got::reserve_slot_for_global): New function.
5619         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5620         (Output_data_got::add_got_entry): New function.
5621         (Output_data_got::add_got_entry_pair): New function.
5622         (Output_data_got::free_list_): New data member.
5623         * target.h (Sized_target::init_got_plt_for_update): New function.
5624         (Sized_target::register_global_plt_entry): New function.
5625         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5626         Initialize new data member; call init; add constructor with PLT count.
5627         (Output_data_plt_x86_64::init): New function.
5628         (Output_data_plt_x86_64::add_relocation): New function.
5629         (Output_data_plt_x86_64::reserve_slot): New function.
5630         (Output_data_plt_x86_64::free_list_): New data member.
5631         (Target_x86_64::init_got_plt_for_update): New function.
5632         (Target_x86_64::register_global_plt_entry): New function.
5633         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5634         incremental updates.
5635         (Output_data_plt_x86_64::add_relocation): New function.
5636         * testsuite/object_unittest.cc (Object_test): Set default options.
5637
5638 2011-05-16  Ian Lance Taylor  <iant@google.com>
5639
5640         * options.h (class General_options): Make -i a synonym for -r.
5641
5642 2011-05-16  Ian Lance Taylor  <iant@google.com>
5643
5644         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5645
5646 2011-05-10 Cary Coutant  <ccoutant@google.com>
5647
5648         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5649         strip_all (-s).
5650
5651 2011-05-06  Ian Lance Taylor  <iant@google.com>
5652
5653         * layout.cc (Layout::layout): If the output section flags change,
5654         update the ordering.
5655
5656 2011-04-25 Cary Coutant  <ccoutant@google.com>
5657
5658         * incremental-dump.cc (dump_incremental_inputs): Print local
5659         symbol info for each input file.
5660         * incremental.cc
5661         (Output_section_incremental_inputs::set_final_data_size): Add local
5662         symbol info to input file entries in incremental info.
5663         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5664         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5665         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5666         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5667         implementation.
5668         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5669         (Sized_incr_relobj::do_relocate): Write the local symbols.
5670         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5671         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5672         Adjust size of input file header.
5673         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5674         (Incremental_inputs_reader::get_local_symbol_count): New function.
5675         (Incremental_inputs_reader::get_input_section): Adjust size of input
5676         file header.
5677         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5678         (Sized_incr_relobj::This): New typedef.
5679         (Sized_incr_relobj::sym_size): New const data member.
5680         (Sized_incr_relobj::Local_symbol): New struct.
5681         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5682         (Sized_incr_relobj::do_local_symbol_offset): New function.
5683         (Sized_incr_relobj::local_symbol_count_): New data member.
5684         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5685         (Sized_incr_relobj::local_symbol_index_): New data member.
5686         (Sized_incr_relobj::local_symbol_offset_): New data member.
5687         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5688         (Sized_incr_relobj::local_symbols_): New data member.
5689         * object.h (Relobj::output_local_symbol_count): New function.
5690         (Relobj::local_symbol_offset): New function.
5691         (Relobj::do_output_local_symbol_count): New function.
5692         (Relobj::do_local_symbol_offset): New function.
5693         (Sized_relobj::do_output_local_symbol_count): New function.
5694         (Sized_relobj::do_local_symbol_offset): New function.
5695
5696 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5697
5698         * descriptors.cc (set_close_on_exec): New function.
5699         (Descriptors::open): Use set_close_on_exec.
5700         * output.cc (S_ISLNK): Define if not defined.
5701
5702 2011-04-22 Cary Coutant  <ccoutant@google.com>
5703
5704         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5705         global symbol map.
5706         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5707         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5708         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5709         relocations.
5710         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5711         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5712         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5713         * incremental.h
5714         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5715         function.
5716         (Incremental_binary::apply_incremental_relocs): New function.
5717         (Incremental_binary::do_apply_incremental_relocs): New function.
5718         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5719         data member.
5720         (Sized_incremental_binary::add_global_symbol): New function.
5721         (Sized_incremental_binary::global_symbol): New function.
5722         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5723         (Sized_incremental_binary::symbol_map_): New data member.
5724         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5725         * target.h (Sized_target::apply_relocation): New function.
5726         * target-reloc.h (apply_relocation): New function.
5727         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5728
5729 2011-04-22  Doug Kwan  <dougkwan@google.com>
5730
5731         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5732         flag of a SHT_ARM_EXIDX section.
5733         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5734         * testsuite/Makefile.in: Regenerate.
5735         * testsuite/arm_exidx_test.s: New file.
5736         * testsuite/arm_exidx_test.sh: Same.
5737
5738 2011-04-20 Cary Coutant  <ccoutant@google.com>
5739
5740         PR gold/12689
5741         * archive.h (Incremental_archive_entry::Archive_member):
5742         Initialize arg_serial_ (second constructor).
5743
5744 2011-04-17  Ian Lance Taylor  <iant@google.com>
5745
5746         * object.cc (Relocate_info::location): Simplify location string.
5747         * errors.cc (Errors::error_at_location): Don't print program
5748         name.
5749         (Errors::warning_at_location): Likewise.
5750         (Errors::undefined_symbol): Likewise.
5751         * testsuite/debug_msg.sh: Update accordingly.
5752
5753 2011-04-14 Cary Coutant  <ccoutant@google.com>
5754
5755         * gold/layout.cc (Layout::symtab_section_offset): New function.
5756         * gold/layout.h (Layout::symtab_section_offset): New function.
5757         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5758
5759 2011-04-12  Ian Lance Taylor  <iant@google.com>
5760
5761         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5762         with MREMAP_MAYMOVE.
5763         * output.h (class Output_file): Add map_is_allocated_ field.
5764         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5765         not available, provide stubs.  If mremap is not available, #define
5766         it to gold_mremap.
5767         (MREMAP_MAYMOVE): Define if not defined.
5768         (Output_file::Output_file): Initialize map_is_allocated_.
5769         (Output_file::resize): Check map_is_allocated_.
5770         (Output_file::map_anonymous): If mmap fails, use malloc.
5771         (Output_file::unmap): Don't do anything for an anonymous map.
5772         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5773         is not available, provide stubs.
5774         (File_read::View::~View): Use free rather than delete[].
5775         (File_read::make_view): Use malloc rather than new[].  If mmap
5776         fails, use malloc.
5777         (File_read::find_or_make_view): Use malloc rather than new[].
5778         * gold.h: Remove HAVE_REMAP code.
5779         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5780         exists.  Rename mremap to gold_mremap.  If mmap is not available
5781         don't do anything.
5782         * configure, config.in: Rebuild.
5783
5784 2011-04-11  Ian Lance Taylor  <iant@google.com>
5785
5786         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5787         initialize local variable v.
5788
5789 2011-04-11  Cary Coutant  <ccoutant@google.com>
5790
5791         * archive.cc (Archive::include_member): Adjust call to
5792         report_object.
5793         (Add_archive_symbols::run): Track argument serial numbers.
5794         (Lib_group::include_member): Likewise.
5795         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5796         * archive.h (Incremental_archive_entry::Archive_member):
5797         Initialize arg_serial_.
5798         (Archive_member::arg_serial_): New data member.
5799         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5800         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5801         incremental link.
5802         (Sized_dynobj::do_for_all_local_got_entries): New function.
5803         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5804         function.
5805         * fileread.cc (get_mtime): New function.
5806         * fileread.h (get_mtime): New function.
5807         * gold.cc (queue_initial_tasks): Check for incremental update.
5808         (process_incremental_input): New function.
5809         (queue_middle_tasks): Don't force valid target for incremental
5810         update.
5811         * incremental-dump.cc (find_input_containing_global): Adjust
5812         size of symbol info entry.
5813         (dump_incremental_inputs): Dump argument serial number and
5814         in_system_directory flag; bias shndx by 1; print symbol names
5815         when dumping per-file symbol lists; use new symbol info readers.
5816         * incremental.cc
5817         (Output_section_incremental_inputs:update_data_size): New function.
5818         (Sized_incremental_binary::setup_readers): Setup input readers
5819         for each input file; build maps for files added from libraries
5820         and scripts.
5821         (Sized_incremental_binary::check_input_args): New function.
5822         (Sized_incremental_binary::do_check_inputs): Build map of argument
5823         serial numbers to input arguments.
5824         (Sized_incremental_binary::do_file_has_changed): Rename
5825         do_file_is_unchanged to this; compare file modification times.
5826         (Sized_incremental_binary::do_init_layout): New function.
5827         (Sized_incremental_binary::do_reserve_layout): New function.
5828         (Sized_incremental_binary::do_get_input_reader): Remove.
5829         (Sized_incremental_binary::get_symtab_view): New function.
5830         (Incremental_checker::can_incrementally_link_output_file): Remove.
5831         (Incremental_inputs::report_command_line): Exclude --debug options.
5832         (Incremental_inputs::report_archive_begin): Add parameter; track
5833         argument serial numbers; don't put input file entry for archive
5834         before archive members.
5835         (Incremental_inputs::report_archive_end): Put input file entry
5836         for archive after archive members.
5837         (Incremental_inputs::report_object): Add parameter; track argument
5838         serial numbers and in_system_directory flag.
5839         (Incremental_inputs::report_script): Add parameter; track argument
5840         serial numbers.
5841         (Output_section_incremental_inputs::set_final_data_size): Adjust
5842         size of symbol info entry; check for forwarding symbols.
5843         (Output_section_incremental_inputs::write_input_files): Write
5844         in_system_directory flag and argument serial number.
5845         (Output_section_incremental_inputs::write_info_blocks): Map section
5846         indices between incremental info and original input file; store
5847         input section index for each symbol.
5848         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5849         change operator() to visit().
5850         (class Global_got_offset_visitor): Likewise.
5851         (class Global_symbol_visitor_got_plt):
5852         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5853         classes.
5854         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5855         (Sized_incr_relobj::do_read_symbols): New function.
5856         (Sized_incr_relobj::do_layout): New function.
5857         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5858         (Sized_incr_relobj::do_add_symbols): New function.
5859         (Sized_incr_relobj::do_should_include_member): New function.
5860         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5861         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5862         (Sized_incr_relobj::do_section_size): New function.
5863         (Sized_incr_relobj::do_section_name): New function.
5864         (Sized_incr_relobj::do_section_contents): New function.
5865         (Sized_incr_relobj::do_section_flags): New function.
5866         (Sized_incr_relobj::do_section_entsize): New function.
5867         (Sized_incr_relobj::do_section_address): New function.
5868         (Sized_incr_relobj::do_section_type): New function.
5869         (Sized_incr_relobj::do_section_link): New function.
5870         (Sized_incr_relobj::do_section_info): New function.
5871         (Sized_incr_relobj::do_section_addralign): New function.
5872         (Sized_incr_relobj::do_initialize_xindex): New function.
5873         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5874         (Sized_incr_relobj::do_read_relocs): New function.
5875         (Sized_incr_relobj::do_gc_process_relocs): New function.
5876         (Sized_incr_relobj::do_scan_relocs): New function.
5877         (Sized_incr_relobj::do_count_local_symbols): New function.
5878         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5879         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5880         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5881         (Sized_incr_relobj::do_relocate): New function.
5882         (Sized_incr_relobj::do_set_section_offset): New function.
5883         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5884         (Sized_incr_dynobj::do_read_symbols): New function.
5885         (Sized_incr_dynobj::do_layout): New function.
5886         (Sized_incr_dynobj::do_add_symbols): New function.
5887         (Sized_incr_dynobj::do_should_include_member): New function.
5888         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5889         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5890         (Sized_incr_dynobj::do_section_size): New function.
5891         (Sized_incr_dynobj::do_section_name): New function.
5892         (Sized_incr_dynobj::do_section_contents): New function.
5893         (Sized_incr_dynobj::do_section_flags): New function.
5894         (Sized_incr_dynobj::do_section_entsize): New function.
5895         (Sized_incr_dynobj::do_section_address): New function.
5896         (Sized_incr_dynobj::do_section_type): New function.
5897         (Sized_incr_dynobj::do_section_link): New function.
5898         (Sized_incr_dynobj::do_section_info): New function.
5899         (Sized_incr_dynobj::do_section_addralign): New function.
5900         (Sized_incr_dynobj::do_initialize_xindex): New function.
5901         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5902         (make_sized_incremental_object): New function.
5903         (Incremental_library::copy_unused_symbols): New function.
5904         (Incremental_library::do_for_all_unused_symbols): New function.
5905         * incremental.h (enum Incremental_input_flags): New type.
5906         (class Incremental_checker): Remove.
5907         (Incremental_input_entry::Incremental_input_entry): Add argument
5908         serial number.
5909         (Incremental_input_entry::arg_serial): New function.
5910         (Incremental_input_entry::set_is_in_system_directory): New function.
5911         (Incremental_input_entry::is_in_system_directory): New function.
5912         (Incremental_input_entry::arg_serial_): New data member.
5913         (Incremental_input_entry::is_in_system_directory_): New data member.
5914         (class Script_info): Move here from script.h.
5915         (Script_info::Script_info): Add filename parameter.
5916         (Script_info::filename): New function.
5917         (Script_info::filename_): New data member.
5918         (Incremental_script_entry::Incremental_script_entry): Add argument
5919         serial number.
5920         (Incremental_object_entry::Incremental_object_entry): Likewise.
5921         (Incremental_object_entry::add_input_section): Build list of input
5922         sections with map to original shndx.
5923         (Incremental_object_entry::get_input_section_index): New function.
5924         (Incremental_object_entry::shndx_): New data member.
5925         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5926         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5927         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5928         serial number.
5929         (Incremental_inputs::report_archive_begin): Likewise.
5930         (Incremental_inputs::report_object): Likewise.
5931         (Incremental_inputs::report_script): Likewise.
5932         (class Incremental_global_symbol_reader): New class.
5933         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5934         and store flags and input file type.
5935         (Incremental_input_entry_reader::arg_serial): New function.
5936         (Incremental_input_entry_reader::type): Extract type from flags.
5937         (Incremental_input_entry_reader::is_in_system_directory): New function.
5938         (Incremental_input_entry_reader::get_input_section_count): Call
5939         accessor function for type.
5940         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5941         function for type; adjust size of global symbol entry.
5942         (Incremental_input_entry_reader::get_global_symbol_count): Call
5943         accessor function for type.
5944         (Incremental_input_entry_reader::get_object_count): Likewise.
5945         (Incremental_input_entry_reader::get_object_offset): Likewise.
5946         (Incremental_input_entry_reader::get_member_count): Likewise.
5947         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5948         (Incremental_input_entry_reader::get_member_offset): Likewise.
5949         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5950         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5951         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5952         (Incremental_input_entry_reader::get_global_symbol_reader): New
5953         function.
5954         (Incremental_input_entry_reader::get_output_symbol_index): New
5955         function.
5956         (Incremental_input_entry_reader::type_): Remove.
5957         (Incremental_input_entry_reader::flags_): New data member.
5958         (Incremental_inputs_reader::input_file_offset): New function.
5959         (Incremental_inputs_reader::input_file_index): New function.
5960         (Incremental_inputs_reader::input_file): Call input_file_offset.
5961         (Incremental_inputs_reader::input_file_at_offset): New function.
5962         (Incremental_relocs_reader::get_r_type): Reformat.
5963         (Incremental_relocs_reader::get_r_shndx): Reformat.
5964         (Incremental_relocs_reader::get_r_offset): Reformat.
5965         (Incremental_relocs_reader::data): New function.
5966         (Incremental_binary::Incremental_binary): Initialize new data members.
5967         (Incremental_binary::check_inputs): Add cmdline parameter.
5968         (Incremental_binary::file_is_unchanged): Remove.
5969         (Input_reader::arg_serial): New function.
5970         (Input_reader::get_unused_symbol_count): New function.
5971         (Input_reader::get_unused_symbol): New function.
5972         (Input_reader::do_arg_serial): New function.
5973         (Input_reader::do_get_unused_symbol_count): New function.
5974         (Input_reader::do_get_unused_symbol): New function.
5975         (Incremental_binary::input_file_count): New function.
5976         (Incremental_binary::get_input_reader): Change signature to use
5977         index instead of filename.
5978         (Incremental_binary::file_has_changed): New function.
5979         (Incremental_binary::get_input_argument): New function.
5980         (Incremental_binary::get_library): New function.
5981         (Incremental_binary::get_script_info): New function.
5982         (Incremental_binary::init_layout): New function.
5983         (Incremental_binary::reserve_layout): New function.
5984         (Incremental_binary::output_file): New function.
5985         (Incremental_binary::do_check_inputs): New function.
5986         (Incremental_binary::do_file_is_unchanged): Remove.
5987         (Incremental_binary::do_file_has_changed): New function.
5988         (Incremental_binary::do_init_layout): New function.
5989         (Incremental_binary::do_reserve_layout): New function.
5990         (Incremental_binary::do_input_file_count): New function.
5991         (Incremental_binary::do_get_input_reader): Change signature.
5992         (Incremental_binary::input_args_map_): New data member.
5993         (Incremental_binary::library_map_): New data member.
5994         (Incremental_binary::script_map_): New data member.
5995         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5996         new data members.
5997         (Sized_incremental_binary::output_section): New function.
5998         (Sized_incremental_binary::inputs_reader): Add const.
5999         (Sized_incremental_binary::symtab_reader): Add const.
6000         (Sized_incremental_binary::relocs_reader): Add const.
6001         (Sized_incremental_binary::got_plt_reader): Add const.
6002         (Sized_incremental_binary::get_symtab_view): New function.
6003         (Sized_incremental_binary::Inputs_reader): New typedef.
6004         (Sized_incremental_binary::Input_entry_reader): New typedef.
6005         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6006         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6007         (Sized_incremental_binary::do_file_has_changed): New function.
6008         (Sized_incremental_binary::do_init_layout): New function.
6009         (Sized_incremental_binary::do_reserve_layout): New function.
6010         (Sized_input_reader::Inputs_reader): Remove.
6011         (Sized_input_reader::Input_entry_reader): Remove.
6012         (Sized_input_reader::do_arg_serial): New function.
6013         (Sized_input_reader::do_get_unused_symbol_count): New function.
6014         (Sized_input_reader::do_get_unused_symbol): New function.
6015         (Sized_incremental_binary::do_input_file_count): New function.
6016         (Sized_incremental_binary::do_get_input_reader): Change signature;
6017         use index instead of filename.
6018         (Sized_incremental_binary::section_map_): New data member.
6019         (Sized_incremental_binary::input_entry_readers_): New data member.
6020         (class Sized_incr_relobj): New class.
6021         (class Sized_incr_dynobj): New class.
6022         (make_sized_incremental_object): New function.
6023         (class Incremental_library): New class.
6024         * layout.cc (Free_list::num_lists): New static data member.
6025         (Free_list::num_nodes): New static data member.
6026         (Free_list::num_removes): New static data member.
6027         (Free_list::num_remove_visits): New static data member.
6028         (Free_list::num_allocates): New static data member.
6029         (Free_list::num_allocate_visits): New static data member.
6030         (Free_list::init): New function.
6031         (Free_list::remove): New function.
6032         (Free_list::allocate): New function.
6033         (Free_list::dump): New function.
6034         (Free_list::print_stats): New function.
6035         (Layout_task_runner::run): Resize output file for incremental updates.
6036         (Layout::Layout): Initialize new data members.
6037         (Layout::set_incremental_base): New function.
6038         (Layout::init_fixed_output_section): New function.
6039         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6040         incremental updates.
6041         (Layout::create_gold_note): Do not create gold note section for
6042         incremental updates.
6043         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6044         for incremental updates.
6045         (Layout::set_section_offsets): For incremental updates, allocate space
6046         from free list.
6047         (Layout::create_symtab_sections): Layout with offsets relative to
6048         start of section; for incremental updates, allocate space from free
6049         list.
6050         (Layout::create_shdrs): For incremental updates, allocate space from
6051         free list.
6052         (Layout::finish_dynamic_section): For incremental updates, do not
6053         check --as-needed (fixed in subsequent patch).
6054         * layout.h (class Free_list): New class.
6055         (Layout::set_incremental_base): New function.
6056         (Layout::incremental_base): New function.
6057         (Layout::init_fixed_output_section): New function.
6058         (Layout::allocate): New function.
6059         (Layout::incremental_base_): New data member.
6060         (Layout::free_list_): New data member.
6061         * main.cc (main): Print Free_list statistics.
6062         * object.cc (Relobj::finalize_incremental_relocs): Add
6063         clear_counts parameter; clear counts only when clear_counts is set.
6064         (Sized_relobj::Sized_relobj): Initialize new base class.
6065         (Sized_relobj::do_layout): Don't report special sections.
6066         (Sized_relobj::do_for_all_local_got_entries): New function.
6067         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6068         symtab_off to all symbol table offsets.
6069         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6070         * object.h (class Got_offset_list): Move to top of file.
6071         (Object::Object): Allow case where input_file == NULL.
6072         (Object::~Object): Likewise.
6073         (Object::input_file): Assert that input_file != NULL.
6074         (Object::lock): Allow case where input_file == NULL.
6075         (Object::unlock): Likewise.
6076         (Object::is_locked): Likewise.
6077         (Object::token): Likewise.
6078         (Object::release): Likewise.
6079         (Object::is_incremental): New function.
6080         (Object::get_mtime): New function.
6081         (Object::for_all_local_got_entries): New function.
6082         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6083         (Object::set_is_in_system_directory): New function.
6084         (Object::is_in_system_directory): New function.
6085         (Object::do_is_incremental): New function.
6086         (Object::do_get_mtime): New function.
6087         (Object::do_for_all_local_got_entries): New function.
6088         (Object::is_in_system_directory_): New data member.
6089         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6090         (class Sized_relobj_base): New class.
6091         (class Sized_relobj): Derive from Sized_relobj_base.
6092         (class Sized_relobj::Symbols): Redeclare from base class.
6093         (class Sized_relobj::local_got_offset_list): Remove.
6094         (class Sized_relobj::Output_sections): Redeclare from base class.
6095         (class Sized_relobj::do_for_all_local_got_entries): New function.
6096         (class Sized_relobj::write_local_symbols): Add offset parameter.
6097         (class Sized_relobj::local_symbol_offset_): Update comment.
6098         (class Sized_relobj::local_dynsym_offset_): Update comment.
6099         * options.cc (Input_arguments::add_file): Remove const.
6100         * options.h (Input_file_argument::Input_file_argument):
6101         Initialize arg_serial_ (all constructors).
6102         (Input_file_argument::set_arg_serial): New function.
6103         (Input_file_argument::arg_serial): New function.
6104         (Input_file_argument::arg_serial_): New data member.
6105         (Input_arguments::Input_arguments): Initialize file_count_.
6106         (Input_arguments::add_file): Remove const.
6107         (Input_arguments::number_of_input_files): New function.
6108         (Input_arguments::file_count_): New data member.
6109         (Command_line::number_of_input_files): Call
6110         Input_arguments::number_of_input_files.
6111         * output.cc (Output_segment_headers::Output_segment_headers):
6112         Set current size.
6113         (Output_section::Input_section::current_data_size): New function.
6114         (Output_section::Output_section): Initialize new data members.
6115         (Output_section::add_input_section): Don't do merge sections for
6116         an incremental link; allocate space from free list for an
6117         incremental update.
6118         (Output_section::add_output_section_data): Allocate space from
6119         free list for an incremental update.
6120         (Output_section::update_data_size): New function.
6121         (Output_section::set_fixed_layout): New function.
6122         (Output_section::reserve): New function.
6123         (Output_segment::set_section_addresses): Remove const.
6124         (Output_segment::set_section_list_addresses): Remove const; allocate
6125         space from free list for an incremental update.
6126         (Output_segment::set_offset): Adjust size of RELRO segment for an
6127         incremental update.
6128         * output.h (Output_data::current_data_size): Move here from
6129         child classes.
6130         (Output_data::pre_finalize_data_size): New function.
6131         (Output_data::update_data_size): New function.
6132         (Output_section_headers::update_data_size): new function.
6133         (Output_section_data_build::current_data_size): Move to Output_data.
6134         (Output_data_strtab::update_data_size): New function.
6135         (Output_section::current_data_size): Move to Output_data.
6136         (Output_section::set_fixed_layout): New function.
6137         (Output_section::has_fixed_layout): New function.
6138         (Output_section::reserve): New function.
6139         (Output_section::update_data_size): New function.
6140         (Output_section::has_fixed_layout_): New data member.
6141         (Output_section::free_list_): New data member.
6142         (Output_segment::set_section_addresses): Remove const.
6143         (Output_segment::set_section_list_addresses): Remove const.
6144         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6145         New function.
6146         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6147         New function.
6148         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6149         parameter when calling Add_symbols constructor; store argument
6150         serial number for members of a lib group.
6151         (Add_symbols::locks): Allow case where token == NULL.
6152         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6153         (Read_member::~Read_member): New function.
6154         (Read_member::is_runnable): New function.
6155         (Read_member::locks): New function.
6156         (Read_member::run): New function.
6157         (Check_script::~Check_script): New function.
6158         (Check_script::is_runnable): New function.
6159         (Check_script::locks): New function.
6160         (Check_script::run): New function.
6161         (Check_library::~Check_library): New function.
6162         (Check_library::is_runnable): New function.
6163         (Check_library::locks): New function.
6164         (Check_library::run): New function.
6165         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6166         (Add_symbols::library_): New data member.
6167         (class Read_member): New class.
6168         (class Check_script): New class.
6169         (class Check_library): New class.
6170         * reloc.cc (Read_relocs::is_runnable): Allow case where
6171         token == NULL.
6172         (Read_relocs::locks): Likewise.
6173         (Scan_relocs::locks): Likewise.
6174         (Relocate_task::locks): Likewise.
6175         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6176         to clear counters.
6177         (Sized_relobj::incremental_relocs_scan): Fix comment.
6178         (Sized_relobj::do_relocate): Pass output file offset to
6179         write_local_symbols.
6180         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6181         from class declaration.
6182         * script.cc (read_input_script): Allocate Script_info; pass
6183         argument serial number to report_script.
6184         * script.h (class Script_info): Move to incremental.h.
6185         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6186         * symtab.h (Symbol_table::add_from_incrobj): New function.
6187         (Symbol_table::set_file_offset): New function.
6188
6189 2011-04-05  Cary Coutant  <ccoutant@google.com>
6190
6191         * incremental-dump.cc (dump_incremental_inputs): Change signature
6192         to take a Sized_incremental_binary; change caller.  Use readers
6193         in Sized_incremental_binary.
6194         * incremental.cc
6195         (Sized_incremental_binary::find_incremental_inputs_sections):
6196         Rename do_find_incremental_inputs_sections to this.
6197         (Sized_incremental_binary::setup_readers): New function.
6198         (Sized_incremental_binary::do_check_inputs): Check
6199         has_incremental_info_ flag; move setup code to setup_readers;
6200         use input readers.
6201         (Sized_incremental_binary::do_file_is_unchanged): New function.
6202         (Sized_incremental_binary::do_get_input_reader): New function.
6203         * incremental.h (class Incremental_binary): Move to end of file.
6204         (Incremental_binary::file_is_unchanged): New function.
6205         (Incremental_binary::do_file_is_unchanged): New function.
6206         (Incremental_binary::Input_reader): New class.
6207         (Incremental_binary::get_input_reader): New function.
6208         (class Sized_incremental_binary): Move to end of file.
6209         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6210         input section reader classes.
6211         (Sized_incremental_binary::has_incremental_info): New function.
6212         (Sized_incremental_binary::inputs_reader): New function.
6213         (Sized_incremental_binary::symtab_reader): New function.
6214         (Sized_incremental_binary::relocs_reader): New function.
6215         (Sized_incremental_binary::got_plt_reader): New function.
6216         (Sized_incremental_binary::do_file_is_unchanged): New function.
6217         (Sized_incremental_binary::Sized_input_reader): New class.
6218         (Sized_incremental_binary::get_input_reader): New function.
6219         (Sized_incremental_binary::find_incremental_inputs_sections):
6220         Rename do_find_incremental_inputs_sections to this.
6221         (Sized_incremental_binary::setup_readers): New function.
6222         (Sized_incremental_binary::has_incremental_info_): New data member.
6223         (Sized_incremental_binary::inputs_reader_): New data member.
6224         (Sized_incremental_binary::symtab_reader_): New data member.
6225         (Sized_incremental_binary::relocs_reader_): New data member.
6226         (Sized_incremental_binary::got_plt_reader_): New data member.
6227         (Sized_incremental_binary::current_input_file_): New data member.
6228
6229 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6230
6231         PR gold/12640
6232         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6233         violation.
6234
6235 2011-03-30  Cary Coutant  <ccoutant@google.com>
6236
6237         * archive.cc (Archive::include_member): Adjust call to report_object.
6238         (Add_archive_symbols::run): Add script_info to call to
6239         report_archive_begin.
6240         (Lib_group::include_member): Adjust call to report_object.
6241         (Add_lib_group_symbols::run): Adjust call to report_object.
6242         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6243         blocks.  Add object count for script input files.
6244         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6245         script_info parameter; change all callers.
6246         (Incremental_inputs::report_object): Add script_info parameter;
6247         change all callers.
6248         (Incremental_inputs::report_script): Store backpointer to
6249         incremental info entry.
6250         (Output_section_incremental_inputs::set_final_data_size): Record
6251         additional information for scripts.
6252         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6253         * incremental.h (Incremental_script_entry::add_object): New function.
6254         (Incremental_script_entry::get_object_count): New function.
6255         (Incremental_script_entry::get_object): New function.
6256         (Incremental_script_entry::objects_): New data member; adjust
6257         constructor.
6258         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6259         (Incremental_inputs::report_object): Add script_info parameter.
6260         (Incremental_inputs_reader::get_object_count): New function.
6261         (Incremental_inputs_reader::get_object_offset): New function.
6262         * options.cc (Input_arguments::add_file): Return reference to
6263         new input argument.
6264         * options.h (Input_argument::set_script_info): New function.
6265         (Input_argument::script_info): New function.
6266         (Input_argument::script_info_): New data member; adjust all
6267         constructors.
6268         (Input_file_group::add_file): Return reference to new input argument.
6269         (Input_file_lib::add_file): Likewise.
6270         (Input_arguments::add_file): Likewise.
6271         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6272         * script.cc (Parser_closure::Parser_closure): Add script_info
6273         parameter; adjust all callers.
6274         (Parser_closure::script_info): New function.
6275         (Parser_closure::script_info_): New data member.
6276         (read_input_script): Report scripts earlier to incremental info.
6277         (script_add_file): Set script_info in Input_argument.
6278         (script_add_library): Likewise.
6279         * script.h (Script_options::Script_info): Rewrite class.
6280
6281 2011-03-29  Cary Coutant  <ccoutant@google.com>
6282
6283         * archive.cc (Library_base::should_include_member): Move
6284         method here from class Archive.
6285         (Archive::Archive): Initialize base class.
6286         (Archive::should_include_member): Move to base class.
6287         (Archive::do_for_all_unused_symbols): New function.
6288         (Add_archive_symbols::run): Remove redundant access to
6289         incremental_inputs.
6290         (Lib_group::Lib_group): Initialize base class.
6291         (Lib_group::do_filename): New function.
6292         (Lib_group::include_member): Pass pointer to Lib_group to
6293         report_object.
6294         (Lib_group::do_for_all_unused_symbols): New function.
6295         (Add_lib_group_symbols::run): Report archive information for
6296         incremental links.
6297         * archive.h (class Library_base): New base class.
6298         (class Archive): Derive from Library_base.
6299         (Archive::filename): Move to base class.
6300         (Archive::set_incremental_info): Likewise.
6301         (Archive::incremental_info): Likewise.
6302         (Archive::Should_include): Likewise.
6303         (Archive::should_include_member): Likewise.
6304         (Archive::Armap_entry): Remove.
6305         (Archive::Unused_symbol_iterator): Remove.
6306         (Archive::unused_symbols_begin): Remove.
6307         (Archive::unused_symbols_end): Remove.
6308         (Archive::do_filename): New function.
6309         (Archive::do_get_mtime): New function.
6310         (Archive::do_for_all_unused_symbols): New function.
6311         (Archive::task_): Move to base class.
6312         (Archive::incremental_info_): Likewise.
6313         (class Lib_group): Derive from Library_base.
6314         (Lib_group::do_filename): New function.
6315         (Lib_group::do_get_mtime): New function.
6316         (Lib_group::do_for_all_unused_symbols): New function.
6317         (Lib_group::task_): Move to base class.
6318         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6319         function.
6320         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6321         function.
6322         * incremental.cc (Incremental_inputs::report_archive_begin):
6323         Use Library_base; call library's get_mtime; add incremental inputs
6324         entry before members.
6325         (class Unused_symbol_visitor): New class.
6326         (Incremental_inputs::report_archive_end): Use Library_base; use
6327         visitor class to record unused symbols; don't add incremental inputs
6328         entry after members.
6329         (Incremental_inputs::report_object): Use Library_base.
6330         * incremental.h
6331         (Incremental_archive_entry::Incremental_archive_entry): Remove
6332         unused Archive parameter.
6333         (Incremental_inputs::report_archive_begin): Use Library_base.
6334         (Incremental_inputs::report_archive_end): Likewise.
6335         (Incremental_inputs::report_object): Likewise.
6336         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6337         function.
6338         * object.h (Object::for_all_global_symbols): New function.
6339         (Object::do_for_all_global_symbols): New function.
6340         (Sized_relobj::do_for_all_global_symbols): New function.
6341         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6342         function.
6343         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6344         function.
6345
6346 2011-03-27  Ian Lance Taylor  <iant@google.com>
6347
6348         * archive.cc (Archive::interpret_header): Return -1 if something
6349         goes wrong.  Change callers accordingly.
6350
6351 2011-03-25  Cary Coutant  <ccoutant@google.com>
6352
6353         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6354         * testsuite/Makefile.in: Regenerate.
6355
6356 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6357
6358         * plugin.cc (get_view): New.
6359         (Plugin::load): Pass get_view to the plugin.
6360         (Plugin_manager::get_view): New.
6361
6362 2011-03-21  Ian Lance Taylor  <iant@google.com>
6363
6364         * testsuite/final_layout.sh: Rewrite to not use dc.
6365         * testsuite/relro_test.sh: Fail if dc is not present.
6366
6367 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6368
6369         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6370         Change == to -eq.
6371         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6372         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6373         Change == to -eq.
6374         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6375         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6376
6377 2011-03-14  Ian Lance Taylor  <iant@google.com>
6378
6379         * script-sections.cc (Sort_output_sections::script_compare):
6380         Rename from is_before, change return type.
6381         (Sort_output_sections::operator()): Adjust accordingly.
6382
6383 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6384
6385         PR gold/12572
6386         * testsuite/odr_violation2.cc: Add comment to make all error line
6387         numbers double digits.
6388         * testsuite/debug_msg.sh: Adjust expected errors.
6389
6390 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6391
6392         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6393         but mark earlier ones as non-canonical
6394         (offset_to_iterator): Update search target and example
6395         (do_addr2line): Return extra lines in a vector*
6396         (format_file_lineno): Extract from do_addr2line
6397         (one_addr2line): Add vector* out-param
6398         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6399         when a lineno entry appeared last for its instruction
6400         (Dwarf_line_info): Add vector* out-param
6401         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6402         * symtab.cc (Odr_violation_compare): Include the lineno in the
6403         comparison again.
6404         (linenos_from_loc): New. Combine the canonical line for an
6405         address with its other lines.
6406         (True_if_intersect): New. Helper functor to make
6407         std::set_intersection a query.
6408         (detect_odr_violations): Compare sets of lines instead of just
6409         one line for each function. This became less deterministic, but
6410         has fewer false positives.
6411         * symtab.h: Declarations.
6412         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6413         mix an optimized and non-optimized object in the same binary
6414         (odr_violation2.so): Same.
6415         * testsuite/Makefile.in: Regenerate from Makefile.am.
6416         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6417         * testsuite/debug_msg.sh: Update line numbers and add
6418         assertions.
6419         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6420         non-optimized context.
6421         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6422         isn't inlined, and use OdrDerived in an optimized context.
6423         * testsuite/odr_header1.h: Defines OdrDerived, where
6424         optimization will change the
6425         first-instruction-in-the-destructor's file and line number.
6426         * testsuite/odr_header2.h: Defines OdrBase.
6427
6428 2011-03-09  Ian Lance Taylor  <iant@google.com>
6429
6430         * fileread.cc (File_read::clear_views): Don't delete the whole
6431         file view.
6432
6433 2011-03-08  Ian Lance Taylor  <iant@google.com>
6434
6435         PR gold/12525
6436         * fileread.cc: #include <climits>.
6437         (GOLD_IOV_MAX): Define.
6438         (File_read::read_multiple): Limit number of entries by iov_max.
6439         * fileread.h (class File_read): Always set max_readv_entries to
6440         128.
6441
6442 2011-03-07  Ian Lance Taylor  <iant@google.com>
6443
6444         PR gold/12525
6445         * options.h (class General_options): Add -dy and -dn.
6446
6447 2011-03-02  Cary Coutant  <ccoutant@google.com>
6448
6449         * testsuite/script_test_9.t: Add TLS segment.
6450
6451 2011-03-02  Simon Baldwin  <simonb@google.com>
6452
6453         * configure.ac: Add check for gnu_indirect_function support in
6454         the toolchain building binutils.
6455         * configure: Rebuild.
6456
6457 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6458
6459         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6460         plugin only symbols.
6461         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6462         in plugin files as not needed in the symbol table.
6463
6464 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6465
6466         * output.cc (Output_section::add_input_section): Delay fill
6467         generation for section ordering.
6468
6469 2011-02-09  Ian Lance Taylor  <iant@google.com>
6470
6471         PR gold/12316
6472         * object.h (class Sized_relobj): Remove clear_local_symbols.
6473         * reloc.cc (Sized_relobj::do_relocate): Don't call
6474         clear_local_symbols.
6475
6476 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6477
6478         * plugin.cc (is_visible_from_outside): Return true for symbols
6479         in the -u option.
6480
6481 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6482
6483         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6484         filename.
6485
6486 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6487
6488         * icf.h (is_section_foldable_candidate): Change type of parameter
6489         to std::string.
6490         * icf.cc (Icf::find_identical_sections): Change type of local variable
6491         section_name to be std::string.
6492         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6493
6494 2011-01-25  Ian Lance Taylor  <iant@google.com>
6495
6496         * script.cc (script_add_extern): Rewrite to use
6497         add_symbol_reference.
6498
6499 2011-01-25  Doug Kwan  <dougkwan@google.com>
6500
6501         * icf.cc (get_section_contents): Always lock section's object.
6502
6503 2011-01-24  Ian Lance Taylor  <iant@google.com>
6504
6505         * options.h (class General_options): Accept
6506         --no-detect-odr-violations.
6507
6508 2011-01-24  Ian Lance Taylor  <iant@google.com>
6509
6510         * version.cc (version_string): Bump to 1.11.
6511
6512 2011-01-24  Ian Lance Taylor  <iant@google.com>
6513
6514         * plugin.cc (class Plugin_rescan): Define new class.
6515         (Plugin_manager::claim_file): Set any_claimed_.
6516         (Plugin_manager::save_archive): New function.
6517         (Plugin_manager::save_input_group): New function.
6518         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6519         necessary.
6520         (Plugin_manager::new_undefined_symbol): New function.
6521         (Plugin_manager::rescan): New function.
6522         (Plugin_manager::rescannable_defines): New function.
6523         (Plugin_manager::add_input_file): Set any_added_.
6524         * plugin.h (class Plugin_manager): define new fields rescannable_,
6525         undefined_symbols_, any_claimed_, and any_added_.  Declare
6526         Plugin_rescan as friend.  Declare new functions.
6527         (Plugin_manager::Rescannable): Define type.
6528         (Plugin_manager::Rescannable_list): Define type.
6529         (Plugin_manager::Undefined_symbol_list): Define type.
6530         (Plugin_manager::Plugin_manager): Initialize new fields.
6531         * archive.cc (Archive::defines_symbol): New function.
6532         (Add_archive_symbols::run): Pass archive to plugins if any.
6533         * archive.h (class Archive): Declare defines_symbol.
6534         * readsyms.cc (Input_group::~Input_group): New function.
6535         (Finish_group::run): Pass input_group to plugins if any.
6536         * readsyms.h (class Input_group): Declare destructor.
6537         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6538         any.
6539
6540 2011-01-10  Ian Lance Taylor  <iant@google.com>
6541
6542         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6543         section as relro.
6544         (Layout::set_segment_offsets): Reset increase_relro before calling
6545         set_section_addresses a second time.
6546
6547 2011-01-04  Cary Coutant  <ccoutant@google.com>
6548
6549         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6550         sections before NOBITS sections.
6551
6552 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6553
6554         * version.cc (print_version): Update copyright to 2011.
6555
6556 2010-12-23  Cary Coutant  <ccoutant@google.com>
6557
6558         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6559         of OS to this->add.  Add OD parameter to second form of the function.
6560
6561 2010-12-20  Ian Lance Taylor  <iant@google.com>
6562
6563         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6564         second of two consecutive entries with same offset.
6565
6566 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6567
6568         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6569         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6570         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6571         to avoid unneeded links against $(LDADD).
6572         * testsuite/Makefile.in: Regenerate.
6573
6574 2010-12-15  Ian Lance Taylor  <iant@google.com>
6575
6576         PR gold/12324
6577         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6578         for R_X86_64_32 and R_X86_64_PC32.
6579         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6580         ver_matching_def_pic.o.
6581         (ver_matching_def_pic.o): New target.
6582
6583 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6584
6585         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6586         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6587         Move definition before File_read::View member definitions.
6588         (File_read::View::~View): Initialize and hold lock before
6589         updating current_mapped_bytes.
6590
6591 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6592
6593         * dwarf_reader.cc: Remove outdated comment.
6594         * gold-threads.cc: Fix typo in error message.
6595         * archive.cc: Fix typos in comments.
6596         * archive.h: Likewise.
6597         * arm-reloc-property.cc: Likewise.
6598         * arm-reloc-property.h: Likewise.
6599         * arm-reloc.def: Likewise.
6600         * arm.cc: Likewise.
6601         * attributes.h: Likewise.
6602         * cref.cc: Likewise.
6603         * ehframe.cc: Likewise.
6604         * fileread.h: Likewise.
6605         * gold.h: Likewise.
6606         * i386.cc: Likewise.
6607         * icf.cc: Likewise.
6608         * incremental.h: Likewise.
6609         * int_encoding.cc: Likewise.
6610         * layout.h: Likewise.
6611         * main.cc: Likewise.
6612         * merge.h: Likewise.
6613         * object.cc: Likewise.
6614         * object.h: Likewise.
6615         * options.cc: Likewise.
6616         * readsyms.cc: Likewise.
6617         * reduced_debug_output.cc: Likewise.
6618         * reloc.cc: Likewise.
6619         * script-sections.cc: Likewise.
6620         * sparc.cc: Likewise.
6621         * symtab.h: Likewise.
6622         * target-reloc.h: Likewise.
6623         * target.cc: Likewise.
6624         * target.h: Likewise.
6625         * timer.cc: Likewise.
6626         * timer.h: Likewise.
6627         * x86_64.cc: Likewise.
6628
6629 2010-12-09  Cary Coutant  <ccoutant@google.com>
6630
6631         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6632         stack.
6633         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6634         parameter; change all callers.
6635         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6636         * options.h (warn_execstack): New option.
6637
6638 2010-12-07  Doug Kwan  <dougkwan@google.com>
6639
6640         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6641         like function call relocations.
6642
6643 2010-12-07  Ian Lance Taylor  <iant@google.com>
6644
6645         * archive.cc (Archive::get_elf_object_for_member): Permit
6646         punconfigured to be NULL.
6647         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6648         (Archive::include_member): Pass NULL to get_elf_object_for_member
6649         if we searched for the archive and this is the first included
6650         object.
6651
6652 2010-12-01  Ian Lance Taylor  <iant@google.com>
6653
6654         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6655         track_relocs_type_ field.
6656         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6657         Set track_relocs_type_.
6658         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6659         contents when using RELA relocs.
6660         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6661         reloc_map_.
6662         * reloc.cc (Track_relocs::next_addend): New function.
6663         * reloc.h (class Track_relocs): Declare next_addend.
6664
6665 2010-12-01  Ian Lance Taylor  <iant@google.com>
6666
6667         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6668         virtual destructor.
6669
6670 2010-12-01  Ian Lance Taylor  <iant@google.com>
6671
6672         * README: Update compilers known to work and fail.
6673
6674 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6675
6676         * configure.in: For --enable-gold, handle value `default' instead of
6677         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6678         not the default.
6679         * configure: Regenerate.
6680
6681 2010-11-18  Doug Kwan  <dougkwan@google.com>
6682
6683         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6684         and right_alignment to be zero.  Store result alignment only if it is
6685         greater than existing alignment.
6686
6687 2010-11-16  Cary Coutant  <ccoutant@google.com>
6688
6689         PR gold/12220
6690         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6691         Check for ".zdebug_line".
6692
6693 2010-11-16  Doug Kwan  <dougkwan@google.com>
6694             Cary Coutant  <ccoutant@google.com>
6695
6696         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6697         by reference; adjust all callers.
6698         * output.cc (Output_segment::set_section_addresses): Adjust references
6699         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6700         list is empty.
6701         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6702         end at page boundary.
6703
6704 2010-11-16  Cary Coutant  <ccoutant@google.com>
6705
6706         PR gold/12220
6707         * layout.cc (Layout::choose_output_section): Transform names of
6708         compressed sections even when using a script with a SECTIONS clause.
6709         (Layout::output_section_name): Remove code to transform
6710         compressed debug section names.
6711         * output.cc (Output_section::add_input_section): Use uncompressed
6712         section size when tracking input sections.
6713
6714 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6715
6716         * symtab.h (Symbol::NON_PIC_REF): Remove.
6717         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6718         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6719         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6720         (Symbol::use_plt_offset): Take a flags argument and pass it
6721         directly to needs_dynamic_reloc.  Restrict check for undefined
6722         weak symbols to function calls.
6723         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6724         (Target_arm::Scan::global): Use it.
6725         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6726         (Target_arm::Relocate::relocate): Likewise.
6727         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6728         parameter with an r_type parameter.  Use get_reference_flags
6729         to get the flags.
6730         (Target_arm::Relocate::relocate): Update accordingly.
6731         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6732         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6733         (Target_i386::Scan::global): Likewise.
6734         (Target_i386::Relocate::relocate): Likewise.
6735         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6736         parameter with an r_type parameter.  Use get_reference_flags
6737         to get the flags.
6738         (Target_i386::Relocate::relocate): Update accordingly.
6739         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6740         (Target_powerpc::Scan::global): Use it.
6741         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6742         (Target_powerpc::Relocate::relocate): Likewise.
6743         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6744         (Target_sparc::Scan::global): Use it.
6745         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6746         (Target_sparc::Relocate::relocate): Likewise.
6747         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6748         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6749         (Target_x86_64::Scan::global): Likewise.
6750         (Target_x86_64::Relocate::relocate): Likewise.
6751
6752 2010-11-08  Doug Kwan  <dougkwan@google.com>
6753             Cary Coutant  <ccoutant@google.com>
6754
6755         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6756         (Arm_exidx_merge_section::section_contents_): New data member.
6757         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6758         (Arm_input_section::~Arm_input_section): De-allocate memory.
6759         (Arm_input_section::original_contents_): New data member.
6760         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6761         in parameters instead of calling Object::section_contents without
6762         locking.
6763         (Arm_output_section::group_section): New parameter TASK.  Pass it
6764         to callees that need locking objects.
6765         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6766         to lock EXIDX input sections.  Fix a formatting issue.  Call
6767         Arm_exidx_merged_section::build_contents to create merged section
6768         contents.
6769         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6770         to lock object of stub table owner.
6771         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6772         TEXT_SIZE to initialize data member TEXT_SIZE_.
6773         (Arm_exidx_input_section::addralign): Fix typo in comment.
6774         (Arm_exidx_input_section::text_size): New method.
6775         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6776         that require locking objects.  Lock objects before scanning for stubs
6777         and updating local symbols.
6778         (Arm_input_section<big_endian>::init): Copy contents of original
6779         input section.
6780         (Arm_input_section<big_endian>::do_write): Use saved contents of
6781         original input section instead of calling Object::section_contents
6782         without locking.
6783         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6784         size without calling Object::section_size().
6785         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6786         for size.  Allocate a buffer for merged EXIDX entries.
6787         (Arm_exidx_merged_section::build_contents): New method.
6788         (Arm_exidx_merged_section::do_write): Move merge section contents
6789         building code to Arm_exidx_merged_section::build_contetns.  Write
6790         out contetns in buffer instead of building it on the fly.
6791         (Arm_relobj::make_exidx_input_section): Also pass text section size
6792         to Arm_exidx_input_section constructor.
6793         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6794         (Arm_dynobj::do_read_symbols): Fix memory leak.
6795         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6796         * target.h: (class Task): Add forward declaration.
6797         (Target::relax): Add new parameter TASK and pass it to
6798         Target::do_relax().
6799         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6800
6801 2010-11-05  Cary Coutant  <ccoutant@google.com>
6802
6803         PR gold/10708
6804         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6805         object when reading from the file.
6806         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6807         second layout pass.
6808         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6809         when reading section contents.
6810         (get_section_contents): Likewise.
6811         (icf::find_identical_sections): Likewise.
6812         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6813         object when reading from the file.
6814         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6815         the object when doing deferred section layout.
6816
6817 2010-11-03  Nick Clifton  <nickc@redhat.com>
6818
6819         PR gold/12001
6820         * script.h (class Symbol_assignment: name): New member.  Returns
6821         the name of the symbol.
6822         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6823         Returns true if the given symbol name is on the list of
6824         assignments wating to be processed.
6825         * archive.cc (should_incldue_member): If the symbol is undefined,
6826         check to see if it is on the list of symbols pending assignment.
6827
6828 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6829
6830         * script-sections.cc (Script_sections::find_memory_region): Check
6831         for a NULL output section pointer.
6832
6833 2010-10-29  Doug Kwan  <dougkwan@google.com>
6834
6835         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6836         Output_section::add_relaxed_input_section.
6837         * output.cc (Output_section::add_relaxed_input_section): Add new
6838         arguments LAYOUT and NAME.  Set section order index.
6839         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6840         Copy section order index.
6841         * output.h (Output_section::add_relaxed_input_section): Add new
6842         arguments LAYOUT and NAME.
6843
6844 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6845
6846         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6847         NATIVE_OR_CROSS_LINKER.
6848         * testsuite/Makefile.in: Regenerate.
6849
6850 2010-10-20  Doug Kwan  <dougkwan@google.com>
6851
6852         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6853         without SHF_LINK_ORDER flags.
6854         * layout.cc (Layout::choose_output_section): Do not filter
6855         SHF_LINK_ORDER flag in a relocatable link.
6856
6857 2010-10-17  Cary Coutant  <ccoutant@google.com>
6858
6859         * output.h (Output_segment::set_section_addresses): Change function
6860         signature.  Update all callers.
6861         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6862         sections.
6863         (Output_segment::set_section_addresses): Align after last TLS
6864         section.  Add padding before last relro section instead of after.
6865
6866 2010-10-17  Doug Kwan  <dougkwan@google.com>
6867
6868         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6869         GOT output section to be writable.
6870
6871 2010-10-14  Cary Coutant  <ccoutant@google.com>
6872
6873         * debug.h (DEBUG_INCREMENTAL): New flag.
6874         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6875         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6876         mode.
6877         * incremental.cc (report_command_line): Ignore all forms of
6878         --incremental.
6879         * layout.cc (Layout::Layout): Check parameters for incremental link
6880         mode.
6881         * options.cc (General_options::parse_incremental): New function.
6882         (General_options::parse_no_incremental): New function.
6883         (General_options::parse_incremental_full): New function.
6884         (General_options::parse_incremental_update): New function.
6885         (General_options::incremental_mode_): New data member.
6886         (General_options::finalize): Check incremental_mode_.
6887         * options.h (General_options): Update help text for --incremental.
6888         Add --no-incremental, --incremental-full, --incremental-update.
6889         (General_options::Incremental_mode): New enum type.
6890         (General_options::incremental_mode): New function.
6891         (General_options::incremental_mode_): New data member.
6892         * parameters.cc (Parameters::incremental_mode_): New data member.
6893         (Parameters::set_options): Set incremental_mode_.
6894         (Parameters::set_incremental_full): New function.
6895         (Parameters::incremental): New function.
6896         (Parameters::incremental_update): New function.
6897         (set_parameters_incremental_full): New function.
6898         * parameters.h (Parameters::set_incremental_full): New function.
6899         (Parameters::incremental): New function.
6900         (Parameters::incremental_update): New function.
6901         (Parameters::incremental_mode_): New data member.
6902         (set_parameters_incremental_full): New function.
6903         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6904         incremental link mode.
6905         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6906         (Sized_relobj::do_relocate_sections): Likewise.
6907         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6908         option.
6909         * testsuite/Makefile.in: Regenerate.
6910         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6911
6912 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6913
6914         * script-sections.h (class Script_sections): Make
6915         Sections_elements typedef public.
6916         * script-sections.cc (class Sort_output_sections): Add elements_
6917         field.  Add constructor which sets it; change all callers.
6918         (Sort_output_sections::is_before): New function.
6919         (Sort_output_sections::operator()): Call is_before.
6920         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6921         conditional.
6922         * testsuite/script_test_10.sh: New test. Test script section
6923         order.
6924         * testsuite/script_test_10.t: Likewise.
6925         * testsuite/script_test_10.s: Likewise.
6926         * testsuite/Makefile.am: Wrap the cross linker tests and the
6927         common tests into NATIVE_OR_CROSS_LINKER.
6928         (check_SCRIPTS): Add script_test_10.sh.
6929         (check_DATA): Add script_test_10.stdout.
6930         (script_test_10.o, script_test_10): New targets.
6931         (script_test_10.stdout): New target.
6932         * configure, testsuite/Makefile.in: Regenerate.
6933
6934 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6935
6936         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6937         error for the deprecated relocations.
6938         (Target_arm::Scan::global): Likewise.
6939         (Target_arm::Relocate::relocate): Likewise.
6940
6941 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6942
6943         * fileread.cc (Input_file::find_file): Initialize *found_name
6944         and *namep when using the fallback search for case 4.
6945
6946 2010-10-11  Cary Coutant  <ccoutant@google.com>
6947
6948         * options.h (class General_options): Redefine -z lazy as an alias for
6949         the negation of -z now.
6950
6951 2010-10-11  Ian Lance Taylor  <iant@google.com>
6952
6953         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6954         binding.
6955
6956 2010-10-06  Nick Clifton  <nickc@redhat.com>
6957
6958         * script-sections.cc(class Memory_region): Remove
6959         current_lma_offset_ field.  Rename current_vma_offset_ to
6960         current_offset_.  Add last_section_ field.
6961         (Memory_region::get_current_vma_address): Rename to
6962         get_current_address.
6963         (Memory_region::get_current_lma_address): Delete.
6964         (Memory_region::increment_vma_offset): Rename to
6965         increment_offset.
6966         (Memory_region::increment_lma_offset): Delete.
6967         (Memory_region::attributes_compatible): New method.  Returns
6968         true if the provided section is compatible with the region.
6969         (Memory_region::get_last_section): New method.  Returns the last
6970         section to use the region.
6971         (Memory_region::set_last_section): New method.  Stores the last
6972         section to use the region.
6973         (Script_sections::block_in_region): New method.  Returns true if
6974         a block of memory is contained within a region.
6975         (Script_sections::find_memory_region): New method.  Locates a
6976         memory region to be used to set a VMA or LMA address.
6977         (Output_section_definition::set_section_addresses): Add code to
6978         check for addresses set by memory regions.
6979         (Output_segment::set_section_addresses): Remove memory region
6980         walking code.
6981         (Script_sections::create_segment): Add a warning if a header
6982         segment is created outside of any region.
6983         * script-sections.h (class Script_sections): Add prototypes for
6984         find_memory_region and block_in_region methods.
6985         * testsuite/memory_test.s: Use .long instead of .word.
6986         * testsuite/memory_test.t: Add some more output sections.
6987         * testsuite/memory_test.sh: Update expected output.
6988
6989 2010-10-02  Doug Kwan  <dougkwan@google.com>
6990
6991         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6992         defintion to symtab.h
6993         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6994         declaration to defintion.
6995
6996 2010-10-01  Nick Clifton  <nickc@redhat.com>
6997
6998         * expression.cc (eval): Replace dummy argument with NULL.
6999         (eval_maybe_dot): Check for a NULL result section pointer.
7000         (Symbol_expression::value): Likewise.
7001         (Dot_expression::value): Likewise.
7002         (BINARY_EXPRESSION): Likewise.
7003         (Max_expression::value): Likewise.
7004         (Min_expression::value): Likewise.
7005         (Absolute_expression::value): Likewise.
7006         (Addr_expression::value_from_output_section): Likewise.
7007         (Loaddddr_expression::value_from_output_section): Likewise.
7008         (Segment_start_expression::value): Likewise.
7009         * script-sections.cc
7010         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7011         argument with NULL.
7012         (Sections_elememt_dot_assignment::set_section_addresses):
7013         Likewise.
7014         (Output_data_expression::do_write_to_buffer): Likewise.
7015         (Output_section_definition::finalize_symbols): Likewise.
7016         (Output_section_definition::set_section_addresses): Likewise.
7017
7018 2010-09-30  Doug Kwan  <dougkwan@google.com>
7019
7020         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7021
7022 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7023
7024         * target.h (Target::can_icf_inline_merge_sections): New virtual
7025         function.
7026         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7027         virtual function.
7028         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7029         virtual function.
7030         * icf.cc (get_section_contents): Inline merge sections only when
7031         target allows it.
7032
7033 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7034
7035         * configure: Regenerate.
7036
7037 2010-09-17  Ian Lance Taylor  <iant@google.com>
7038
7039         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7040         * testsuite/Makefile.am (memory_test.o): New target.
7041         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7042         memory_test.t.
7043         * testsuite/Makefile.in: Rebuild.
7044
7045 2010-09-17  Doug Kwan  <dougkwan@google.com>
7046
7047         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7048         defintion if relocation uses GOT entries of the symbol.
7049         * testsuite/icf_safe_test.sh: Fix test.
7050         * testsuite/icf_safe_so_test.sh: Fix test.
7051
7052 2010-09-16  Cary Coutant  <ccoutant@google.com>
7053
7054         * script_sections.cc (class Memory_region): Remove "NULL" from
7055         vector initializations.
7056
7057 2010-09-15  Cary Coutant  <ccoutant@google.com>
7058
7059         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7060         Resolve forwarding symbols.
7061
7062 2010-09-15  Doug Kwan  <dougkwan@google.com>
7063
7064         * gold/testsuite/script_test_3.t: Add ARM special sections.
7065         * gold/testsuite/script_test_4.t: Same.
7066         * gold/testsuite/script_test_5.t: Same.
7067         * gold/testsuite/script_test_6.t: Same.
7068         * gold/testsuite/script_test_7.t: Same.
7069         * gold/testsuite/script_test_7.t: Same.
7070         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7071
7072 2010-09-14  Cary Coutant  <ccoutant@google.com>
7073
7074         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7075         (Target_x86_64::Relocate::relocate_tls): Replace check for
7076         saw_tls_block_reloc_ with test for executable section.
7077
7078 2010-09-12  Cary Coutant  <ccoutant@google.com>
7079
7080         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7081         position-independent executables to shared libraries need dynamic
7082         relocations.
7083         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7084         position-independent executables.
7085         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7086         * testsuite/Makefile.in: Regenerate.
7087
7088 2010-09-10  Nick Clifton  <nickc@redhat.com>
7089
7090         PR gold/11997
7091         * testsuite/memory_test.t: Discard any sections that are not
7092         needed.
7093
7094 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7095
7096         PR gold/11996
7097         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7098         "This::" to work around a bug in gcc 4.2.
7099
7100         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7101
7102 2010-09-09  Rafael Espindola  <espindola@google.com>
7103
7104         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7105         sections with different PF_X flags in the same segment.
7106         (Layout::find_first_load_seg): Search all segments to find the first
7107         one.
7108         * options.h (rosegment): New.
7109
7110 2010-09-08  Rafael Espindola  <espindola@google.com>
7111
7112         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7113
7114 2010-09-08  Doug Kwan  <dougkwan@google.com>
7115
7116         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7117         (Arm_relobj::do_relocate_sections): Add new parameter for output
7118         file to match the parent.
7119         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7120         of local symbols instead of input values.  Update code to track
7121         changes in gold::relocate_section.
7122         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7123         (Sized_relobj::compute_final_local_value_internal): New methods.
7124         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7125         body into private version of Sized_relobj::compute_final_local_value.
7126         Call the inline method.
7127         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7128         merged symbol value if there is one.
7129         (Symbol_value::has_output_value): New method defintiion.
7130         (Sized_relobj::Compute_final_local_value_status): New enum type.
7131         (Sized_relobj::compute_final_local_value): New methods.
7132         (Sized_relobj::compute_final_local_value_internal): New methods.
7133         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7134         and arm_cortex_a8.sh.
7135         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7136         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7137         New tests.
7138         * Makefile.in: Regenerate.
7139         * testsuite/arm_bl_out_of_range.s: Update test.
7140         * testsuite/thumb_bl_out_of_range.s: Ditto.
7141         * testsuite/thumb_blx_out_of_range.s: Ditto.
7142         * testsuite/arm_branch_out_of_range.sh: New file.
7143         * testsuite/arm_cortex_a8.sh: Ditto.
7144         * testsuite/arm_cortex_a8_b.s: Ditto.
7145         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7146         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7147         * testsuite/arm_cortex_a8_bl.s: Ditto.
7148         * testsuite/arm_cortex_a8_blx.s: Ditto.
7149         * testsuite/arm_cortex_a8_local.s: Ditto.
7150         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7151         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7152
7153 2010-09-08  Rafael Espindola  <espindola@google.com>
7154
7155         * Makefile.am (memory_test.stdout): Run readelf with -W.
7156         * Makefile.in: Regenerate.
7157         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7158         64 bit output.
7159
7160 2010-09-08  Rafael Espindola  <espindola@google.com>
7161
7162         * script-sections.cc (Script_sections::add_memory_region): Convert
7163         field precision to int.
7164         * script.cc (script_set_section_region, script_set_section_region):
7165         Convert field precision to int.
7166
7167 2010-09-08  Rafael Espindola  <espindola@google.com>
7168
7169         * arm.cc (do_finalize_sections): Create the __exidx_start and
7170         __exdix_end symbols even when the section is missing.
7171
7172 2010-09-08  Nick Clifton  <nickc@redhat.com>
7173
7174         * README: Remove claim that MEMORY is not supported.
7175         * expression.cc (script_exp_function_origin)
7176         (script_exp_function_length): Move from here to ...
7177         * script.cc: ... here.
7178         (script_set_section_region, script_add_memory)
7179         (script_parse_memory_attr, script_include_directive): New
7180         functions.
7181         * script-sections.cc
7182         (class Memory_region): New class.
7183         (class Output_section_definition): Add set_memory_region,
7184         set_section_vma, set_section_lma and get_section_name methods.
7185         (class Script_Sections): Add add_memory_region,
7186         find_memory_region, find_memory_region_origin,
7187         find_memory_region_length and set_memory_region methods.
7188         Have set_section_addresses method walk the list of set memory
7189         regions.
7190         Extend the print methos to display memory regions.
7191         * script-sections.h: Add prototypes for new methods.
7192         Add enum for MEMORY region attributes.
7193         * yyscript.y: Add support for parsing MEMORY regions.
7194         * script-c.h: Add prototypes for new functions.
7195         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7196         * testsuite/Makefile.in: Regenerate.
7197         * testsuite/memory_test.sh: New script.
7198         * testsuite/memory_test.s: New assembler source file.
7199         * testsuite/memory_test.t: New linker script.
7200
7201 2010-08-27  Doug Kwan  <dougkwan@google.com>
7202
7203         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7204         reference override an existing dynamic weak reference.
7205         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7206         * testsuite/Makefile.in: Regenerate.
7207         * testsuite/dyn_weak_ref.sh: New file.
7208         * testsuite/dyn_weak_ref_1.c: Ditto.
7209         * testsuite/dyn_weak_ref_2.c: Ditto.
7210
7211 2010-08-27  Ian Lance Taylor  <iant@google.com>
7212
7213         * incremental.h (class Incremental_input_entry): Add virtual
7214         destructor.
7215
7216 2010-08-27  Ian Lance Taylor  <iant@google.com>
7217
7218         * testsuite/start_lib_test_3.c: Mark t3 as used.
7219
7220 2010-08-27  Nick Clifton  <nickc@redhat.com>
7221
7222         * options.cc (version_script): Fix small typo in previous
7223         whitespace tidyup.
7224
7225 2010-08-25  Nick Clifton  <nickc@redhat.com>
7226
7227         * archive.cc: Formatting fixes: Remove whitespace between
7228         typename and following asterisk.  Remove whitespace between
7229         function name and opening parenthesis.
7230         * archive.h: Likewise.
7231         * arm.cc: Likewise.
7232         * attributes.cc: Likewise.
7233         * attributes.h: Likewise.
7234         * common.cc: Likewise.
7235         * copy-relocs.cc: Likewise.
7236         * dirsearch.h: Likewise.
7237         * dynobj.cc: Likewise.
7238         * ehframe.cc: Likewise.
7239         * ehframe.h: Likewise.
7240         * expression.cc: Likewise.
7241         * fileread.cc: Likewise.
7242         * fileread.h: Likewise.
7243         * gc.h: Likewise.
7244         * gold-threads.cc: Likewise.
7245         * gold.cc: Likewise.
7246         * i386.cc: Likewise.
7247         * icf.h: Likewise.
7248         * incremental-dump.cc: Likewise.
7249         * incremental.cc: Likewise.
7250         * layout.cc: Likewise.
7251         * layout.h: Likewise.
7252         * main.cc: Likewise.
7253         * merge.cc: Likewise.
7254         * merge.h: Likewise.
7255         * object.cc: Likewise.
7256         * object.h: Likewise.
7257         * options.cc: Likewise.
7258         * options.h: Likewise.
7259         * output.cc: Likewise.
7260         * output.h: Likewise.
7261         * plugin.cc: Likewise.
7262         * plugin.h: Likewise.
7263         * powerpc.cc: Likewise.
7264         * reloc.cc: Likewise.
7265         * script-c.h: Likewise.
7266         * script-sections.cc: Likewise.
7267         * script.cc: Likewise.
7268         * stringpool.cc: Likewise.
7269         * symtab.cc: Likewise.
7270         * symtab.h: Likewise.
7271         * target.cc: Likewise.
7272         * timer.cc: Likewise.
7273         * timer.h: Likewise.
7274         * version.cc: Likewise.
7275         * x86_64.cc: Likewise.
7276
7277 2010-08-24  Nick Clifton  <nickc@redhat.com>
7278
7279         PR 11899
7280         * layout.cc (segment_precedes): Sort segments by their physical
7281         addresses, if they have been set.
7282
7283 2010-08-23  Cary Coutant  <ccoutant@google.com>
7284
7285         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7286         symbols data.
7287         (Lib_group::include_member): Unlock object after deleting its
7288         symbols data.
7289         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7290         the bug fixed here.
7291
7292 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7293             Cary Coutant  <ccoutant@google.com>
7294
7295         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7296         constructor, and set_blocker.
7297         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7298         readsyms_blocker_.
7299         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7300         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7301         * testsuite/Makefile.am (start_lib_test): New test case.
7302         * testsuite/Makefile.in: Regenerate.
7303         * testsuite/start_lib_test_main.c: New file.
7304         * testsuite/start_lib_test_1.c: New file.
7305         * testsuite/start_lib_test_2.c: New file.
7306         * testsuite/start_lib_test_3.c: New file.
7307
7308 2010-08-19  Ian Lance Taylor  <iant@google.com>
7309
7310         * Makefile.in: Rebuild with automake 1.11.1.
7311         * aclocal.m4: Likewise.
7312         * testsuite/Makefile.in: Likewise.
7313
7314 2010-08-19  Ian Lance Taylor  <iant@google.com>
7315
7316         PR 10893
7317         * i386.cc (class Output_data_plt_i386): Update declarations.
7318         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7319         local_ifuncs_ fields.
7320         (Target_i386::do_plt_section_for_global): New function.
7321         (Target_i386::do_plt_section_for_local): New function.
7322         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7323         parameter; change all callers.  Initialize global_ifuncs_ and
7324         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7325         __rel_iplt_end.
7326         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7327         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7328         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7329         symbols.
7330         (Target_i386::make_plt_section): New function, broken out of
7331         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7332         (Target_i386::make_plt_entry): Call make_plt_section.
7333         (Target_i386::make_local_ifunc_plt_entry): New function.
7334         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7335         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7336         R_386_IRELATIVE to switch.
7337         (Target_i386::Scan::global): Likewise.
7338         (Target_i386::Relocate::relocate): Likewise.
7339         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7340         switch.
7341         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7342         (Target_x86_64::do_plt_section_for_global): New function.
7343         (Target_x86_64::do_plt_section_for_local): New function.
7344         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7345         parameter; change all callers.  If doing a static link define
7346         __rela_iplt_start and __rela_iplt_end.
7347         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7348         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7349         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7350         to point to .plt.
7351         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7352         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7353         switch.
7354         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7355         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7356         R_X86_64_IRELATIVE to switch.
7357         (Target_x86_64::Scan::global): Likewise.
7358         (Target_x86_64::Relocate::relocate): Likewise.
7359         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7360         switch.
7361         * target.h (class Target): Add plt_section_for_global and
7362         plt_section_for_local functions.  Add do_plt_section_for_global
7363         and do_plt_section_for_local virtual functions.
7364         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7365         clarifying comments.
7366         (Symbol::use_plt_offset): Handle IFUNC symbol.
7367         * object.cc (Sized_relobj::Sized_relobj): Initialize
7368         local_plt_offsets_.
7369         (Sized_relobj::local_has_plt_offset): New function.
7370         (Sized_relobj::local_plt_offset): New function.
7371         (Sized_relobj::set_local_plt_offset): New function.
7372         (Sized_relobj::do_count): Handle IFUNC symbol.
7373         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7374         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7375         is_ifunc_symbol functions.
7376         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7377         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7378         local_plt_offsets_ field.
7379         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7380         * output.h (class Output_section_data): Add non-const
7381         output_section function.
7382         (class Output_data_got): Update declarations.
7383         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7384         Add use_plt_offset parameter to global and local constructors.
7385         Change all callers.  Change local_sym_index_ field to 31 bits.
7386         Change GSYM_CODE and CONSTANT_CODE accordingly.
7387         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7388         doing a static link don't set sh_link field.
7389         (Output_data_got::Got_entry::write): Use PLT offset if
7390         appropriate.
7391         (Output_data_got::add_global_plt): New function.
7392         (Output_data_got::add_local_plt): New function.
7393         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7394         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7395         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7396         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7397         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7398         IFUNC conditional.
7399         * testsuite/ifunc-sel.h: New file.
7400         * testsuite/ifuncmain1.c: New file.
7401         * testsuite/ifuncmain1vis.c: New file.
7402         * testsuite/ifuncmod1.c: New file.
7403         * testsuite/ifuncdep2.c: New file.
7404         * testsuite/ifuncmain2.c: New file.
7405         * testsuite/ifuncmain3.c: New file.
7406         * testsuite/ifuncmod3.c: New file.
7407         * testsuite/ifuncmain4.c: New file.
7408         * testsuite/ifuncmain5.c: New file.
7409         * testsuite/ifuncmod5.c: New file.
7410         * testsuite/ifuncmain6pie.c: New file.
7411         * testsuite/ifuncmod6.c: New file.
7412         * testsuite/ifuncmain7.c: New file.
7413         * configure, testsuite/Makefile.in: Rebuild.
7414
7415 2010-08-18  Ian Lance Taylor  <iant@google.com>
7416
7417         * incremental.cc
7418         (Output_section_incremental_inputs::write_input_files): Add cast
7419         to avoid signed/unsigned comparison warning.
7420         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7421
7422 2010-08-12  Cary Coutant  <ccoutant@google.com>
7423
7424         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7425
7426 2010-08-13  Ian Lance Taylor  <iant@google.com>
7427
7428         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7429
7430 2010-08-12  Cary Coutant  <ccoutant@google.com>
7431             Doug Kwan  <dougkwan@google.com>
7432
7433         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7434         defintion overrides non-weak undef, remember that the original undef
7435         is not weak.
7436         * symtab.cc (Symbol_table::sized_write_global): For undef without
7437         an original weak binding, set binding to global in output.
7438         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7439         * testsuite/Makefile.in: Regenerate.
7440         * testsuite/strong_ref_weak_def.sh: New file.
7441         * testsuite/strong_ref_weak_def_1.c: Ditto.
7442         * testsuite/strong_ref_weak_def_2.c: Ditto.
7443
7444 2010-08-12  Cary Coutant  <ccoutant@google.com>
7445
7446         * testsuite/incremental_test.sh: Rewrite.
7447         * testsuite/incremental_test_1.c: Rewrite.
7448         * testsuite/incremental_test_2.c: Rewrite.
7449
7450 2010-08-12  Cary Coutant  <ccoutant@google.com>
7451
7452         * arm.cc (Target_arm::got_size): Add const.
7453         (Target_arm::got_entry_count): New function.
7454         (Target_arm::plt_entry_count): New function.
7455         (Target_arm::first_plt_entry_offset): New function.
7456         (Target_arm::plt_entry_size): New function.
7457         (Output_data_plt_arm::entry_count): New function.
7458         (Output_data_plt_arm::first_plt_entry_offset): New function.
7459         (Output_data_plt_arm::get_plt_entry_size): New function.
7460         * i386.cc (Target_i386::got_size): Add const.
7461         (Target_i386::got_entry_count): New function.
7462         (Target_i386::plt_entry_count): New function.
7463         (Target_i386::first_plt_entry_offset): New function.
7464         (Target_i386::plt_entry_size): New function.
7465         (Output_data_plt_i386::entry_count): New function.
7466         (Output_data_plt_i386::first_plt_entry_offset): New function.
7467         (Output_data_plt_i386::get_plt_entry_size): New function.
7468         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7469         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7470         * incremental.cc: Include target.h.
7471         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7472         parameter.  Adjust all callers.  Find incremental_got_plt section.
7473         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7474         section.
7475         (Output_section_incremental_inputs::set_final_data_size): Calculate
7476         size of incremental_got_plt section.
7477         (Output_section_incremental_inputs::do_write): Write the
7478         incremental_got_plt section.
7479         (Got_plt_view_info): New struct.
7480         (Local_got_offset_visitor): New class.
7481         (Global_got_offset_visitor): New class.
7482         (Global_symbol_visitor_got_plt): New class.
7483         (Output_section_incremental_inputs::write_got_plt): New function.
7484         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7485         Add parameter.  Adjust all callers.
7486         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7487         (Incremental_inputs::got_plt_section): New function.
7488         (Incremental_inputs::got_plt_section_): New data member.
7489         (Incremental_got_plt_reader): New class.
7490         * layout.cc (Layout::create_incremental_info_sections): Add the
7491         incremental_got_plt section.
7492         * object.h (Got_offset_list::get_list): New function.
7493         (Got offset_list::for_all_got_offsets): New function.
7494         (Sized_relobj::local_got_offset_list): New function.
7495         * powerpc.cc (Target_powerpc::got_size): Add const.
7496         (Target_powerpc::got_entry_count): New function.
7497         (Target_powerpc::plt_entry_count): New function.
7498         (Target_powerpc::first_plt_entry_offset): New function.
7499         (Target_powerpc::plt_entry_size): New function.
7500         (Output_data_plt_powerpc::entry_count): New function.
7501         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7502         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7503         * sparc.cc (Target_sparc::got_size): Add const.
7504         (Target_sparc::got_entry_count): New function.
7505         (Target_sparc::plt_entry_count): New function.
7506         (Target_sparc::first_plt_entry_offset): New function.
7507         (Target_sparc::plt_entry_size): New function.
7508         (Output_data_plt_sparc::entry_count): New function.
7509         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7510         (Output_data_plt_sparc::get_plt_entry_size): New function.
7511         * symtab.h (Symbol::got_offset_list): New function.
7512         (Symbol_table::for_all_symbols): New function.
7513         * target.h (Sized_target::got_entry_count): New function.
7514         (Sized_target::plt_entry_count): New function.
7515         (Sized_target::plt_entry_size): New function.
7516         * x86_64.cc (Target_x86_64::got_size): Add const.
7517         (Target_x86_64::got_entry_count): New function.
7518         (Target_x86_64::plt_entry_count): New function.
7519         (Target_x86_64::first_plt_entry_offset): New function.
7520         (Target_x86_64::plt_entry_size): New function.
7521         (Output_data_plt_x86_64::entry_count): New function.
7522         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7523         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7524
7525 2010-08-12  Cary Coutant  <ccoutant@google.com>
7526
7527         * archive.cc: Include incremental.h.
7528         (Archive::Archive): Initialize incremental_info_.
7529         (Archive::include_member): Record archive members in incremental info.
7530         (Add_archive_symbols::run): Record begin and end of an archive in
7531         incremental info.
7532         (Lib_group::include_member): Record objects in incremental info.
7533         * archive.h (Incremental_archive_entry): Forward declaration.
7534         (Archive::set_incremental_info): New member function.
7535         (Archive::incremental_info): New member function.
7536         (Archive::Unused_symbol_iterator): New class.
7537         (Archive::unused_symbols_begin): New member function.
7538         (Archive::unused_symbols_end): New member function.
7539         (Archive::incremental_info_): New data member.
7540         * incremental-dump.cc (find_input_containing_global): New function.
7541         (dump_incremental_inputs): Dump new incremental info sections.
7542         * incremental.cc: Include symtab.h.
7543         (Output_section_incremental_inputs): New class.
7544         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7545         new incremental info sections.
7546         (Sized_incremental_binary::do_check_inputs): Likewise.
7547         (Incremental_inputs::report_archive): Remove.
7548         (Incremental_inputs::report_archive_begin): New function.
7549         (Incremental_inputs::report_archive_end): New function.
7550         (Incremental_inputs::report_object): New function.
7551         (Incremental_inputs::finalize_inputs): Remove.
7552         (Incremental_inputs::report_input_section): New function.
7553         (Incremental_inputs::report_script): Rewrite.
7554         (Incremental_inputs::finalize): Do nothing but finalize string table.
7555         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7556         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7557         (Incremental_inputs::create_data_sections): New function.
7558         (Incremental_inputs::relocs_entsize): New function.
7559         (Output_section_incremental_inputs::set_final_data_size): New function.
7560         (Output_section_incremental_inputs::do_write): New function.
7561         (Output_section_incremental_inputs::write_header): New function.
7562         (Output_section_incremental_inputs::write_input_files): New function.
7563         (Output_section_incremental_inputs::write_info_blocks): New function.
7564         (Output_section_incremental_inputs::write_symtab): New function.
7565         * incremental.h (Incremental_script_entry): Forward declaration.
7566         (Incremental_object_entry): Forward declaration.
7567         (Incremental_archive_entry): Forward declaration.
7568         (Incremental_inputs): Forward declaration.
7569         (Incremental_inputs_header_data): Remove.
7570         (Incremental_inputs_header): Remove.
7571         (Incremental_inputs_header_write): Remove.
7572         (Incremental_inputs_entry_data): Remove.
7573         (Incremental_inputs_entry): Remove.
7574         (Incremental_inputs_entry_write): Remove.
7575         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7576         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7577         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7578         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7579         Likewise.
7580         (Incremental_input_entry): New class.
7581         (Incremental_script_entry): New class.
7582         (Incremental_object_entry): New class.
7583         (Incremental_archive_entry): New class.
7584         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7585         (Incremental_inputs::report_inputs): Remove.
7586         (Incremental_inputs::report_archive): Remove.
7587         (Incremental_inputs::report_archive_begin): New function.
7588         (Incremental_inputs::report_archive_end): New function.
7589         (Incremental_inputs::report_object): Change prototype.
7590         (Incremental_inputs::report_input_section): New function.
7591         (Incremental_inputs::report_script): Change prototype.
7592         (Incremental_inputs::get_reloc_count): New function.
7593         (Incremental_inputs::set_reloc_count): New function.
7594         (Incremental_inputs::create_data_sections): New function.
7595         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7596         (Incremental_inputs::inputs_section): New function.
7597         (Incremental_inputs::symtab_section): New function.
7598         (Incremental_inputs::relocs_section): New function.
7599         (Incremental_inputs::get_stringpool): Add const.
7600         (Incremental_inputs::command_line): Add const.
7601         (Incremental_inputs::inputs): Remove.
7602         (Incremental_inputs::command_line_key): New function.
7603         (Incremental_inputs::input_file_count): New function.
7604         (Incremental_inputs::input_files): New function.
7605         (Incremental_inputs::relocs_entsize): New function.
7606         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7607         (Incremental_inputs::finalize_inputs): Remove.
7608         (Incremental_inputs::Input_info): Remove.
7609         (Incremental_inputs::lock_): Remove.
7610         (Incremental_inputs::inputs_): Change type.
7611         (Incremental_inputs::inputs_map_): Remove.
7612         (Incremental_inputs::current_object_entry_): New data member.
7613         (Incremental_inputs::inputs_section_): New data member.
7614         (Incremental_inputs::symtab_section_): New data member.
7615         (Incremental_inputs::relocs_section_): New data member.
7616         (Incremental_inputs::reloc_count_): New data member.
7617         (Incremental_inputs_reader): New class.
7618         (Incremental_symtab_reader): New class.
7619         (Incremental_relocs_reader): New class.
7620         * layout.cc (Layout::finalize): Move finalization of incremental info
7621         and creation of incremental info sections to follow finalization of
7622         symbol table.  Set offsets for postprocessing sections.
7623         (Layout::create_incremental_info_sections): Call
7624         Incremental_inputs::create_data_sections.  Add incremental symtab
7625         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7626         sections to layout after input sections.
7627         * layout.h (struct Timespec): Forward declaration.
7628         (Layout::incremental_inputs): Add const.
7629         (Layout::create_incremental_info_sections): Add parameter.
7630         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7631         * object.cc: Include incremental.h.
7632         (Relobj::finalize_incremental_relocs): New function.
7633         (Sized_relobj::do_layout): Record input sections in incremental info.
7634         * object.h (Object::output_section): New function.
7635         (Object::output_section_offset): Moved from Relobj.
7636         (Object::get_incremental_reloc_base): New function.
7637         (Object::get_incremental_reloc_count): New function.
7638         (Object::do_output_section): New function.
7639         (Object::do_output_section_offset): Moved from Relobj.
7640         (Object::do_get_incremental_reloc_base): New function.
7641         (Object::do_get_incremental_reloc_count): New function.
7642         (Object::Object): Initialize new data members.
7643         (Relobj::output_section): Renamed do_output_section and moved to
7644         protected.
7645         (Relobj::output_section_offset): Moved to Object.
7646         (Relobj::do_get_incremental_reloc_base): New function.
7647         (Relobj::do_get_incremental_reloc_count): New function.
7648         (Relobj::allocate_incremental_reloc_counts): New function.
7649         (Relobj::count_incremental_reloc): New function.
7650         (Relobj::finalize_incremental_relocs): New function.
7651         (Relobj::next_incremental_reloc_index): New function.
7652         (Relobj::reloc_counts_): New data member.
7653         (Relobj::reloc_bases_): New data member.
7654         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7655         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7656         (Sized_relobj::incremental_relocs_scan): New function.
7657         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7658         (Sized_relobj::incremental_relocs_write): New function.
7659         (Sized_relobj::incremental_relocs_write_reltype): New function.
7660         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7661         incremental link.
7662         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7663         archives and object files elsewhere.
7664         (Add_symbols::run): Report object files here.
7665         (Finish_group::run): Report end of archive at end of group.
7666         * reloc.cc: Include layout.h, incremental.h.
7667         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7668         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7669         (Sized_relobj::incremental_relocs_scan): New function.
7670         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7671         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7672         (Sized_relobj::incremental_relocs_write): New function.
7673         (Sized_relobj::incremental_relocs_write_reltype): New function.
7674         * script.cc (read_input_script): Rewrite test for incremental link.
7675         Change call to Incremental_inputs::report_script.
7676         * symtab.h (Symbol_table::first_global_index): New function.
7677         (Symbol_table::output_count): New function.
7678
7679 2010-08-12  Doug Kwan  <dougkwan@google.com>
7680
7681         * arm.cc (Target_arm::merge_object_attributes): Check command line
7682         options --no-wchar-size-warning and --no-enum-size-warning.
7683         * options.h (General_options): Add ld-compatible options
7684         --no-enum-size-warning and --no-wchar-size-warning.
7685
7686 2010-08-04  Ian Lance Taylor  <iant@google.com>
7687
7688         * x86_64.cc (Target_x86_64::Scan::local): Use
7689         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7690         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7691         (Target_x86_64::Scan::global): Likewise.
7692         (Target_x86_64::Relocate::relocate): Likewise.
7693         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7694         Likewise.
7695
7696 2010-08-03  Cary Coutant  <ccoutant@google.com>
7697
7698         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7699         to reserve space in merged_strings vector. Keep total input size
7700         for stats.
7701         (Output_merge_string::do_print_merge_stats): Print total input size.
7702         * merge.h (Output_merge_string): Add input_size_ field.
7703         * stringpool.cc (Stringpool_template::string_length): Move
7704         implementations out of Stringpool_template class and place in
7705         stringpool.h.
7706         * stringpool.h (string_length): Move out of Stringpool_template.
7707
7708 2010-08-03  Ian Lance Taylor  <iant@google.com>
7709
7710         PR 11712
7711         * layout.cc (relaxation_loop_body): If address of load segment is
7712         set, adjust address to include headers if possible.
7713
7714 2010-08-03  Ian Lance Taylor  <iant@google.com>
7715
7716         * version.cc (version_string): Bump to 1.10.
7717
7718 2010-08-03  Ian Lance Taylor  <iant@google.com>
7719
7720         PR 11805
7721         * layout.h (enum Output_section_order): Define.
7722         (class Layout): Update declarations.
7723         * layout.cc (Layout::get_output_section): Add order parameter.
7724         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7725         is_first_non_relro parameters.  Change all callers.
7726         (Layout::choose_output_section): Likewise.
7727         (Layout::add_output_section_data): Likewise.
7728         (Layout::make_output_section): Likewise.  Set order.
7729         (Layout::default_section_order): New function.
7730         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7731         * output.cc (Output_section::Output_section): Initialize order_.
7732         Don't initialize deleted fields.
7733         (Output_segment::Output_segment): Don't initialize deleted
7734         fields.
7735         (Output_segment::add_output_section_to_load): New function
7736         replacing add_output_section.  Change all callers to call this or
7737         add_output_section_to_nonload.
7738         (Output_segment::add_output_section_to_nonload): New function.
7739         (Output_segment::remove_output_section): Rewrite.
7740         (Output_segment::add_initial_output_data): Likewise.
7741         (Output_segment::has_any_data_sections): Likewise.
7742         (Output_segment::is_first_section_relro): Likewise.
7743         (Output_segment::maximum_alignment): Likewise.
7744         (Output_segment::has_dynamic_reloc): New function replacing
7745         dynamic_reloc_count.  Change all callers.
7746         (Output_segment::has_dynamic_reloc_list): New function replacing
7747         dynamic_reloc_count_list.  Change all callers.
7748         (Output_segment::set_section_addresses): Rewrite.
7749         (Output_segment::set_offset): Rewrite.
7750         (Output_segment::find_first_and_last_list): Remove.
7751         (Output_segment::set_tls_offsets): Rewrite.
7752         (Output_segment::first_section_load_address): Likewise.
7753         (Output_segment::output_section_count): Likewise.
7754         (Output_segment::section_with_lowest_load_address): Likewise.
7755         (Output_segment::write_section_headers): Likewise.
7756         (Output_segment::print_sections_to_map): Likewise.
7757         * output.h (class Output_data): Remove dynamic_reloc_count_
7758         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7759         (Output_data::add_dynamic_reloc): Rewrite.
7760         (Output_data::has_dynamic_reloc): New function.
7761         (Output_data::dynamic_reloc_count): Remove.
7762         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7763         is_last_relro_, is_first_non_relro_, is_interp_,
7764         is_dynamic_linker_section_ fields.  Add order and set_order
7765         functions.  Remove is_relro_local, set_is_relro_local,
7766         is_last_relro, set_is_last_relro, is_first_non_relro,
7767         set_is_first_non_relro functions, is_interp, set_is_interp,
7768         is_dynamic_linker_section, and set_is_dynamic_linker_section
7769         functions.
7770         (class Output_segment): Change Output_data_list from std::list to
7771         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7772         output_bss_ fields.  Update declarations.
7773
7774 2010-08-02  Ian Lance Taylor  <iant@google.com>
7775
7776         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7777         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7778         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7779
7780 2010-08-02  Ian Lance Taylor  <iant@google.com>
7781
7782         PR 11855
7783         * script.cc (Script_options::Script_options): Initialize
7784         symbol_definitions_ and symbol_references_.
7785         (Script_options::add_symbol_assignment): Update
7786         symbol_definitions_ and symbol_references_.
7787         (Script_options::add_symbol_reference): New function.
7788         (script_symbol): New function.
7789         * script.h (class Script_options): Add symbol_definitions_ and
7790         symbol_references_ fields.
7791         (Script_options::referenced_const_iterator): New type.
7792         (Script_options::referenced_begin): New function.
7793         (Script_options::referenced_end): New function.
7794         (Script_options::is_referenced): New function.
7795         (Script_options::any_unreferenced): New function.
7796         * script-c.h (script_symbol): Declare.
7797         * yyscript.y (exp): Call script_symbol.
7798         * symtab.cc: Include "script.h".
7799         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7800         Change all callers.  Check symbols referenced by scripts.
7801         (Symbol_table::add_undefined_symbols_from_command_line): Add
7802         layout parameter.  Change all callers.
7803         (Symbol_table::do_add_undefined_symbols_from_command_line):
7804         Likewise.  Break out loop body.  Check symbols referenced by
7805         scripts.
7806         (Symbol_table::add_undefined_symbol_from_command_line): New
7807         function broken out of
7808         do_add_undefined_symbols_from_command_line.
7809         * symtab.h (class Symbol_table): Update declarations.
7810         * archive.cc: Include "layout.h".
7811         (Archive::should_include_member): Add layout parameter.  Change
7812         all callers.  Check for symbol mentioned in expression.
7813         * archive.h (class Archive): Update declaration.
7814         * object.cc (Sized_relobj::do_should_include_member): Add layout
7815         parameter.
7816         * object.h (Object::should_include_member): Add layout parameter.
7817         Change all callers.
7818         (Object::do_should_include_member): Add layout parameter.
7819         (class Sized_relobj): Update declaration.
7820         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7821         parameter.
7822         * dynobj.h (class Sized_dynobj): Update declaration.
7823         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7824         layout parameter.
7825         * plugin.h (class Sized_pluginobj): Update declaration.
7826
7827 2010-08-02  Ian Lance Taylor  <iant@google.com>
7828
7829         PR 11866
7830         * output.cc (Output_segment::set_offset): Search for the first and
7831         last sections rather than assuming that the list is in order.
7832         (Output_segment::find_first_and_last_list): New function.
7833         * output.h (class Output_segment): Update declarations.
7834         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7835         (relro_strip_test_SOURCES): New variable.
7836         (relro_strip_test_DEPENDENCIES): New variable.
7837         (relro_strip_test_LDFLAGS): New variable.
7838         (relro_strip_test_LDADD): New variable.
7839         (relro_strip_test.so): New target.
7840
7841 2010-08-02  Ian Lance Taylor  <iant@google.com>
7842
7843         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7844         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7845         (Target_i386::got_tlsdesc_section): New function.
7846         (Target_i386::got_section): Create space for GOT entries for
7847         TLSDESC relocations.
7848         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7849         R_386_TLS_GOTDESC.
7850         (Target_i386::Scan::global): Likewise.
7851         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7852         using TLSDESC GOT.
7853         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7854         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7855         (Target_x86_64::got_tlsdesc_section): New function.
7856         (Target_x86_64::got_section): Create space for GOT entries for
7857         TLSDESC relocations.
7858         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7859         R_386_TLS_GOTDESC.
7860         (Target_x86_64::Scan::global): Likewise.
7861         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7862         using TLSDESC GOT.
7863
7864 2010-08-02  Ian Lance Taylor  <iant@google.com>
7865
7866         * testsuite/final_layout.sh: Use dc to convert from hex to
7867         decimal.
7868
7869 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7870
7871         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7872         paramter to the call to gold::gc_process_relocs.
7873         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7874         paramter to the call to gold::gc_process_relocs.
7875         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7876         parameter to the call to gold::gc_process_relocs.
7877         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7878         template parameter to the call to gold::gc_process_relocs.
7879         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7880         paramter to the call to gold::gc_process_relocs.
7881         * gc.h (get_embedded_addend_size): New function.
7882         (gc_process_relocs): Save the size of the reloc for use by ICF.
7883         * icf.cc (get_section_contents): Get the addend from the text section
7884         for SHT_REL relocation sections.
7885         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7886         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7887         * int_encoding.h (read_from_pointer): New overloaded function.
7888         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7889         * testsuite/icf_sht_rel_addend_test.sh: New file.
7890         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7891         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7892
7893 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7894
7895         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7896         * Makefile.in: Regenerate.
7897         * testsuite/Makefile.in: Regenerate.
7898
7899 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7900
7901         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7902         * gold/testsuite/debug_msg.cc: Likewise.
7903         * gold/testsuite/odr_violation1.cc
7904         * gold/testsuite/odr_violation2.cc
7905
7906 2010-07-21  Cary Coutant  <ccoutant@google.com>
7907
7908         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7909         string, and length fields.
7910         (Output_merge_string::Merged_strings_list): New type.
7911         (Output_merge_string::Merged_strings_lists): New typedef.
7912         (Output_merge_string): Replace merged_strings_ with
7913         merged_strings_lists_.
7914         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7915         Merged_strings_list per input object and section.  Don't store pointer
7916         to the string.  Don't store length with each merged string entry.
7917         (Output_merge_string::finalize_merged_data): Loop over list of merged
7918         strings lists.  Recompute length of each merged string.
7919
7920 2010-07-15  Cary Coutant  <ccoutant@google.com>
7921
7922         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7923         here.
7924
7925 2010-07-14  Ian Lance Taylor  <iant@google.com>
7926
7927         * descriptors.cc (Descriptors::open): Report correct name in error
7928         message.
7929
7930 2010-07-13  Doug Kwan  <dougkwan@google.com>
7931
7932         * arm.cc (Arm_input_section::Arm_input_section): For a
7933         SHT_ARM_EXIDX section, always keeps the input sections.
7934         (Arm_input_section::set_exidx_section_link): New method.
7935         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7936         has_errors_ to false.
7937         (Arm_exidx_input_section::has_errors,
7938         Arm_exidx_input_section::set_has_errors): New methods.
7939         (Arm_exidx_input_section::has_errors_): New data member.
7940         (Arm_relobj::get_exidx_shndx_list): New method.
7941         (Arm_output_section::append_text_sections_to_list): Do not skip
7942         section without SHF_EXECINSTR.
7943         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7944         errors.
7945         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7946         section header.  Make error messages more verbose.  Check for
7947         a non-executable section linked to an EXIDX section.
7948         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7949         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7950         check that there is no deferred EXIDX section if we exit early.
7951         Instead of not making an EXIDX section in case of an error, make one
7952         and set the has_errors flag of it.
7953         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7954         in a relocatable link.
7955         (Target_arm::do_relax): Look for the EXIDX output section instead of
7956         assuming that it is called .ARM.exidx.
7957         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7958         section list.  Do not check for SHF_EXECINSTR section flags but
7959         skip any input section with errors.
7960         * output.cc (Output_section::Output_section): Initialize
7961         always_keeps_input_sections_ to false.
7962         (Output_section::add_input_section): Check for
7963         always_keeps_input_sections_.
7964         *  output.h (Output_section::always_keeps_input_sections,
7965         Output_section::set_always_keeps_input_sections): New methods.
7966         (Output_section::always_keeps_input_sections): New data member.
7967
7968 2010-07-13  Rafael Espindola  <espindola@google.com>
7969
7970         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7971         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7972
7973 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7974             Ian Lance Taylor  <iant@google.com>
7975
7976         * output.h (Output_section_lookup_maps::add_merge_section):
7977         Correct check of whether value was inserted.
7978         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7979         (Output_section_lookup_maps::add_relaxed_input_section):
7980         Likewise.
7981         * arm.cc (Target_arm::got_section): Remove used local os.
7982         * i386.cc (Target_i386::got_section): Likewise.
7983         * x86_64.cc (Target_x86_64::got_section): Likewise.
7984         * sparc.cc (Target_sparc::got_section): Likewise.
7985         (Target_sparc::relocate): Remove unused local have_got_offset.
7986         * powerpc.cc (Target_powerpc::relocate): Likewise.
7987
7988 2010-07-13  Ian Lance Taylor  <iant@google.com>
7989
7990         * compressed_output.cc (zlib_decompress): Fix signature in
7991         !HAVE_ZLIB_H case.
7992
7993         * archive.cc (Archive::include_member): Unlock an external member
7994         of a thin archive.  Don't bother to delete an object we know is
7995         NULL.
7996
7997 2010-07-12  Cary Coutant  <ccoutant@google.com>
7998
7999         * compressed_output.cc (zlib_decompress): New function.
8000         (get_uncompressed_size): New function.
8001         (decompress_input_section): New function.
8002         * compressed_output.h (get_uncompressed_size): New function.
8003         (decompress_input_section): New function.
8004         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8005         Handle compressed debug sections.
8006         * layout.cc (is_compressed_debug_section): New function.
8007         (Layout::output_section_name): Map compressed section names to
8008         canonical names.
8009         * layout.h (is_compressed_debug_section): New function.
8010         (is_debug_info_section): Recognize compressed debug sections.
8011         * merge.cc: Include compressed_output.h.
8012         (Output_merge_data::do_add_input_section): Handle compressed
8013         debug sections.
8014         (Output_merge_string::do_add_input_section): Handle compressed
8015         debug sections.
8016         * object.cc: Include compressed_output.h.
8017         (Sized_relobj::Sized_relobj): Initialize new data members.
8018         (build_compressed_section_map): New function.
8019         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8020         * object.h (Object::section_is_compressed): New method.
8021         (Object::do_section_is_compressed): New method.
8022         (Sized_relobj::Compressed_section_map): New type.
8023         (Sized_relobj::do_section_is_compressed): New method.
8024         (Sized_relobj::compressed_sections_): New data member.
8025         * output.cc (Output_section::add_input_section): Handle compressed
8026         debug sections.
8027         * reloc.cc: Include compressed_output.h.
8028         (Sized_relobj::write_sections): Handle compressed debug sections.
8029
8030 2010-07-08  Cary Coutant  <ccoutant@google.com>
8031
8032         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8033         weak when resolving to a dynamic def.
8034         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8035         for weak undef/dynamic def cases. Adjust callers.
8036         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8037         undef_binding_weak_.
8038         (Symbol_table::sized_write_globals): Adjust symbol binding.
8039         (Symbol_table::sized_write_symbol): Add binding parameter.
8040         * symtab.h (Symbol::set_undef_binding): New method.
8041         (Symbol::is_undef_binding_weak): New method.
8042         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8043         (Symbol_table::should_override): Add new parameter.
8044         (Symbol_table::sized_write_symbol): Add new parameter.
8045
8046         * testsuite/weak_undef_file1.cc: Add new test case.
8047         * testsuite/weak_undef_file2.cc: Fix header comment.
8048         * testsuite/weak_undef_test.cc: Add new test case.
8049
8050 2010-06-29  Doug Kwan  <dougkwan@google.com>
8051
8052         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8053         Initialize USE_SYMBOL_.
8054         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8055         definition.
8056         (Arm_reloc_property::uses_symbol_): New data member declaration.
8057         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8058         uses symbol value and symbol is undefined but not weakly undefined.
8059
8060 2010-06-28  Rafael Espindola  <espindola@google.com>
8061
8062         * plugin.cc (Plugin::load): Use dlerror.
8063
8064 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8065
8066         * symtab.cc (detect_odr_violations): When reporting an ODR
8067         violation, report an object where the symbol is defined.
8068
8069 2010-06-25  Doug Kwan  <dougkwan@google.com>
8070
8071         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8072         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8073         definition.
8074         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8075         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8076         target hook to detect function points.
8077         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8078         * icf.h (Icf::check_section_for_function_pointers): Change type of
8079         parameter SECTION_NAME to const reference to std::string.  Use
8080         target hook to determine if section may have unsafe pointers.
8081         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8082         method definition.
8083
8084 2010-06-21  Rafael Espindola  <espindola@google.com>
8085
8086         * fileread.cc (Input_file::find_fie): New
8087         (Input_file::open): Use Input_file::find_fie.
8088         * fileread.h (Input_file::find_fie): New
8089         * plugin.cc (set_extra_library_path): New.
8090         (Plugin::load): Add set_extra_library_path to the transfer vector.
8091         (Plugin_manager::set_extra_library_path): New.
8092         (Plugin_manager::add_input_file): Use the extra search path if set.
8093         (set_extra_library_path(): New.
8094         * plugin.h (Plugin_manager): Add set_extra_library_path and
8095         extra_search_path_.
8096
8097 2010-06-19  Cary Coutant  <ccoutant@google.com>
8098
8099         * layout.cc (gdb_sections): Add .debug_types.
8100         (lines_only_debug_sections): Likewise.
8101
8102 2010-06-18  Rafael Espindola  <espindola@google.com>
8103
8104         * plugin.cc (add_input_file,add_input_library)
8105         (Plugin_manager::add_input_file): Make filename arguments const.
8106         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8107         const.
8108
8109 2010-06-16  Doug Kwan  <dougkwan@google.com>
8110
8111         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8112         .ARM.attributes section if we have not merged any input
8113         attributes sections.
8114
8115 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8116
8117         * arm.cc: Allow combining objects with no EABI version
8118         information.
8119
8120 2010-06-15  Rafael Espindola  <espindola@google.com>
8121
8122         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8123
8124 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8125
8126         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8127         (struct iovec): Correct !HAVE_READV definition.
8128
8129 2010-06-10  Cary Coutant  <ccoutant@google.com>
8130
8131         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8132         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8133         reloc sections.
8134         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8135
8136         PR 11683
8137         * symtab.h (Symbol::is_placeholder): New member function.
8138         * target-reloc.h (relocate_section): Check for placeholder symbols.
8139
8140         * testsuite/Makefile.am (plugin_test_8): New test.
8141         (plugin_test_9): New test.
8142         * testsuite/Makefile.in: Regenerate.
8143
8144 2010-06-09  Nick Clifton  <nickc@redhat.com>
8145
8146         * yyscript.y (input_list_element): Allow strings prefixed with
8147         the '-' character.  Treat these as libraries.
8148         * script.cc (script_add_library): New function.  Adds a library
8149         specified by "-l<name>" found in an input script.
8150         * script-c.h: Add prototype for script_add_library.
8151
8152 2010-06-07  Doug Kwan  <dougkwan@google.com>
8153
8154         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8155         Restrict stub-group size to be within long conditional branch
8156         range when working around cortex-A8 erratum.
8157
8158 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8159
8160         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8161         #ifdef typo.
8162
8163 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8164
8165         PR gold/11658
8166         * output.cc
8167         (Output_section::Input_section_sort_entry::compare_section_ordering):
8168         Change to return non-zero correctly.
8169         (Output_section::Input_section_sort_section_order_index_compare
8170         ::operator()): Change to fix ambiguity in comparisons.
8171
8172 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8173
8174         * gold.h (is_wildcard_string): New function.
8175         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8176         (Layout::layout_eh_frame): Ditto.
8177         (Layout::find_section_order_index): New method.
8178         (Layout::read_layout_from_file): New method.
8179         * layout.h (Layout::find_section_order_index): New method.
8180         (Layout::read_layout_from_file): New method.
8181         (Layout::input_section_position_): New private member.
8182         (Layout::input_section_glob_): New private member.
8183         * main.cc (main): Call read_layout_from_file here.
8184         * options.h (--section-ordering-file): New option.
8185         * output.cc (Output_section::input_section_order_specified_): New
8186         member.
8187         (Output_section::Output_section): Initialize new member.
8188         (Output_section::add_input_section): Add new parameter.
8189         Keep input sections when --section-ordering-file is used.
8190         (Output_section::set_final_data_size): Sort input sections when
8191         section ordering file is specified.
8192         (Output_section::Input_section_sort_entry): Add new parameter.
8193         Check sorting type.
8194         (Output_section::Input_section_sort_entry::compare_section_ordering):
8195         New method.
8196         (Output_section::Input_section_sort_compare::operator()): Change to
8197         consider section_order_index.
8198         (Output_section::Input_section_sort_init_fini_compare::operator()):
8199         Change to consider section_order_index.
8200         (Output_section::Input_section_sort_section_order_index_compare
8201         ::operator()): New method.
8202         (Output_section::sort_attached_input_sections): Change to sort
8203         according to section order when specified.
8204         (Output_section::add_input_section<32, true>): Add new parameter.
8205         (Output_section::add_input_section<64, true>): Add new parameter.
8206         (Output_section::add_input_section<32, false>): Add new parameter.
8207         (Output_section::add_input_section<64, false>): Add new parameter.
8208         * output.h (Output_section::add_input_section): Add new parameter.
8209         (Output_section::input_section_order_specified): New
8210         method.
8211         (Output_section::set_input_section_order_specified): New method.
8212         (Input_section::Input_section): Initialize section_order_index_.
8213         (Input_section::section_order_index): New method.
8214         (Input_section::set_section_order_index): New method.
8215         (Input_section::section_order_index_): New member.
8216         (Input_section::Input_section_sort_section_order_index_compare): New
8217         struct.
8218         (Output_section::input_section_order_specified_): New member.
8219         * script-sections.cc (is_wildcard_string): Delete and move modified
8220         method to gold.h.
8221         (Output_section_element_input::Output_section_element_input): Modify
8222         call to is_wildcard_string.
8223         (Output_section_element_input::Input_section_pattern
8224         ::Input_section_pattern): Ditto.
8225         (Output_section_element_input::Output_section_element_input): Ditto.
8226         * testsuite/Makefile.am (final_layout): New test case.
8227         * testsuite/Makefile.in: Regenerate.
8228         * testsuite/final_layout.cc: New file.
8229         * testsuite/final_layout.sh: New file.
8230
8231 2010-06-01  Rafael Espindola  <espindola@google.com>
8232
8233         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8234
8235 2010-06-01  Rafael Espindola  <espindola@google.com>
8236
8237         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8238         visibility of symbols.
8239
8240 2010-05-27  Doug Kwan  <dougkwan@google.com>
8241
8242         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8243         from start of output section instead of address for a local symbol
8244         in a merged or relaxed section when doing a relocatable link.
8245
8246 2010-05-26  Rafael Espindola  <espindola@google.com>
8247
8248         PR 11604
8249         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8250         adding sections the garbage collector removed.
8251         * gold/testsuite/Makefile.am: Add test.
8252         * gold/testsuite/Makefile.in: Regenerate.
8253         * gold/testsuite/plugin_test_7.sh: New.
8254         * gold/testsuite/plugin_test_7_1.c: New.
8255         * gold/testsuite/plugin_test_7_2.c: New.
8256
8257 2010-05-26  Rafael Espindola  <espindola@google.com>
8258
8259         * script-sections.cc (Output_section_definition::set_section_addresses):
8260         Check for --section-start.
8261
8262 2010-05-26  Doug Kwan  <dougkwan@google.com>
8263
8264         * arm.cc (Arm_scan_relocatable_relocs): New class.
8265         (Target_arm::relocate_special_relocatable): New method.
8266         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8267         (Arm_relocate_functions::thumb_branch_common): Same.
8268         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8269         instead of Default_scan_relocatable_relocs.
8270         * target-reloc.h (relocate_for_relocatable): Let target handle
8271         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8272         * target.h (Sized_target::relocate_special_relocatable): New method.
8273
8274 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8275
8276         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8277
8278 2010-05-23  Doug Kwan  <dougkwan@google.com>
8279
8280         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8281         instead of a cast.
8282         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8283         with a direct branch, not a conditional branch, to a stub.
8284         * merge.cc (Output_merge_base::record_input_section): New method
8285         defintion.
8286         (Output_merge_data::do_add_input_section): Record input section if
8287         keeps-input-sections flag is set.
8288         (Output_merge_string::do_add_input_section): Ditto.
8289         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8290         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8291         INPUT_SECTIONS_.
8292         (Output_merge_base::keeps_input_sections,
8293         Output_merge_base::set_keeps_input_sections,
8294         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8295         method definitions.
8296         (Output_merge_base::Input_sections): New type declaration.
8297         (Output_merge_base::input_sections_begin,
8298         Output_merge_base::input_sections_end,
8299         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8300         (Output_merge_base::bool keeps_input_sections_,
8301         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8302         Output_merge_base::input_sections_): New data members.
8303         (Output_merge_data::do_set_keeps_input_sections): New method
8304         defintion.
8305         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8306         * output.cc (Output_section::Input_section::relobj): Move method
8307         defintion from class declaration to here and handle merge sections.
8308         (Output_section::Input_section::shndx): Ditto.
8309         (Output_section::Output_section): Remove initializations of removed
8310         data members and initialize new data member LOOKUP_MAPS_.
8311         (Output_section::add_input_section): Set keeps-input-sections flag
8312         for a newly created merge output section as appropriate.  Adjust code
8313         to use Output_section_lookup_maps class.
8314         (Output_section::add_relaxed_input_section): Adjst code for lookup
8315         maps code refactoring.
8316         (Output_section::add_merge_input_section): Add a new parameter
8317         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8318         class.  If adding input section to a newly created merge output
8319         section fails, remove the new merge section.
8320         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8321         Adjust code for use of the Output_section_lookup_maps class.
8322         (Output_section::find_merge_section): Ditto.
8323         (Output_section::build_lookup_maps): New method defintion.
8324         (Output_section::find_relaxed_input_section): Adjust code to use
8325         Output_section_lookup_maps class.
8326         (Output_section::get_input_sections): Export merge sections.  Adjust
8327         code to use Output_section_lookup_maps class.
8328         (Output_section:::add_script_input_section): Adjust code to use
8329         Output_section_lookup_maps class.  Update lookup maps for merge
8330         sections also.
8331         (Output_section::discard_states): Use Output_section_lookup_maps.
8332         (Output_section::restore_states): Same.
8333         * output.h (Merge_section_properties): Move class defintion out of
8334         Output_section.
8335         (Output_section_lookup_maps): New class.
8336         (Output_section::Input_section::is_merge_section): New method
8337         defintion.
8338         (Output_section::Input_section::relobj): Move defintion out of class
8339         defintion.  Declare method only.
8340         (Output_section::Input_section::shndx): Ditto.
8341         (Output_section::Input_section::output_merge_base): New method defintion.
8342         (Output_section::Input_section::u2_.pomb): New union field.
8343         (Output_section::Merge_section_by_properties_map,
8344         Output_section::Output_section_data_by_input_section_map,
8345         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8346         Remove types.
8347         (Output_section::add_merge_input_section): Add new parameter
8348         KEEPS_INPUT_SECTIONS.
8349         (Output_section::build_lookup_maps): New method declaration.
8350         (Output_section::merge_section_map_,
8351         Output_section::merge_section_by_properties_map_,
8352         Output_section::relaxed_input_section_map_,
8353         Output_section::is_relaxed_input_section_map_valid_): Remove data
8354         members.
8355         (Output_section::lookup_maps_): New data member.
8356
8357 2010-05-21  Doug Kwan  <dougkwan@google.com>
8358
8359         PR gold/11619
8360         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8361         avoid a compilation error.
8362
8363 2010-05-19  Rafael Espindola  <espindola@google.com>
8364
8365         * script-sections.cc (Output_section_definition::allocate_to_segment):
8366         Update the phdrs_list even when the output section is NULL.
8367         * testsuite/Makefile.am: Add test.
8368         * testsuite/Makefile.in: Regenerate.
8369         * testsuite/script_test_9.cc: New.
8370         * testsuite/script_test_9.sh: New.
8371         * testsuite/script_test_9.t: New.
8372
8373 2010-05-19  Doug Kwan  <dougkwan@google.com>
8374
8375         * arm.cc (Arm_input_section::original_size): New method.
8376         (Arm_input_section::do_addralign): Add a cast.
8377         (Arm_input_section::do_output_offset): Remove static cast.
8378         (Arm_input_section::original_addralign,
8379          Arm_input_section::original_size_): Change type to uint32_t.
8380         (Arm_input_section::init): Add safe casts for section alignment
8381         and size.
8382         (Arm_input_section::set_final_data_size): Do not set address and
8383         offset of stub table.
8384         (Arm_output_section::fix_exidx_coverage): Change use of of
8385         Output_section::Simple_input_section to that of
8386         Output_section::Input_section.
8387         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8388         except for the first pass.
8389         * output.cc (Output_section::get_input_sections): Change type of
8390         input_sections to std::list<Input_section>.
8391         (Output_section::add_script_input_section): Rename from
8392         Output_section::add_simple_input_section.  Change type of SIS
8393         parameter from Simple_input_section to Input_section.
8394         * output.h (Output_section::Simple_input_section): Remove class.
8395         (Output_section::Input_section): Change class visibility to public.
8396         (Output_section::Input_section::addralign): Use stored alignments
8397         for special input sections if set.
8398         (Output_section::Input_section::set_addralign): New method.
8399         (Output_section::get_input_sections): Change parameter type from
8400         list of Simple_input_section to list of Input_section.
8401         (Output_section::add_script_input_section): Rename from
8402         Output_section::add_simple_input_section. Change first parameter's
8403         type from Simple_input_section to Input_section and remove the
8404         second and third parameters.
8405         * script-sections.cc (Input_section::Input_section_list): Change
8406         type to list of Output_section::Input_section/
8407         (Input_section_info::Input_section_info): Change parameter type of
8408         INPUT_SECTION to Output_section::Input_section.
8409         (Input_section_info::input_section): Change return type.
8410         (Input_section_info::input_section_): Change type to
8411         Output_section::Input_section.
8412         (Output_section_element_input::set_section_addresses): Adjust code
8413         to use Output_section::Input_section instead of
8414         Output_section::Simple_input_section.  Adjust code for renaming
8415         of Output_section::add_simple_input_section.
8416         (Orphan_output_section::set_section_addresses): Ditto.
8417
8418 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8419
8420         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8421         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8422
8423 2010-05-18  Rafael Espindola  <espindola@google.com>
8424
8425         * options.cc (General_options::finalize): Handle -nostdlib.
8426         * options.h (nostdlib): New option.
8427         * script.cc (script_add_search_dir): Handle -nostdlib.
8428
8429 2010-05-12  Doug Kwan  <dougkwan@google.com>
8430
8431         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8432         attributes section only if there no attributes section after merging.
8433         (Target_arm::merge_object_attributes): Move value of
8434         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8435         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8436         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8437         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8438         and arm_attr_merge_7.stdout.
8439         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8440         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8441         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8442         arm_attr_merge_7b.o): New rules.
8443         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8444         arm_attr_merge_7
8445         * testsuite/Makefile.in: Regenerate.
8446         * testsuite/arm_attr_merge.sh: New file.
8447         * testsuite/arm_attr_merge_[67][ab].s: Same.
8448
8449 2010-05-05  Nick Clifton  <nickc@redhat.com>
8450
8451         * po/es.po: Updated Spanish translation.
8452
8453 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8454
8455         * Makefile.am (install-exec-local): Properly install gold as
8456         default cross linker.
8457         * Makefile.in: Regenerated.
8458
8459 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8460             Nick Clifton  <nickc@redhat.com>
8461
8462         * configure.ac (install_as_default): Define and set to false
8463         unless --enable-gold or --enable-gold=both/gold has been
8464         specified.
8465         * configure: Regenerate.
8466
8467         * Makefile.am (install-exec-local): Install the executable as
8468         'ld.gold'.  If install_as_default is true then also install it as
8469         'ld'.
8470         * Makefile.in: Regenerated.
8471
8472 2010-04-24  Ian Lance Taylor  <iant@google.com>
8473
8474         * layout.cc (Layout::layout_reloc): In relocatable link don't
8475         combine reloc sections for grouped sections.
8476
8477 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8478
8479         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8480         sections that are not ordinary to icf.
8481         * icf.cc (get_section_contents): Handle relocation pointing to section
8482         with no object or shndx information.
8483         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8484         * testsuite/Makefile.in: Regenerate.
8485         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8486         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8487
8488 2010-04-22  Ian Lance Taylor  <iant@google.com>
8489
8490         * expression.cc (Expression::Expression_eval_info): Add
8491         result_alignment_pointer field.
8492         (Expression::eval_with_dot): Add result_alignment_pointer
8493         parameter.  Change all callers.
8494         (Expression::eval_maybe_dot): Likewise.
8495         (class Binary_expression): Add alignment_pointer parameter to
8496         left_value and right_value.  Change all callers.
8497         (BINARY_EXPRESSION): Set result alignment.
8498         (class Trinary_expression): Add alignment_pointer parameter to
8499         arg2_value and arg3_value.  Change all callers.
8500         (Trinary_cond::value): Set result alignment.
8501         (Max_expression::value, Min_expression::value): Likewise.
8502         (Align_expression::value): Likewise.
8503         * script-sections.cc (class Sections_element): Add dot_alignment
8504         parameter to set_section_addresses virtual function.  Update
8505         instantiations.
8506         (class Output_section_element): Likewise.
8507         (Script_sections::create_segments): Add dot_alignment parameter.
8508         Change all callers.
8509         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8510         (Script_sections::set_phdrs_clause_addresses): Likewise.
8511         * script-sections.h: Update declarations.
8512         * script.h: Update declarations.
8513         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8514         min_p_align.
8515         * testsuite/script_test_3.t: Set large alignment.
8516         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8517         segment has expected alignment.
8518
8519 2010-04-22  Nick Clifton  <nickc@redhat.com>
8520
8521         * po/gold.pot: Updated by the Translation project.
8522         * po/vi.po: Updated Vietnamese translation.
8523
8524 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8525
8526         * testsuite/Makefile.am (check_PROGRAMS): Add
8527         icf_virtual_function_folding_test.
8528         * testsuite/Makefile.in: Regenerated.
8529
8530 2010-04-15  Andrew Haley  <aph@redhat.com>
8531
8532         * options.h (merge_exidx_entries): New option.
8533         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8534         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8535         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8536         (Target_arm::merge_exidx_entries): New function.
8537         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8538         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8539         to Arm_exidx_fixup constructor.
8540         Add new arg, merge_exidx_entries.
8541         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8542         Arm_output_section::fix_exidx_coverage.
8543
8544 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8545
8546         * icf.cc (get_section_contents): Check for preemptible functions.
8547         Ignore addend when appropriate.
8548         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8549         section folded.
8550         (add_from_relobj): Check for section folded.
8551         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8552         * symtab.h (should_add_dynsym_entry): Add new parameter.
8553         * target-reloc.h (scan_relocs): Check for section folded.
8554         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8555         Check reloc types for function pointers in shared objects.
8556         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8557         case.
8558         (icf_preemptible_functions_test): New test case.
8559         (icf_string_merge_test): New test case.
8560         * testsuite.Makefile.in: Regenerate.
8561         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8562         bar_glob.  Refactor code.
8563         * testsuite/icf_preemptible_functions_test.cc: New file.
8564         * testsuite/icf_preemptible_functions_test.sh: New file.
8565         * testsuite/icf_string_merge_test.cc: New file.
8566         * testsuite/icf_string_merge_test.sh: New file.
8567         * testsuite/icf_virtual_function_folding_test.cc: New file.
8568         * testsuite/icf_virtual_function_folding_test.sh: New file.
8569
8570 2010-04-14  Doug Kwan  <dougkwan@google.com>
8571
8572         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8573         for local symbol recounting if we remove a section due to ICF.
8574         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8575         there are no regular objects in input.
8576
8577 2010-04-13  Doug Kwan  <dougkwan@google.com>
8578
8579         * arm.cc (Arm_input_section::set_final_data_size): Compute
8580         accurate final data size instead of using current data size.
8581
8582 2010-04-09  Doug Kwan  <dougkwan@google.com>
8583
8584         * layout.cc (Layout::choose_output_section): Handle script section
8585         types.
8586         (Layout::make_output_section_for_script): Add section type parameter.
8587         Handle script section types.
8588         * layout.h (Layout::make_output_section_for_script): Add section
8589         type parameter.
8590         * output.cc (Output_section::Output_section): Initialize data member
8591         is_noload_.
8592         (Output_section::do_reset_address_and_file_offset): Do not set address
8593         to 0 if section is a NOLOAD section.
8594         * output.h (Output_section::is_noload): New method.
8595         (Output_section::set_is_noload): Ditto.
8596         (Output_section::is_noload_): New data member.
8597         * script-c.h (Script_section_type): New enum type.
8598         (struct Parser_output_section_header): Add new file section_type.
8599         * script-sections.cc (Sections_element::output_section_name): Add
8600         parameter for returning script section type.
8601         (Output_section_definition::output_section_name): Ditto.
8602         (Output_section_definition::section_type)P; New method.
8603         (Output_section_definiton::script_section_type_name): Ditto.
8604         (Output_section_definition::script_section_type_): New data member.
8605         (Output_section_definition::Output_section_definition): Initialize
8606         data member Output_section_definition::script_section_type_.
8607         (Output_section_definition::create_sections): Pass script section type
8608         to Layout::make_output_section_for_script.
8609         (Output_section_definition::output_section_name): Return script
8610         section type to caller.
8611         (Output_section_definition::set_section_address): Do not advance
8612         dot value and load address if section type is NOLOAD.  Set address
8613         of NOLOAD sections regardless of section flags.
8614         (Output_section_definition::print): Print section type if it is
8615         not SCRIPT_SECTION_TYPE_NONE.
8616         (Output_section_definition::section_type): New method.
8617         (Output_section_definition::script_section_type_name): Ditto.
8618         (Script_sections::output_section_name): Add new parameter
8619         PSECTION_TYPE for returning script section type.  Pass it to
8620         section elements.  Handle discard sections.
8621         (Sort_output_sections::operator()): Handle NOLOAD sections.
8622         * script-sections.h (Script_sections::Section_type): New enum type.
8623         (Script_sections::output_section_name): Add a new parameter for
8624         returning script section type.
8625         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8626         INFO and NOLOAD.
8627         * yyscript.y (union): Add new field SECTION_TYPE.
8628         (COPY, DSECT, INFO, NOLOAD): New tokens.
8629         (opt_address_and_section_type): Change type to output_section_header.
8630         (section_type): New non-terminal
8631         (section_header): Handle section type.
8632         (opt_address_and_section_type): Return section type value.
8633
8634 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8635
8636         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8637         * testsuite/plugin_common_test_2.c (foo): Likewise.
8638
8639 2010-04-08  Doug Kwan  <dougkwan@google.com>
8640
8641         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8642         Output_merge_data.
8643         * output.cc (Output_section::add_merge_input_section): Simplify
8644         code and return status of Output_merge_base::add_input_section.
8645         Update merge section map only if Output_merge_base::add_input_section
8646         returns true.
8647
8648 2010-04-07  Doug Kwan  <dougkwan@google.com>
8649
8650         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8651         if section is marked as containing instructions but has no mapping
8652         symbols.
8653         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8654         correct section index.
8655         (Arm_relobj::find_linked_text_section): Ditto.
8656
8657 2010-04-07  Cary Coutant  <ccoutant@google.com>
8658
8659         * archive.cc (include_member): Destroy Read_symbols_data object before
8660         releasing file.
8661         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8662         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8663         (Read_symbols_data::~Read_symbols_data) New destructor.
8664         (Section_relocs::Section_relocs) New constructor.
8665         (Section_relocs::~Section_relocs) New destructor.
8666         (Read_relocs_data::Read_relocs_data) New constructor.
8667         (Read_relocs_data::~Read_relocs_data) New destructor.
8668         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8669         pointers to NULL after deleting.
8670
8671 2010-04-07  Doug Kwan  <dougkwan@google.com>
8672
8673         * arm.cc: Replace "endianity" with "endianness" in comments.
8674         (Arm_exidx_cantunwind): Ditto.
8675         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8676         (Arm_relobj::merge_flags_and_attributes): New method.
8677         (Arm_relobj::merge_flags_and_attributes_): New data member.
8678         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8679         (Arm_relobj::scan_sections_for_stubs): Ditto.
8680         (Arm_relobj::do_read_symbols): Check to see if we really want to
8681         merge processor-specific flags and attributes.  Exit early if
8682         an object is empty except for section names and the undefined symbol.
8683         (Target_arm::do_finalize_sections): Move check for ELF format to
8684         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8685         attributes from a regular object only when we have determined that
8686         it is aapropriate.  Do not create an .ARM.attributes section in
8687         output if there is no regular input object.
8688         (Target_arm::merge_processor_specific_flags): Check
8689         --warn-mismatch before printing any error.
8690         (Target_arm::merge_object_attributes): Ditto.
8691         * gold.cc (queue_middle_tasks): Handle the case in which there is
8692         no regular object in input.
8693         * options.cc (General_options::parse_EB): New method.
8694         (General_options::parse_EL): Same.
8695         (General_options::General_options): Initialize endianness_.
8696         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8697         New options.
8698         (General_options::Endianness): New enum.
8699         (General_options::endianness): New method.
8700         (General_options::endianness_): New data member.
8701         * parameters.cc (Parameters::set_options): Check target endianness.
8702         (Parameters::set_target_once): Ditto.
8703         (Parameters::check_target_endianness): New method.
8704         (parameters_force_valid_target): If either -EL or -EB is specified,
8705         use it to define endianness of default target.
8706         * parameters.h (Parameters::check_target_endianness): New method
8707         declaration.
8708         * target.h (class Target): Change "endianity" to "endianness"
8709         in comments.
8710
8711 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8712
8713         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8714         * configure: Regenerate.
8715         * Makefile.in: Regenerate.
8716         * testsuite/Makefile.in: Regenerate.
8717
8718 2010-04-06  Cary Coutant  <ccoutant@google.com>
8719
8720         gcc PR lto/42757
8721         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8722         prevailing definitions of common symbols.
8723         * testsuite/plugin_test_6.sh: New test case.
8724         * testsuite/plugin_common_test_1.c: New test case.
8725         * testsuite/plugin_common_test_2.c: New test case.
8726         * testsuite/Makefile.am (plugin_test_6): New test case.
8727         * testsuite/Makefile.in: Regenerate.
8728
8729 2010-04-06  Nick Clifton  <nickc@redhat.com>
8730
8731         * po/vi.po: New Vietnamese translation.
8732
8733 2010-03-30  Doug Kwan  <dougkwan@google.com>
8734
8735         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8736
8737 2010-03-25  Doug Kwan  <dougkwan@google.com>
8738
8739         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8740         to avoid a conversion warning on a 32-bit host.
8741
8742 2010-03-24  Ian Lance Taylor  <iant@google.com>
8743
8744         * testsuite/script_test_3.t: Add a TLS segment.
8745         * testsuite/Makefile.am (check_PROGRAMS): Add
8746         tls_phdrs_script_test.
8747         (tls_phdrs_script_test_SOURCES): Define.
8748         (tls_phdrs_script_test_DEPENDENCIES): Define.
8749         (tls_phdrs_script_test_LDFLAGS): Define.
8750         (tls_phdrs_script_test_LDADD): Define.
8751         * testsuite/Makefile.in: Rebuild.
8752
8753 2010-03-23  Cary Coutant  <ccoutant@google.com>
8754
8755         * fileread.cc (find_or_make_view): Fix comment.
8756
8757 2010-03-23  Ian Lance Taylor  <iant@google.com>
8758
8759         * script-sections.cc (class Orphan_section_placement): Define
8760         PLACE_TLS and PLACE_TLS_BSS.
8761         (Orphan_section_placement::Orphan_section_placement): Initialize
8762         new places.
8763         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8764         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8765         (tls_script_test_SOURCES): Define.
8766         (tls_script_test_DEPENDENCIES): Define.
8767         (tls_script_test_LDFLAGS): Define.
8768         (tls_script_test_LDADD): Define.
8769         * testsuite/Makefile.in: Rebuild.
8770
8771 2010-03-22  Doug Kwan  <dougkwan@google.com>
8772
8773         * arm.cc (Arm_relocate_functions::abs8,
8774         Arm_relocate_functions::abs16): Use correct check for overflow
8775         specified in the ARM ELF specs.
8776         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8777         target of a BLX instruction specially.
8778         (Reloc_stub::stub_type_for_reloc): Ditto.
8779         (Relocate::relocate): Use symbolic names instead of numeric relocation
8780         codes to report error.
8781         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8782         workaround.
8783         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8784         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8785         thumb2_blx_out_of_range.stdout
8786         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8787         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8788         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8789         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8790         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8791         thumb2_blx_in_range, thumb2_blx_in_range.o,
8792         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8793         thumb2_blx_out_of_range.o): New rules.
8794         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8795         thumb2_blx_in_range and thumb2_blx_out_of_range.
8796         * testsuite/Makefile.in: Regenerate.
8797         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8798         * testsuite/thumb_blx_in_range.s: New file.
8799         * testsuite/thumb_blx_out_of_range.s: New file.
8800
8801 2010-03-22  Rafael Espindola  <espindola@google.com>
8802
8803         * archive.cc (Should_include): Move to archive.h.
8804         (should_include_member): Make it a member of Archive.
8805         (Lib_group): New.
8806         (Add_lib_group_symbols): New.
8807         * archive.h: Include options.h.
8808         (Archive_member): Moved from Archive.
8809         (Should_include): Moved from archive.cc.
8810         (Lib_group): New.
8811         (Add_lib_group_symbols): New.
8812         * dynobj.cc (do_should_include_member): New.
8813         * dynobj.h (do_should_include_member): New.
8814         * gold.cc (queue_initial_tasks): Update call to queue.
8815         * main.cc (main): Print lib group stats.
8816         * object.cc (do_should_include_member): New.
8817         * object.h: Include archive.h.
8818         (Object::should_include_member): New.
8819         (Object::do_should_include_member): New.
8820         (Sized_relobj::do_should_include_member): New.
8821         * options.cc (General_options::parse_start_lib): New.
8822         (General_options::parse_end_lib): New.
8823         (Input_arguments::add_file): Handle lib groups.
8824         (Input_arguments::start_group): Check we are not in a lib.
8825         (Input_arguments::start_lib): New.
8826         (Input_arguments::end_lib): New.
8827         * options.h (General_options): Add start_lib and end_lib.
8828         (Input_argument::lib_): New.
8829         (Input_argument::lib): New.
8830         (Input_argument::is_lib): New.
8831         (Input_file_lib): New.
8832         (Input_arguments::in_lib_): New.
8833         (Input_arguments::in_lib): New.
8834         (Input_arguments::start_lib): New.
8835         (Input_arguments::end_lib_): New.
8836         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8837         in unused members as preempted.
8838         (Sized_pluginobj::do_should_include_member): New.
8839         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8840         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8841         return the blocker.
8842         (Read_symbols::do_whole_lib_group): New.
8843         (Read_symbols::do_lib_group): New.
8844         (Read_symbols::do_read_symbols): Handle lib groups.
8845         (Read_symbols::get_name): Handle lib groups.
8846         * readsyms.h (Read_symbols): Add an archive member pointer.
8847         (Read_symbols::do_whole_lib_group): New.
8848         (Read_symbols::do_lib_group): New.
8849         (Read_symbols::member_): New.
8850         * script.cc (read_input_script): Update call to queue_soon.
8851
8852 2010-03-19  Doug Kwan  <dougkwan@google.com>
8853
8854         * arm.cc (Stub_table::Stub_table): Initialize new data members
8855         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8856         (Stub_table::add_reloc_stub): Assign stub offset and update
8857         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8858         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8859         New data members.
8860         (Stub_table::update_data_size_and_addralign): Use
8861         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8862         instead of going over all reloc stubs.
8863         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8864         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8865         Stringpool_template::offset_ to size of Stringpool_char.
8866         (Stringpool_template::new_key_offset): Remove code to initialize
8867         Stringpool_template::offset_.
8868         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8869         Stringpool_template::offset_ to zero.
8870
8871 2010-03-15  Doug Kwan  <dougkwan@google.com>
8872
8873         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8874         offset_.
8875         (Stringpool_template::new_key_offset): New method.
8876         (Stringpool_template::add_string): Assign offsets when adding new
8877         strings.
8878         (Stringpool_template::set_string_offsets): Do not set string offsets
8879         when not optimizing.
8880         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8881         member size_.
8882         (Chunked_vector::clear): Clear size_.
8883         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8884         (Chunked_vector::size): Return size_.
8885         (Chunked_vector::push_back): Use size_ to find insert position.
8886         (Chunked_vector::size_): New data member.
8887         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8888         (Stringpool_template::new_key_offset): New method declaration.
8889         (Stringpool_template::offset_): New data member.
8890
8891 2010-03-15   Rafael Espindola  <espindola@google.com>
8892
8893         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8894         Add_symbols' constructor.
8895         * readsyms.h (Add_symbols): Remove the input_group member.
8896
8897 2010-03-10  Ian Lance Taylor  <iant@google.com>
8898
8899         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8900         target to ask whether a reference to a symbol requires a stack
8901         split.
8902         * target.h (Target::is_call_to_non_split): New function.
8903         (Target::do_is_call_to_non_split): Declare virtual function.
8904         * target.cc: Include "symtab.h".
8905         (Target::do_is_call_to_non_split): New function.
8906         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8907
8908 2010-03-10  Cary Coutant  <ccoutant@google.com>
8909
8910         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8911         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8912         (File_read::open[2]): Add whole_file_view_ to list of views.
8913         (File_read::make_view): Remove test of whole_file_view_.
8914         (File_read::find_or_make_view): Create whole_file_view_ if
8915         necessary.
8916         (File_read::clear_views): Replace bool parameter with enum;
8917         adjust all callers.  Don't delete views with permanent data;
8918         do delete cached views and views from archives if
8919         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8920         if clearing the corresponding view.
8921         * fileread.h (File_read::Clear_views_mode): New enum.
8922         (File_read::View::is_permanent_view): New method.
8923         (File_read::clear_views): Replace bool parameter
8924         with enum; adjust all callers.
8925         * options.h (General_options): Change keep_files_mapped option;
8926         add map_whole_files.
8927         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8928         releasing the file.
8929         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8930         the file.
8931
8932 2010-03-10  David S. Miller  <davem@davemloft.net>
8933
8934         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8935
8936 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8937
8938         * icf.cc (get_section_contents): Add '@' marker after processing the
8939         merge reloc.
8940
8941 2010-03-08  Doug Kwan  <dougkwan@google.com>
8942
8943         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8944         due to a conversion warning.
8945         (Arm_relobj::update_output_local_symbol_count): Check for local
8946         symbol with unset output index.
8947
8948 2010-03-05  Ian Lance Taylor  <iant@google.com>
8949
8950         * options.h (class General_options): Add --spare-dynamic-tags.
8951         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8952         --spare-dynamic-tags.
8953
8954 2010-03-05  Ian Lance Taylor  <iant@google.com>
8955
8956         * incremental.cc: Include "libiberty.h".
8957
8958 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8959
8960         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8961         function, is_info_ member.
8962         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8963         (Versions::Versions): Update caller.
8964         (Versions::define_base_version): Likewise.
8965         (Versions::add_def): Likewise.
8966
8967 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8968
8969         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8970         (Scan::possible_function_pointer_reloc): New function.
8971         (Scan::local_reloc_may_be_function_pointer): Change to call
8972         possible_function_pointer_reloc.
8973         (Scan::global_reloc_may_be_function_pointer): Ditto.
8974         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8975         relocations in ".data.rel.ro._ZTV" section.
8976         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8977         * testsuite/icf_safe_so_test.cc: Ditto.
8978         * testsuite/icf_safe_test.cc: Ditto.
8979         * testsuite/icf_safe_test.sh: Ditto.
8980
8981 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8982             Ian Lance Taylor  <iant@google.com>
8983
8984         * target-reloc.h (relocate_section): Check the symbol table index
8985         for -1U before setting the local symbol index.
8986         (scan_relocatable_relocs): If copying the relocation, record that
8987         the local symbol is required.
8988         * object.h (Symbol_value::is_output_symtab_index_set): New
8989         function.
8990         (Symbol_value::may_be_discarded_from_output_symtab): New
8991         function.
8992         (Symbol_value::has_output_symtab_entry): New function.
8993         (Symbol_value::needs_output_symtab_entry): Remove.
8994         (Symbol_value::output_symtab_index): Make sure the symbol index is
8995         set.
8996         (Symbol_value::set_output_symtab_index): Make sure the symbol
8997         index is not set.  Make sure the new index is valid.
8998         (Symbol_value::set_must_have_output_symtab_entry): New function.
8999         (Symbol_value::has_output_dynsym_entry): New function.
9000         (Symbol_value::set_output_dynsym_index): Make sure the new index
9001         is valid.
9002         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9003         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9004         local symbol if permitted.
9005         (Sized_relobj::do_finalize_local_symbols): Call
9006         is_output_symtab_index_set rather than needs_output_symtab_entry.
9007         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9008         rather than needs_output_symtab_entry.  Call
9009         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9010         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9011         is_output_symtab_index_set rather than needs_output_symtab_entry.
9012         * testsuite/discard_locals_relocatable_test.c: New file.
9013         * testsuite/discard_locals_test.sh: Test -r.
9014         * testsuite/Makefile.am (check_DATA): Add
9015         discard_locals_relocatable_test1.syms,
9016         discard_local_relocatable_test2.syms.
9017         (MOSTLYCLEANFILES): Likewise.  Also add
9018         discard_locals_relocatable_test1.lout and
9019         discard_locals_relocatable_test2.out.
9020         (discard_locals_relocatable_test1.syms): New target.
9021         (discard_locals_relocatable_test.o): New target.
9022         (discard_locals_relocatable_test1.out): New target.
9023         (discard_locals_relocatable_test2.syms): New target.
9024         (discard_locals_relocatable_test2.out): New target.
9025         (various): Add missing ../ld-new dependencies.
9026         * testsuite/Makefile.in: Rebuild.
9027
9028 2010-03-03  Nick Clifton  <nickc@redhat.com>
9029
9030         * po/fi.po: New Finnish translation.
9031
9032 2010-03-01  Doug Kwan  <dougkwan@google.com>
9033
9034         * layout.cc (Layout::Layout): Force section types of .init_array*,
9035         .preinit_array* and .fini_array* sections.
9036         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9037         Fix check of return value of std::string::find.().
9038         (Output_section::Input_section_sort_compare::operator()): Remove
9039         comment about .init_array.
9040         (Output_section::Input_section_sort_init_fini_compare::operator()):
9041         New method.
9042         (Output_section::sort_attached_input_sections): Handle .init_array
9043         and .fini_array specially.
9044         * output.h (Output_section::Inut_section_sort_compare): Update
9045         comment.
9046         (Output_section::Input_section_sort_init_fini_compare): New struct.
9047
9048 2010-02-26  Doug Kwan  <dougkwan@google.com>
9049
9050         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9051         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9052         * testsuite/debug_msg.sh: Avoid matching source line number for
9053         use of global variable undef_int.
9054
9055 2010-02-26  Doug Kwan  <dougkwan@google.com>
9056
9057         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9058         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9059         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9060         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9061         * options.cc (General_options::General_options): Initialize member
9062         fix_v4bx_.
9063         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9064         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9065         and rm_no_fix_v4bx.stdout
9066         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9067         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9068         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9069         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9070         and arm_no_fix_v4bx.
9071         * Makefile.in: Regenerate.
9072         * testsuite/arm_fix_v4bx.s: New file.
9073         * testsuite/arm_fix_v4bx.sh: Ditto.
9074
9075 2010-02-24  Doug Kwan  <dougkwan@google.com>
9076
9077         * arm.cc (Target_arm::got_section): Make the .got section the first
9078         non RELRO section in the data segment.
9079         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9080         suffixes of section names.
9081
9082 2010-02-24  Doug Kwan  <dougkwan@google.com>
9083
9084         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9085         flags and attributes merging if an input file is a binary file.
9086         * fileread.cc (Input_file::open): Record format of original file.
9087         * fileread.h (Input_file::Format): New enum type.
9088         (Input_file::Input_file): Initialize data member format_.
9089         (Input_file::format): New method definition.
9090         (Input_file::format_):: New data member.
9091
9092 2010-02-24  Doug Kwan  <dougkwan@google.com>
9093
9094         * arm.cc (Arm_output_data_got): New class.
9095         (ARM_TCB_SIZE): New constant
9096         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9097         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9098         If user uses a script with a SECTIONS clause, issue only a warning
9099         for a misplaced EXIDX input section.  Otherwise, issue an error.
9100         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9101         garbage collection.
9102         (Target_arm::got_mode_index_entry): Handle static linking.
9103         (Target_arm::Scan::local): Ditto.
9104         (Target_arm::Scan::global): Ditto.
9105         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9106         all incorrectly implemented relocations.
9107         (Target_arm::fix_exidx_coverage): Pass layout to
9108         Arm_output_section::fix_exidx_coverage.
9109         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9110         from ".ARM.exidx." and ".ARM.extab.".
9111
9112 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9113
9114         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9115         section if it does not already exist.
9116         * attributes.cc (Attributes_section_data::Attributes_section_data):
9117         Don't crash if size is zero.
9118
9119 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9120             Ian Lance Taylor  <iant@google.com>
9121
9122         * gold.cc (queue_middle_tasks): If no input files were opened,
9123         exit.
9124         * workqueue.h (Task_function::Task_function): Assert that there is
9125         a blocker.
9126
9127 2010-02-22  Doug Kwan  <dougkwan@google.com>
9128
9129         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9130         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9131         types to avoid warnings due to different uint64_t implementations
9132         on different hosts.
9133
9134 2010-02-21  Doug Kwan  <dougkwan@google.com>
9135
9136         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9137         handling of the maximum backward branch offset.
9138         (Arm_relocate_functions::thumb_branch_common): Ditto.
9139         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9140         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9141         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9142         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9143         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9144         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9145         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9146         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9147         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9148         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9149         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9150         thumb2_bl_out_of_range.o): New rules.
9151         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9152         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9153         thumb2_bl_out_of_range
9154         * testsuite/Makefile.in: Regenerate.
9155         * testsuite/arm_bl_in_range.s: New file.
9156         * testsuite/arm_bl_out_of_range.s: Ditto.
9157         * testsuite/arm_branch_in_range.sh: Ditto.
9158         * testsuite/arm_branch_range.t: Ditto.
9159         * testsuite/thumb2_branch_range.t: Ditto.
9160         * testsuite/thumb_bl_in_range.s: Ditto.
9161         * testsuite/thumb_bl_out_of_range.s: Ditto.
9162         * testsuite/thumb_branch_range.t: Ditto.
9163
9164 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9165
9166         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9167         Add reloc offset information.
9168         * icf.cc (get_section_contents): Change iterators to point to the new
9169         vectors. Add reloc offset information to the contents.
9170         * icf.h (Icf::Sections_reachable_info): New typedef.
9171         (Icf::Sections_reachable_list): New typedef.
9172         (Icf::Offset_info): New typedef.
9173         (Icf::Reloc_info): New struct typedef.
9174         (Icf::Reloc_info_list): New typedef.
9175         (Icf::symbol_reloc_list): Delete method.
9176         (Icf::addend_reloc_list): Delete method.
9177         (Icf::section_reloc_list): Delete method.
9178         (Icf::reloc_info_list): New method.
9179         (Icf::reloc_info_list_): New member.
9180
9181 2010-02-19  Doug Kwan  <dougkwan@google.com>
9182
9183         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9184         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9185         * arm.cc (Arm_relocation_functions): New forward declaration.
9186         (Target_arm::Target_arm): Initialize new data members
9187         got_mod_index_offset_ and tls_base_symbol_defined_.
9188         (Target_arm::Relocate::relocate_tls): New method.
9189         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9190          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9191         New methods.
9192         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9193         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9194         (Target_arm::got_mod_index_offset_,
9195         Target_arm::tls_base_symbol_defined_): New data members.
9196         (Target_arm::Scan::local, Target::Scan::global,
9197         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9198         relocations.
9199
9200 2010-02-18  Doug Kwan  <dougkwan@google.com>
9201
9202         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9203         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9204         text section as a parameter becuase some broken tools may not set
9205         the link in section header.
9206         (Target_arm::has_got_section): New method.
9207         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9208         without any mapping symbol as data only.  Remove warning.
9209         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9210         link in its section header, try to discover the link by inspecting the
9211         REL31 relocation at the beginning of the section.
9212         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9213         in error message.
9214         (Target_arm::Scan::global): Treat any reference to the symbol
9215         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9216
9217 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9218
9219         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9220         (Scan::global_reloc_may_be_function_pointer): New function.
9221         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9222         (Scan::global_reloc_may_be_function_pointer): New function.
9223         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9224         (Scan::global_reloc_may_be_function_pointer): New function.
9225         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9226         (Scan::global_reloc_may_be_function_pointer): New function.
9227         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9228         (Scan::global_reloc_may_be_function_pointer): New function.
9229         (Scan::possible_function_pointer_reloc): New function.
9230         (Target_x86_64::can_check_for_function_pointers): New function.
9231         * gc.h (gc_process_relocs): Scan relocation types to determine if
9232         function pointers were taken for targets that support it.
9233         * icf.cc (Icf::find_identical_sections): Include functions for
9234         folding in safe ICF whose pointer is not taken.
9235         * icf.h (Secn_fptr_taken_set): New typedef.
9236         (fptr_section_id_): New member.
9237         (section_has_function_pointers): New function.
9238         (set_section_has_function_pointers): New function.
9239         (check_section_for_function_pointers): New function.
9240         * options.h: Fix comment for safe ICF option.
9241         * target.h (can_check_for_function_pointers): New function.
9242         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9243         Modify icf_safe_test for X86-64.
9244         * testsuite/Makefile.in: Regenerate.
9245         * testsuite/icf_safe_so_test.cc: New file.
9246         * testsuite/icf_safe_so_test.sh: New file.
9247         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9248         (main): Change to take pointer to function kept_func_3.
9249         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9250         folding is done correctly for X86-64.
9251
9252 2010-02-12  David S. Miller  <davem@davemloft.net>
9253
9254         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9255         is_symbolless parameter.
9256         (Output_reloc<SHT_REL>::is_symbolless): New.
9257         (Output_reloc<SHT_REL>::is_symbolless_): New.
9258         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9259         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9260         (Output_reloc<SHT_RELA>::is_symbolless): New.
9261         (Output_data_reloc::add_global): Handle is_symbolless.
9262         (Output_data_reloc::add_global_relative): Likewise.
9263         (Output_data_reloc::add_local): Likewise.
9264         (Output_data_reloc::add_local_relative): Likewise.
9265         (Output_data_reloc::add_symbolless_global_addend): New.
9266         (Output_data_reloc::add_symbolless_local_addend): New.
9267         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9268         is_symbolless.
9269         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9270         instead of ->is_relative_
9271         (Output_reloc::write): Likewise.
9272         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9273         (Output_reloc::write_rel): Simplify.
9274
9275         * sparc.cc (Target_sparc::Scan::local): Use
9276         ->add_symbolless_local_addend as needed.
9277         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9278         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9279         based upon relocation offset.
9280
9281 2010-02-11  Doug Kwan  <dougkwan@google.com>
9282
9283         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9284         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9285         beginning of function.
9286         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9287         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9288         parameter is_32bit in calls to should_apply_static_reloc.
9289         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9290         (check_DATA): Add arm_abs_global.stdout.
9291         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9292         arm_abs_global.stdout): New rules.
9293         (MOSTLLYCLEANFILES): Add arm_abs_global
9294         * Makefile.in: Regenerate.
9295         * testsuite/arm_abs_global.s: New file.
9296         * testsuite/arm_abs_global.sh: Ditto.
9297         * testsuite/arm_abs_lib.s: Ditto.
9298
9299 2010-02-11  Ian Lance Taylor  <iant@google.com>
9300
9301         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9302         Read_relocs task.
9303         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9304         Allocate_commons_task first.
9305         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9306         task, rather than symtab_lock_.
9307         (Gc_process_relocs::~Gc_process_relocs): New function.
9308         (Gc_process_relocs::is_runnable): Check this_blocker_.
9309         (Gc_process_relocs::locks): Use next_blocker_ rather than
9310         blocker_.
9311         (Scan_relocs::~Scan_relocs): New function.
9312         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9313         symtab_lock_.
9314         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9315         next_blocker_.
9316         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9317         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9318         constructor accordingly.
9319         (class Gc_process_relocs): Likewise.
9320         (class Scan_relocs): Likewise.
9321         * common.h (class Allocate_commons_task): Remove symtab_lock_
9322         field, and corresponding constructor parameter.
9323         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9324         symtab_lock_.
9325         (Allocate_commons_task::locks): Likewise.
9326
9327 2010-02-11  Ian Lance Taylor  <iant@google.com>
9328
9329         * gold-threads.h (class Once): Define.
9330         (class Initialize_lock): Rewrite as child of Once.
9331         * gold-threads.cc (class Once_initialize): Define.
9332         (once_pointer_control): New static variable.
9333         (once_pointer, once_arg): New static variables.
9334         (c_run_once): New static function.
9335         (Once::Once, Once::run_once, Once::internal_run): New functions.
9336         (class Initialize_lock_once): Remove.
9337         (initialize_lock_control): Remove.
9338         (initialize_lock_pointer): Remove.
9339         (initialize_lock_once): Remove.
9340         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9341         (Initialize_lock::initialize): Rewrite.
9342         (Initialize_lock::do_run_once): New function.
9343         * archive.cc (Archive::interpret_header): Only clear name if it is
9344         not already empty.
9345         * fileread.cc: Include "gold-threads.h"
9346         (file_counts_lock): New static variable.
9347         (file_counts_initialize_lock): Likewise.
9348         (File_read::release): Only increment counts when using --stats.
9349         Use a lock around the increment.
9350         * parameters.cc (class Set_parameters_target_once): Define.
9351         (set_parameters_target_once): New static variable.
9352         (Parameters::Parameters): Move here from parameters.h.
9353         (Parameters::set_target): Rewrite.
9354         (Parameters::set_target_once): New function.
9355         (Parameters::clear_target): Move here and rewrite.
9356         * parameters.h (class Parameters): Update declarations.  Add
9357         set_parameters_target_once_ field.
9358         (Parameters::Parameters): Move to parameters.cc.
9359         (Parameters::clear_target): Likewise.
9360         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9361         task.
9362         (Start_group::~Start_group): New function.
9363         (Start_group::is_runnable): New function.
9364         (Start_group::locks, Start_group::run): New functions.
9365         (Finish_group::run): Change saw_undefined to size_t.
9366         * readsyms.h (class Start_group): Define.
9367         (class Finish_group): Change saw_undefined_ field to size_t.
9368         (Finish_group::Finish_group): Remove saw_undefined and
9369         this_blocker parameters.  Change all callers.
9370         (Finish_group::set_saw_undefined): New function.
9371         (Finish_group::set_blocker): New function.
9372         * symtab.h (class Symbol_table): Change saw_undefined to return
9373         size_t.  Change saw_undefined_ field to size_t.
9374         * target-select.cc (Set_target_once::do_run_once): New function.
9375         (Target_selector::Target_selector): Initialize set_target_once_
9376         field.  Don't initialize lock_ and initialize_lock_ fields.
9377         (Target_selector::instantiate_target): Rewrite.
9378         (Target_selector::set_target): New function.
9379         * target-select.h (class Set_target_once): Define.
9380         (class Target_selector): Update declarations.  Make
9381         Set_target_once a friend.  Remove lock_ and initialize_lock_
9382         fields.  Add set_target_once_ field.
9383
9384 2010-02-10  Ian Lance Taylor  <iant@google.com>
9385
9386         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9387         queueing any tasks.
9388         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9389         (queue_middle_tasks): Add all blockers before queueing any tasks.
9390         (queue_final_tasks): Likewise.
9391         * token.h (Task_token::add_blockers): New function.
9392         * object.h (Input_objects::number_of_relobjs): New function.
9393
9394 2010-02-10  Ian Lance Taylor  <iant@google.com>
9395
9396         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9397         shared, not if not position independent.
9398         * x86_64.cc (Relocate::relocate_tls): Likewise.
9399         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9400         (tls_pie_pic_test): New target.
9401         * testsuite/Makefile.in: Rebuild.
9402
9403         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9404         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9405         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9406         * testsuite/Makefile.in: Rebuild.
9407
9408 2010-02-09  David S. Miller  <davem@davemloft.net>
9409
9410         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9411         R_SPARC_RELATIVE using ->add_local_relative().
9412         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9413
9414         * output.h (Output_data_dynamic::add_section_size): New method
9415         that takes two Output_data objects.
9416         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9417         entry param.  Handle it in initializers.
9418         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9419         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9420         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9421         arg.
9422         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9423         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9424         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9425         for dynrel_includes_plt.
9426         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9427         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9428         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9429         before .rela.plt
9430         (Target_sparc::do_finalize_sections): Update to pass true for
9431         dynrel_includes_plt.
9432         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9433         output before .rela.plt
9434         (Target_powerpc::do_finalize_sections): Update to pass true for
9435         dynrel_includes_plt when 32-bit.
9436
9437 2010-02-08  Doug Kwan  <dougkwan@google.com>
9438
9439         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9440         method.
9441         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9442         Arm_relobj::scan_section_for_cortex_a8_stubs,
9443         Arm_relobj::do_relocation_section): Instead of calling
9444         Output_section::output_address, use faster
9445         Arm_relobj::simple_input_section_output_address.
9446
9447 2010-02-08  David S. Miller  <davem@davemloft.net>
9448
9449         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9450         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9451         relocation helper function.
9452
9453         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9454         just like R_SPARC_GOT{10,13,22}.
9455         (Target_sparc::Scan::local): Likewise.
9456         (Target_sparc::Relocate:relocate): Likewise.
9457
9458 2010-02-06  Ian Lance Taylor  <iant@google.com>
9459
9460         * configure.ac: Rewrite targetobjs duplicate removal code to use
9461         only shell constructs.
9462         * configure: Rebuild.
9463
9464 2010-02-05  Doug Kwan  <dougkwan@google.com>
9465
9466         PR 11247
9467         * arm.cc (Arm_relobj::section_is_scannable): New method.
9468         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9469         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9470
9471 2010-02-04  Doug Kwan  <dougkwan@google.com>
9472
9473         PR 11247
9474         * arm-reloc-property.cc (cstdio): Include.
9475         * configure.ac (targetobjs): Remove duplicates.
9476         * configure: Regenerate.
9477         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9478         big and little endian version for a given address size.
9479
9480 2010-02-03  Doug Kwan  <dougkwan@google.com>
9481
9482         * arm-reloc-property.cc
9483         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9484         definition.
9485         * arm-reloc-property.h
9486         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9487         New method definition.
9488         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9489         declaration.
9490         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9491         overflow to N.
9492         (GOT_PREL): Change implemented to Y.
9493         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9494         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9495         (Arm_relocate_functions::movw_abs_nc): Remove method.
9496         (Arm_relocate_functions::movt_abs): Ditto.
9497         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9498         (Arm_relocate_functions::thm_movt_abs): Ditto.
9499         (Arm_relocate_functions::movw_rel_nc): Ditto.
9500         (Arm_relocate_functions::movw_rel): Ditto.
9501         (Arm_relocate_functions::movt_rel): Ditto.
9502         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9503         (Arm_relocate_functions:thm_movw_rel): Ditto.
9504         (Arm_relocate_functions:thm_movt_rel): Ditto.
9505         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9506         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9507         New method definitions.
9508         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9509         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9510         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9511         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9512         (Target_arm::Relocate::relocate): Check for non-static or
9513         unimplemented relocation code and exit early.  Change calls to
9514         Target_arm::reloc_uses_thumb_bit and
9515         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9516         instead.  Refactor code to handle similar relocations to increase
9517         code sharing.  Remove check for unsupported relocation code in switch
9518         statement.
9519         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9520         relocation property table to find out size.  Change error message to
9521         print out the name of a relocation code instead of the numeric value.
9522         (Target_arm::scan_reloc_for_stub): Use relocation property table
9523         instead of calling Target_arm::reloc_uses_thumb_bit().
9524
9525 2010-02-02  Doug Kwan  <dougkwan@google.com>
9526
9527         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9528         types of relaxed input section.
9529
9530 2010-02-02  Doug Kwan  <dougkwan@google.com>
9531
9532         * Makefile.am (HFILES): Add arm-reloc-property.h.
9533         (DEFFILES): New.
9534         (TARGETSOURCES): Add arm-reloc-property.cc
9535         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9536         (libgold_a_SOURCES): $(DEFFILES)
9537         * Makefile.in: Regenerate.
9538         * arm-reloc-property.cc: New file.
9539         * arm-reloc-property.h: New file.
9540         * arm-reloc.def: New file.
9541         * arm.cc: Update comments.
9542         (arm-reloc-property.h): New included header.
9543         (arm_reloc_property_table): New global variable.
9544         (Target_arm::do_select_as_default_target): New method definition.
9545         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9546         arm-reloc-property to targ_extra_obj.
9547         * parameters.cc (set_parameters_target): Call
9548         Target::select_as_default_target().
9549         * target.h (Target::select_as_default_target): New method definition.
9550         (Target::do_select_as_default_target): Same.
9551
9552 2010-02-01  Doug Kwan  <dougkwan@google.com>
9553
9554         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9555         first_output_text_section_.
9556         (Arm_exidx_fixup::first_output_text_section): New method definition.
9557         (Arm_exidx_fixup::first_output_text_section_): New data member.
9558         (Arm_exidx_fixup::process_exidx_section): Record the first text
9559         output section seen.
9560         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9561         and entsize in output section header.
9562
9563 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9564
9565         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9566         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9567         (Arm_relocate_functions::thm_alu11): New Method.
9568         (Arm_relocate_functions::thm_pc8): New Method.
9569         (Arm_relocate_functions::thm_pc12): New Method.
9570         (Target_arm::Scan::local): Handle the relocations.
9571         (Target_arm::Scan::global): Likewise.
9572         (Target_arm::Relocate::relocate): Likewise.
9573         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9574
9575 2010-01-29  Doug Kwan  <dougkwan@google.com>
9576
9577         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9578         of relocation types as ld.
9579
9580 2010-01-29  Doug Kwan  <dougkwan@google.com>
9581
9582         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9583         to public.
9584         (Arm_relocate_functions::thumb_branch_common): Ditto.
9585         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9586         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9587         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9588         Arm_relocate_functions::jump24): Remove.
9589         (Target_arm::Relocate::relocate): Adjust code to call
9590         Arm_relocation_functions::arm_branch_common and
9591         Arm_relocation_functions::thumb_branch_common instead of their removed
9592         wrappers.  Merge switch-cases together to reduce source code size.
9593
9594 2010-01-29  Doug Kwan  <dougkwan@google.com>
9595
9596         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9597         output_local_symbol_count_needs_update_.
9598         (Arm_relobj::output_local_symbol_count_needs_update,
9599          Arm_relobj::set_output_local_symbol_count_needs_update,
9600          Arm_relobj::update_output_local_symbol_count): New methods.
9601         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9602         member.
9603         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9604         of pointed function as in a R_ARM_PREL31 relocation.
9605         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9606         for output local symbol count updating.
9607         (Target_arm::do_relax): Update output local symbol counts in objects
9608         if necessary.
9609         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9610
9611 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9612
9613         * arm.cc: Added support for the ARM relocations:
9614         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9615         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9616         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9617         movw_prel_nc).
9618         (Arm_relocate_functions::movw_rel): New method.
9619         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9620         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9621         thm_movw_prel_nc).
9622         (Arm_relocate_functions::thm_movw_rel): New method.
9623         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9624         thm_movt_prel).
9625         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9626         relocations.
9627         (Target_arm::Scan::global): Likewise.
9628         (Target_arm::Relocate::relocate): Likewise.
9629         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9630         Likewise.
9631
9632 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9633
9634         * arm.cc: Added support for ARM group relocations.
9635         (Target_arm::reloc_needs_sym_origin): New method.
9636         (Arm_relocate_functions::calc_grp_kn): New method.
9637         (Arm_relocate_functions::calc_grp_residual): New method.
9638         (Arm_relocate_functions::calc_grp_gn): New method.
9639         (Arm_relocate_functions::arm_grp_alu): New Method.
9640         (Arm_relocate_functions::arm_grp_ldr): New Method.
9641         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9642         (Arm_relocate_functions::arm_grp_ldc): New Method.
9643         (Target_arm::Scan::local): Handle the ARM group relocations.
9644         (Target_arm::Scan::global): Likewise.
9645         (Target_arm::Relocate::relocate): Likewise.
9646         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9647         Likewise.
9648
9649 2010-01-26  Doug Kwan  <dougkwan@google.com>
9650
9651         * arm.cc (set): Include.
9652         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9653         pointer type.
9654         (Arm_output_section::Text_section_list): New type.
9655         (Arm_output_section::append_text_sections_to_list): New method.
9656         (Arm_output_section::fix_exidx_coverage): Ditto.
9657         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9658         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9659         Relobj::set_section_offset() instead of
9660         Sized_relobj::invalidate_section_offset().
9661         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9662         parameter for section headers. Ignore relocation sections for
9663         unallocated sections and EXIDX sections.
9664         (Target_arm::fix_exidx_coverage): New method.
9665         (Target_arm::output_section_address_less_than): New type.
9666         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9667         linked text section instead of the EXIDX section.
9668         (Arm_output_section::create_stub_group): Add an assertion to check
9669         that this is not an EXIDX output section.
9670         (Arm_output_section::append_text_sections_to_list): New method.
9671         (Arm_output_section::fix_exidx_coverage): Ditto.
9672         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9673         Arm_relobj::section_needs_reloc_stub_scanning.
9674         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9675         first pass.
9676         (Target_arm::fix_exidx_coverage): New method.
9677         * object.h (Relobj::set_output_section): New method.
9678         (Sized_relobj::invalidate_section_offset): Remove method.
9679         (Sized_relobj::do_invalidate_section_offset): Remove method.
9680         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9681
9682 2010-01-25  Doug Kwan  <dougkwan@google.com>
9683
9684         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9685         Fix warning due to signed and unsigned comparison on a 32-bit host.
9686
9687 2010-01-22  Doug Kwan  <dougkwan@google.com>
9688
9689         * arm.cc (Target_arm::do_relax): Record an output section for section
9690         offset adjustment it contains any stub table that has changed.
9691         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9692         offsets in an output section if necessary.
9693         * output.cc (Output_section::Output_section): Initialize
9694         section_offsets_need_adjustments_.
9695         (Output_section::add_input_section_for_script): Renamed to
9696         Output_section::add_simple_input_section.
9697         (Output_section::save_states): Add a comment.
9698         (Output_section::discard_states): New method defintion.
9699         (Output_section::adjust_section_offsets): Same.
9700         * output.h (Output_section::add_input_section_for_script): Renamed to
9701         Output_section::add_simple_input_section.
9702         (Output_section::discard_states): New method declaration.
9703         (Output_section::adjust_section_offsets): Same.
9704         (Output_section::section_offsets_need_adjustment,
9705         Output_section::set_section_offsets_need_adjustment): New method
9706         definitions.
9707         (Output_section::section_offsets_need_adjustment_): New data member.
9708         * script-sections.cc
9709         (Output_section_element_input::set_section_address): Adjust code for
9710         renaming of Output_section::add_input_section_for_script.
9711         (Orphan_output_section::set_section_address): Same.
9712
9713 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9714
9715         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9716         Fix_v4bx enum values .
9717         * gold/options.h (General_options): New option definitions.
9718         (General_options::fix_v4bx): New method.
9719         (General_options::Fix_v4bx): New enum.
9720         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9721         (General_options::parse_fix_v4bx_interworking): New method.
9722
9723 2010-01-22  Doug Kwan  <dougkwan@google.com>
9724
9725         * arm.cc (Arm_exidx_fixup): New class.
9726
9727 2010-01-21  Doug Kwan  <dougkwan@google.com>
9728
9729         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9730         classes.
9731         (Arm_exidx_section_offset_map): New type.
9732
9733 2010-01-21  Doug Kwan  <dougkwan@google.com>
9734
9735         * arm.cc (Arm_exidx_input_section): New class.
9736         (Arm_relobj::exidx_input_section_by_link,
9737         Arm_relobj::exidx_input_section_by_shndx,
9738         Arm_relobj::make_exidx_input_section): New methods.
9739         (read_arm_attributes_section): Remove.
9740         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9741         information about them.
9742         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9743         to here.
9744
9745 2010-01-20  Doug Kwan  <dougkwan@google.com>
9746
9747         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9748         Input_section_specifier to Section_id.
9749         (Target_arm::new_arm_input_section: Adjust code for change of key
9750         type.
9751         (Target_arm::find_arm_input_section): Ditto.
9752         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9753         (Section_id): Remove.
9754         (Garbage_collection::Section_id_hash): Remove.
9755         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9756         (Section_id): Remove.
9757         (Icf::Section_id_hash): Remove.
9758         * object.h (Section_id, Const_section_id, Section_id_hash,
9759         Const_section_id_hash): New type definitions.
9760         * output.cc (Output_section::add_relaxed_input_section): Change to
9761         use Const_section_id instead of Input_section_specifier as key type.
9762         (Output_section::add_merge_input_section): Ditto.
9763         (Output_section::build_relaxation_map): Change to use Section_id
9764         instead of Input_section_specifier as key type.
9765         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9766         Ditto.
9767         (Output_section::convert_input_sections_to_relaxed_sections): Change
9768         to use Const_section_id instead of Input_section_specifier as key type.
9769         (Output_section::find_merge_section): Ditto.
9770         (Output_section::find_relaxed_input_section): Ditto.
9771         * output.h (Input_section_specifier): Remove class.
9772         (Output_section::Output_section_data_by_input_section_map): Change
9773         key type to Const_section_id.
9774         (Output_section::Output_relaxed_input_section_by_input_section_map):
9775         Ditto.
9776         (Output_section::Relaxation_map): Change key type to Section_id.
9777
9778 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9779
9780         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9781         (class Arm_v4bx_stub): New class.
9782         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9783         (Stub_factory::make_arm_v4bx_stub): New method.
9784         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9785         (Stub_table::empty): Handle v4bx stubs.
9786         (Stub_table::add_arm_v4bx_stub): New method.
9787         (Stub_table::find_arm_v4bx_stub): New method.
9788         (Arm_relocate_functions::v4bx): New method.
9789         (Target_arm::fix_v4bx): New method.
9790         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9791         (Stub_table::relocate_stubs): Likewise.
9792         (Stub_table::do_write): Likewise.
9793         (Stub_table::update_data_size_and_addralign): Likewise.
9794         (Stub_table::finalize_stubs):  Likewise.
9795         (Target_arm::Scan::local): Likewise.
9796         (Target_arm::Scan::global): Likewise.
9797         (Target_arm::do_finalize_sections): Likewise.
9798         (Target_arm::Relocate::relocate): Likewise.
9799         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9800         Likewise.
9801         (Target_arm::scan_reloc_for_stub): Likewise.
9802         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9803
9804 2010-01-19  Ian Lance Taylor  <iant@google.com>
9805
9806         * output.cc (Output_section_headers::do_sized_write): Write large
9807         segment count to sh_info field.
9808         (Output_file_header::do_sized_write): For large segment count,
9809         write PN_XNUM to e_phnum field.
9810
9811 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9812
9813         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9814         (Arm_relocate_functions::thm_jump8): New function.
9815         (Arm_relocate_functions::thm_jump11): New function.
9816         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9817         R_ARM_THM_JUMP11.
9818         (Target_arm::Scan::global): Likewise.
9819         (Target_arm::Relocate::relocate): Likewise.
9820         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9821         Likewise.
9822
9823 2010-01-14  Doug Kwan  <dougkwan@google.com>
9824
9825         * arm.cc (map, utility): Include headers.
9826         (Target_arm::apply_cortex_a8_workaround): New method.
9827         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9828         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9829         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9830         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9831         the --[no-]fix-cortex-a8 command line options.
9832         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9833         (Target_arm::relocate_stub): Use addend in instruction template.
9834         * options.h (DEFINE_bool): Set the user-set flag.
9835         (General_options): Add --[no-]-fix-cortex options.
9836         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9837         : Update fast look-up map after conversion.
9838
9839 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9840
9841         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9842         in the first pass of do_layout.
9843
9844 2010-01-13  Doug Kwan  <dougkwan@google.com>
9845
9846         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9847         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9848         apparent compiler problem of not folding static constant integral
9849         data members of elfcpp::Elf_sizes<32>.
9850
9851 2010-01-13  Doug Kwan  <dougkwan@google.com>
9852
9853         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9854         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9855         Arm_relobj::scan_section_for_cortex_a8_erratum,
9856         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9857         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9858         sections to scan for relocation stubs into a new method
9859         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9860         relocation and Cortex-A8 stub scanning.
9861         (Target_arm::do_relax): Force stubs to be after stubbed sections
9862         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9863         the beginning of a new relaxation pass.  Update a comment.
9864         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9865
9866 2010-01-12  Ian Lance Taylor  <iant@google.com>
9867
9868         * target-reloc.h (visibility_error): New inline function.
9869         (relocate_section): Call visibility_error.
9870         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9871         (MOSTLYCLEANFILES): Likewise.
9872         (protected_4_pic.o, protected_3.err): New targets.
9873         * testsuite/protected_4.cc: New file.
9874
9875 2010-01-12  Doug Kwan  <dougkwan@google.com>
9876
9877         * arm.cc (Cortex_a8_reloc): New class.
9878         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9879         and cortex_a8_relocs_info_.
9880         (Target_arm::fix_cortex_a8): New method definition.
9881         (Target_arm::Cortex_a8_relocs_info): New type.
9882         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9883         New data member declarations.
9884         (Target_arm::scan_reloc_for_stub): Record information about
9885         relocations for THUMB branches that might be exempted from the
9886         Cortex-A8 workaround.
9887         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9888         at the beginning of a relaxation pass.
9889
9890 2010-01-12  Doug Kwan  <dougkwan@google.com>
9891
9892         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9893         (Arm_relobj::Mapping_symbol_position,
9894          Arm_reloj::Mapping_symbol_position_less,
9895          Arm_relobj::Mapping_symbols_info): New types.
9896         (Target_arm::is_mapping_symbol_name): New method definition.
9897         (Arm_relobj::do_count_local_symbols): Save information about mapping
9898         symbols.
9899
9900 2010-01-11  Doug Kwan  <dougkwan@google.com>
9901
9902         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9903         Arm_relocate_functions::thumb32_branch_upper,
9904         Arm_relocate_functions::thumb32_branch_lower,
9905         Arm_relocate_functions::thumb32_cond_branch_offset,
9906         Arm_relocate_functions::thumb32_cond_branch_upper,
9907         Arm_relocate_functions::thumb32_cond_branch_lower,
9908         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9909         branch offset encoding.
9910         (Arm_relocate_functions::thumb_branch_common): Use new branch
9911         offset encoding methods to avoid code duplication.
9912         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9913         (Stub_addend_reader::operator()): Use new branch encoding method
9914         to avoid code duplication.
9915
9916 2010-01-11  Doug Kwan  <dougkwan@google.com>
9917
9918         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9919         (Target_arm::do_finalize_sections): Define special EXIDX section
9920         symbols only if referenced.
9921         * gc.h (Garbage_collection::add_reference): New method.
9922         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9923         code duplication.
9924
9925 2010-01-11  Ian Lance Taylor  <iant@google.com>
9926
9927         * script.cc (Version_script_info::build_expression_list_lookup):
9928         Change complaing about duplicate wildcard match from error to
9929         warning.
9930
9931         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9932         of 2009-12-30.
9933         (Version_script_info::Version_script_info): Initialize globs_,
9934         default_version_, default_is_global_, and exact_.  Don't
9935         initialize globals_ or locals_.
9936         (Version_script_info::build_lookup_tables): Build local symbols
9937         first.
9938         (Version_script_info::unquote): New function.
9939         (Version_script_info::add_exact_match): New function.
9940         (Version_script_info::build_expression_list_lookup): Remove lookup
9941         parameter.  Add is_global parameter.  Change all callers.  Handle
9942         wildcard pattern specially.  Unquote pattern.  Call
9943         add_exact_match.
9944         (Version_script_info::get_name_to_match): New function.
9945         (Version_script_info::get_symbol_version): New function.
9946         (Version_script_info::get_symbol_version_helper): Remove.
9947         (Version_script_info::check_unmatched_names): Call unquote.
9948         * script.h (class Version_script_info): Change get_symbol_version
9949         to be non-inline and add is_global parameter; change all callers.
9950         Rewrite symbol_is_local.  Update declarations.  Define struct
9951         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9952         Remove globals_ and locals_ members.  Add exact_, globs_,
9953         default_version_, is_global_.
9954         (Version_script_info::Glob): Remove pattern, add expression and
9955         is_global.  Update constructor.  Change all callers.
9956         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9957         default version.
9958         (Versions::symbol_section_contents): If a symbol is undefined, or
9959         defined in a dynamic object, set the version index to
9960         VER_NDX_LOCAL.
9961         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9962         symbol_is_local.
9963         (Symbol_table::add_from_pluginobj): Likewise.
9964         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9965
9966 2010-01-11  Doug Kwan  <dougkwan@google.com>
9967
9968         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9969         (incremental_dump_LDADD): Add linking option for libintl.
9970         * Makefile.in: Regenerate.
9971
9972 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9973
9974         PR gold/11144
9975         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9976         instead of -Ds.
9977         * testsuite/Makefile.in: Regenerated.
9978
9979 2010-01-10  Doug Kwan  <dougkwan@google.com>
9980
9981         * options.h (DEFINE_var): Use parentheses around argument varname__
9982         in macro body to avoid any unintended subsequent substitutions.
9983
9984 2010-01-10  Ian Lance Taylor  <iant@google.com>
9985
9986         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9987         candidates before doing symbol resolution.
9988
9989         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9990         ODR candidates if only one is weak.
9991
9992 2010-01-08  Ian Lance Taylor  <iant@google.com>
9993
9994         * script.cc (Version_script_info::build_expression_list_lookup):
9995         Don't warn about ambiguous version, just record the ambiguity.
9996         (Version_script_info::get_symbol_version_helper): Give error if
9997         version is ambiguous.
9998
9999 2010-01-08  Doug Kwan  <dougkwan@google.com>
10000
10001         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10002         prev_data_size_ and prev_addralign_.  Remove initializer for
10003         deleted data member has_been_changed_.
10004         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10005         to determine if the table is empty.
10006         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10007         Remove.
10008         (Stub_table::add_reloc_stub): Define method in class definition
10009         instead of just declaring it there.
10010         (Stub_table::add_cortex_a8_stub): New method definition.
10011         (Stub_table::update_data_size_and_addralign): Ditto.
10012         (Stub_table::finalize_stubs): Ditto.
10013         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10014         (Stub_table::do_addralign_): Return address alignment in the
10015         (Stub_table::do_reset_address_and_file_offset): Define method in
10016         class definition instead of declaring it there.  Set current data
10017         size to be the data size of the previous pass.
10018         (Stub_table::set_final_data_size): Use current data size as the
10019         final data size.
10020         (Stub_table::relocate_stub): Change parameter type of stub from
10021         Reloc_stub pointer to Stub pointer.
10022         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10023         (Stub_table::Cortex_a8_stub_list): New typedef.
10024         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10025          Stub_table::prev_addralign_): New data member.
10026         (Arm_relobj::Arm_relobj): Initialize data member
10027         section_has_cortex_a8_workaround_.
10028         (Arm_relobj::section_has_cortex_a8_workaround,
10029          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10030          definitions.
10031         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10032         declarations.
10033         (Target_arm::relocate_stub): Change parameter type of stub from
10034         Reloc_stub pointer to Stub pointer.
10035         (Insn_template::size, Insn_template::alignment): Handle
10036         THUMB16_SPECIAL_TYPE.
10037         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10038          Stub_table::update_data_size_and_addralign,
10039          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10040         definitions.
10041         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10042         (Stub_table::do_write): Ditto.
10043         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10044
10045 2010-01-08  Ian Lance Taylor  <iant@google.com>
10046
10047         PR 11108
10048         * symtab.h (class Symbol): Remove fields is_target_special_ and
10049         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10050         (Symbol::is_defined_in_discarded_section): New function.
10051         (Symbol::set_is_defined_in_discarded_section): New function.
10052         (Symbol::has_plt_offset): Rewrite.
10053         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10054         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10055         Don't initialize is_target_special_ or has_plt_offset_.
10056         Initialize is_defined_in_discarded_section_.
10057         (Symbol_table::add_from_relobj): If appropriate, set
10058         is_defined_in_discarded_section.
10059         * resolve.cc (Symbol::override_base_with_special): Don't test
10060         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10061         * target-reloc.h (relocate_section): Do special handling for
10062         symbols defined in discarded sections for global symbols as well
10063         as local symbols.
10064
10065 2010-01-08  Ian Lance Taylor  <iant@google.com>
10066
10067         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10068         the SHT_SYMTAB case.
10069
10070 2010-01-08  Ian Lance Taylor  <iant@google.com>
10071
10072         * object.cc (Sized_relobj::do_layout): Don't get confused if
10073         layout_eh_frame returns NULL.
10074
10075 2010-01-08  Ian Lance Taylor  <iant@google.com>
10076
10077         PR 11084
10078         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10079         dynamic symbol table, use the normal symbol table.
10080         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10081         symbol table.
10082
10083 2010-01-08  Ian Lance Taylor  <iant@google.com>
10084
10085         PR 11072
10086         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10087         sections.
10088
10089 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10090
10091         * version.cc (print_version): Change to "Copyright 2010".
10092
10093 2010-01-08  Ian Lance Taylor  <iant@google.com>
10094
10095         PR 10287
10096         PR 11063
10097         * i386.cc (class Target_i386): Change return type of plt_section
10098         to be non-const.
10099         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10100         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10101         tls_desc_rel_ field.
10102         (Output_data_plt_i386::rel_tls_desc): New function.
10103         (Target_i386::rel_tls_desc_section): New function.
10104         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10105         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10106         R_386_TLS_DESC reloc in rel_tls_desc_section.
10107         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10108         Define struct Tlsdesc_info.
10109         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10110         (Target_x86_64::do_reloc_symbol_index): New function.
10111         (Target_x86_64::add_tlsdesc_info): New function.
10112         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10113         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10114         tlsdesc_rel_ field.
10115         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10116         all callers.
10117         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10118         (Target_x86_64::rela_tlsdesc_section): New function.
10119         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10120         handling.
10121         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10122         (Target_x86_64::do_reloc_addend): New function.
10123         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10124         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10125         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10126         (Output_reloc::type): New function.
10127         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10128         (Output_reloc::is_target_specific): New function.
10129         (Output_reloc::target_arg): New function.
10130         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10131         absolute relocs and target specific relocs.
10132         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10133         add_target_specific.
10134         (class Output_data_reloc) [SHT_RELA]: Likewise.
10135         * output.cc (Output_reloc::Output_reloc): Add four new versions
10136         for absolute relocs and target specific relocs.
10137         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10138         (Output_reloc::get_symbol_index): Likewise.
10139         (Output_reloc::local_section_offset): Check that local_sym_index_
10140         is not TARGET_CODE or 0.
10141         (Output_reloc::symbol_value): Likewise.
10142         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10143         reloc.
10144         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10145         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10146         functions.
10147         * layout.cc (add_target_dynamic_tags): Use output section for
10148         DT_PLTRELSZ and DT_JMPREL.
10149
10150 2010-01-07  Ian Lance Taylor  <iant@google.com>
10151
10152         PR 11061
10153         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10154         function.
10155         (class Output_data_reloc_generic): Define.
10156         (class Output_data_reloc_base): Change base class to
10157         Output_data_reloc_generic.  Change add() method to call
10158         bump_relative_reloc_count for a relative reloc.  Remove
10159         sort_relocs_ field.
10160         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10161         to sort_relocs().
10162         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10163         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10164         appropriate.
10165         * layout.h (class Layout): Update declaration.
10166
10167 2010-01-07  Ian Lance Taylor  <iant@google.com>
10168
10169         * output.h (class Output_data): Add const version of
10170         output_section and do_output_section.
10171         (class Output_section_data): Add const version of
10172         do_output_section.
10173         (class Output_section): Likewise.
10174         * layout.cc (Layout::add_target_dynamic_tags): New function.
10175         * layout.h (class Layout): Update declarations.
10176         * arm.cc (Target_arm::do_finalize_sections): Use
10177         add_target_dynamic_tags.
10178         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10179         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10180         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10181         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10182
10183 2010-01-07  Ian Lance Taylor  <iant@google.com>
10184
10185         PR 11042
10186         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10187         object as needed.
10188
10189 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10190             Ian Lance Taylor  <iant@google.com>
10191
10192         PR 11019
10193         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10194         Xindex::read_symtab_xindex.
10195
10196 2010-01-07  Doug Kwan  <dougkwan@google.com>
10197
10198         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10199         (Insn_template::thumb16_bcond_insn): New method declaration.
10200         (Insn_template): Fix spelling.
10201         (Stub::thumb16_special): New method declaration.
10202         (Stub::do_write): Define virtual method which was previously pure
10203         virtual.
10204         (Stub::do_thumb16_special): New method declaration.
10205         (Stub::do_fixed_endian_write): New template member.
10206         (Reloc_stub::do_write): Remove.
10207         (Reloc_stub::do_fixed_endian_write): Remove.
10208         (Cortex_a8_stub): New class definition.
10209         (Stub_factory::make_cortex_a8_stub): New method definition.
10210         (Stub_factory::Stub_factory): Add missing static storage class
10211         qualifier for elf32_arm_stub_a8_veneer_blx.
10212
10213 2010-01-07  Ian Lance Taylor  <iant@google.com>
10214
10215         PR 10980
10216         * options.h (class General_options): Add --warn-unresolved-symbols
10217         and --error-unresolved-symbols.
10218         * errors.cc (Errors::undefined_symbol): Implement
10219         --warn-unresolved-symbols.
10220
10221         * options.h (class General_options): Add -z text and -z textoff.
10222         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10223
10224 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10225
10226         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10227         (Garbage_collection::cident_sections): New function.
10228         (Garbage_collection::add_cident_section): New function.
10229         (Garbage_collection::cident_sections_): New member.
10230         (gc_process_relocs): Add references to sections whose names are C
10231         identifiers.
10232         * gold.h (cident_section_start_prefix): New constant.
10233         (cident_section_stop_prefix): New constant.
10234         (is_cident): New function.
10235         * layout.cc (Layout::define_section_symbols): Replace string constants
10236         with the newly defined constants.
10237         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10238         C identifiers.
10239         * testsuite/Makefile.am: Add gc_orphan_section_test.
10240         * testsuite/Makefile.in: Regenerate.
10241         * testsuite/gc_orphan_section_test.cc: New file.
10242         * testsuite/gc_orphan_section_test.sh: New file.
10243
10244 2010-01-06  Ian Lance Taylor  <iant@google.com>
10245
10246         PR 10980
10247         * options.h (class General_options): Add --warn-shared-textrel.
10248         * layout.cc (Layout::finish_dynamic_section): Implement
10249         --warn-shared-textrel.
10250
10251         PR 10980
10252         * options.h (class General_options): Add --warn-multiple-gp.
10253
10254 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10255
10256         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10257         $(THREADSLIB) and $(LIBDL).
10258         * Makefile.in: Rebuild.
10259
10260 2010-01-06  Ian Lance Taylor  <iant@google.com>
10261
10262         PR 10980
10263         * options.cc (General_options::parse_section_start): New function.
10264         (General_options::section_start): New function.
10265         (General_options::General_options): Initialize all members.
10266         * options.h: Include <map>
10267         (class General_options): Add --section-start.  Add section_starts_
10268         member.
10269         * layout.cc (Layout::attach_allocated_section_to_segment): If
10270         --section-start was used, set the address of the segment.  Remove
10271         local sort_sections.
10272         (Layout::relaxation_loop_body): If the address of the load segment
10273         has been set by --section-start, don't use it.
10274         * output.h (Output_segment::update_flags_for_output_section): New
10275         function.
10276         * output.cc (Output_segment::add_output_section): Call
10277         update_flags_for_output_section.
10278
10279 2010-01-05  Ian Lance Taylor  <iant@google.com>
10280
10281         PR 10980
10282         * options.h (class General_options): Add --undefined-version.
10283         * script.cc (struct Version_expression): Add was_matched_by_symbol
10284         field.
10285         (Version_script_info::matched_symbol): New function.
10286         (Version_script_info::get_symbol_version_helper): Call
10287         matched_symbol.
10288         (Version_script_info::check_unmatched_names): New function.
10289         * script.h (class Version_script_info): Update declarations.
10290         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10291
10292         * options.h (class General_options): Use DEFINE_bool_alias for
10293         allow_multiple_definition.
10294         * resolve.cc (Symbol_table::should_override): Don't test
10295         allow_multiple_definition.
10296
10297         PR 10980
10298         * options.h (class General_options): Add --cref.
10299         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10300         until after printing cref table.
10301         * cref.cc: Include "symtab.h".
10302         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10303         (Cref_table_compare::operator()): New function.
10304         (Cref_inputs::gather_cref): New function.
10305         (filecol): New static const.
10306         (Cref_inputs::print_cref): New function.
10307         (Cref::print_cref): New function.
10308         * cref.h: Include <cstdio>.
10309         (class Cref): Update declarations.
10310         * mapfile.h (Mapfile::file): New function.
10311         * object.h (class Object): Define Symbols.  Declare virtual
10312         do_get_global_symbols.
10313         (Object::get_global_symbols): New function.
10314         * object.cc (Input_objects::add_object): Pass object to cref_ if
10315         --cref.
10316         (Input_objects::archive_start): Likewise.
10317         (Input_objects::archive_stop): Likewise.
10318         (Input_objects::print_cref): New function.
10319         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10320         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10321         --cref.
10322         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10323         function.
10324         * plugin.h (class Sized_pluginobj): Update declarations.
10325
10326 2010-01-05  Ian Lance Taylor  <iant@google.com>
10327
10328         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10329         to is_default_version.  Rename insdef to insdefault.
10330         (Symbol_table::add_from_relobj): Rename def to is_default_version
10331         and local to is_forced_local.
10332         (Symbol_table::add_from_pluginobj): Likewise.
10333         (Symbol_table::add_from_dynobj): Likewise.
10334         (Symbol_table::define_special_symbol): Rename insdef to
10335         insdefault.
10336
10337 2010-01-04  Ian Lance Taylor  <iant@google.com>
10338
10339         PR 10980
10340         * options.h (class General_options): Add
10341         --allow-multiple-definition and -z muldefs.
10342         * resolve.cc (Symbol_table::should_override): Don't warn about a
10343         multiple symbol definition if --allow-multiple-definition or -z
10344         muldefs.
10345
10346         PR 10980
10347         * options.h (class General_options): Add --add-needed and
10348         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10349         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10350         error if --copy-dt-needed-entries aka --add-needed is used and
10351         would cause a change in behaviour.
10352
10353         PR 10980
10354         * options.h (class General_options): Add -G as a short version of
10355         --shared.  Add no-op options -assert, -g, and -i.
10356
10357 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10358
10359         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10360         check for .text or .gnu.linkonce.t sections.
10361         * icf.cc (Icf::find_identical_sections): Ditto.
10362         Change the detection for mangled function name within the section
10363         name.
10364         * icf.h (is_section_foldable_candidate): New function.
10365
10366 2009-12-30  Ian Lance Taylor  <iant@google.com>
10367
10368         PR 10980
10369         * options.h (class General_options): Permit two dashes with
10370         --retain-symbols-file.
10371
10372 2009-12-30  Ian Lance Taylor  <iant@google.com>
10373
10374         PR 10979
10375         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10376         don't put the file header and segment headers in the text
10377         segment.
10378
10379         PR 10979
10380         * common.cc (Sort_commons::operator()): Stabilize sort when both
10381         entries are NULL.
10382         (Symbol_table::do_allocate_commons_list): When allocating common
10383         symbols, skip a symbol which is no longer common.
10384         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10385         an object before checking its type.
10386         * testsuite/common_test_2.c: New file.
10387         * testsuite/common_test_3.c: New file.
10388         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10389         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10390         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10391         (common_test_2_pic.o, common_test_2.so): New targets.
10392         (common_test_3_pic.o, common_test_3.so): New targets.
10393         * testsuite/Makefile.in: Rebuild.
10394
10395         PR 10979
10396         * script.cc (read_input_script): If we see a new SECTIONS clause,
10397         and we have added an input section, give an error.
10398         * layout.h (class Layout): Add have_added_input_section function.
10399         Add have_added_input_section_ field.
10400         * layout.cc (Layout::Layout): Initialize
10401         have_added_input_section_.
10402         (Layout::layout): Set have_added_input_section_.
10403         (Layout::layout_eh_frame): Likewise.
10404
10405 2009-12-30  Ian Lance Taylor  <iant@google.com>
10406
10407         PR 10931
10408         * options.h (class General_options): Add --sort-common option.
10409         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10410         * common.cc (Sort_common): Add sort_order parameter to
10411         constructor.  Add sort_order_ field.
10412         (Sort_commons::operator): Check sort_order_.
10413         (Symbol_table::allocate_commons): Determine the sort order.
10414         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10415         Change all callers.
10416         (Symbol_table::do_allocate_commons_list): Likewise.
10417
10418 2009-12-30  Ian Lance Taylor  <iant@google.com>
10419
10420         PR 10916
10421         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10422         symbols from this object, don't change the visibility of an
10423         undefined symbol.
10424         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10425
10426 2009-12-30  Ian Lance Taylor  <iant@google.com>
10427
10428         PR 10861
10429         * script.h (class Version_script_info): Define Language enum.
10430         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10431         new fields globals_, locals_, and is_finalized_.
10432         * script.cc: Various formatting fixes.
10433         (class Parser_closure): Change language_stack_ from a vector of
10434         std::string to one of Version_script_info::Language.  Adjust all
10435         uses accordingly.
10436         (class Lazy_demangler): Remove.
10437         (struct Version_expression): Change language from std::string to
10438         Version_script_info::Language.
10439         (Version_script_info::Version_script_info): New function.
10440         (Version_script_info::~Version_script_info): Don't call clear.
10441         (Version_script_info::finalize): New function.
10442         (Version_script_info::build_lookup_tables): New function.
10443         (Version_script_info::build_expression_list_lookup): New
10444         function.
10445         (Version_script_info::get_symbol_version_helper): Rewrite to use
10446         lookup tables.
10447         (Version_script_info::print_expression_list): Adjust to use
10448         Version_script_info::Language.
10449         (script_push_lex_into_version_mode): Check that the version script
10450         has not been finalized.
10451         (version_script_push_lang): Change language string to
10452         Version_script_info::Language.
10453         * options.cc (Command_line::version_script): New function.
10454         * options.h (class General_options): Add finalize_dynamic_list
10455         function.  Change version_script from declaration to definition.
10456         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10457         * testsuite/version_script.map: Remove duplicate def of foo.
10458         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10459         version_script.map.
10460         * testsuite/Makefile.in: Rebuild.
10461
10462 2009-12-30  Ian Lance Taylor  <iant@google.com>
10463
10464         PR 10843
10465         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10466         if the input symbol index is 0, make the output symbol index 0.
10467
10468 2009-12-30  Ian Lance Taylor  <iant@google.com>
10469
10470         PR 10670
10471         * options.h (class General_options): Add -x/--discard-all.
10472         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10473         --discard-all.  If the local symbol needs a dynamic entry, check
10474         that before handling --discard-locals.
10475
10476 2009-12-30  Ian Lance Taylor  <iant@google.com>
10477
10478         PR 10450
10479         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10480         flags to PF_R.
10481         (Output_segment::add_output_section): Don't change the flags if
10482         the type is PT_TLS.
10483
10484         PR 10450
10485         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10486         GNU hash table if they need a dynamic value.  Otherwise, don't add
10487         them if they are defined in a dynamic object or are forced local.
10488
10489 2009-12-29  Ian Lance Taylor  <iant@google.com>
10490
10491         PR 10450
10492         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10493         .gnu.hash table for a 32-bit target.
10494
10495         PR 10450
10496         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10497         regular and a dynamic object only needs a dynamic symbol table
10498         entry if it is externally visible.
10499
10500         PR 10450
10501         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10502         constructor.  Add global_offset_table_ field.
10503         (Target_i386::got_section): Set global_offset_table_.
10504         (Target_i386::do_finalize_sections): Set global_offset_table_
10505         size.
10506         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10507         in constructor.  Add global_offset_table_ field.
10508         (Target_x86_64::got_section): Set global_offset_table_.
10509         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10510         size.
10511
10512         * layout.cc (Layout::Layout): Initialize increase_relro_.
10513         (Layout::get_output_section): Add is_relro, is_last_relro, and
10514         is_first_non_relro parameters.  Change all callers.
10515         (Layout::choose_output_section): Likewise.
10516         (Layout::add_output_section_data): Likewise.
10517         (Layout::make_output_section): Likewise.
10518         (Layout::set_segment_offsets): Clear increase_relro when using a
10519         linker script.
10520         * layout.h (class Layout): Add increase_relro method.  Add
10521         increase_relro_ field.  Update declarations.
10522         * output.cc (Output_section::Output_section): Initialize
10523         is_last_relro_ and is_first_non_relro_.
10524         (Output_segment::add_output_section): Group relro sections is
10525         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10526         (Output_segment::maximum_alignment): Remove relro handling.
10527         (Output_segment::set_section_addresses): Add increase_relro
10528         parameter.  Change all callers.  Add initial alignment to align
10529         relro sections on separate page.  Remove old relro handling.
10530         (Output_segment::set_section_list_addresses): Remove in_relro
10531         parameter.  Change all callers.
10532         (Output_segment::set_offset): Add increase parameter.  Change all
10533         callers.  Remove old relro handling.
10534         * output.h (class Output_section): Add new methods: is_last_relro,
10535         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10536         Add is_last_relro_ and is_first_non_relro_ fields.
10537         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10538         Create separate .got.plt section.  Call increase_relro.
10539         * x86_64.cc (Target_x86_64::got_section): Likewise.
10540         * testsuite/relro_script_test.t: Add .got.plt.
10541
10542         PR 10450
10543         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10544         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10545         (Layout::finalize): Call set_dynamic_symbol_size.
10546         (Layout::set_dynamic_symbol_size): New function.
10547         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10548         set_dynamic_symbol_size.
10549
10550         PR 10450
10551         * output.h (class Output_section): Add is_entsize_zero_ field.
10552         * output.cc (Output_section::Output_section): Initialize
10553         is_entsize_zero_.
10554         (Output_section::set_entsize): If two different entsizes are
10555         requested, force it to zero.
10556         (Output_section::add_input_section): Set flags for .debug_str
10557         before updating section flags.  Set entsize.
10558         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10559         and SHF_STRING if all input sections have those flags.
10560
10561 2009-12-29   Rafael Espindola  <espindola@google.com>
10562
10563         * main.cc (main): Fix the sys time reporting.
10564         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10565         reporting.
10566
10567 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10568
10569         * options.cc (General_options::parse_version): Allow -v to exit
10570         without an error if there is nothing to link.
10571
10572 2009-12-29  Ian Lance Taylor  <iant@google.com>
10573
10574         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10575         using a version of gcc before 4.1.
10576         * configure: Rebuild.
10577
10578 2009-12-28  Chris Demetriou  <cgd@google.com>
10579
10580         * attributes.cc (Output_attributes_section_data::do_write): Use
10581         std::vector::front rather than std::vector::data.
10582
10583 2009-12-28  Ian Lance Taylor  <iant@google.com>
10584
10585         * symtab.h (class Symbol_table): Add enum Defined.
10586         * resolve.cc (Symbol_table::should_override): Add defined
10587         parameter.  Change all callers.  Test whether object is NULL
10588         before calling a method on it.
10589         (Symbol_table::report_resolve_problem): Add defined parameter.
10590         Change all callers.
10591         (Symbol_table::should_override_with_special): Likewise.
10592         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10593         parameter.  Change all callers.
10594         (Symbol_table::do_define_in_output_data): Likewise.
10595         (Symbol_table::define_in_output_segment): Likewise.
10596         (Symbol_table::do_define_in_output_segment): Likewise.
10597         (Symbol_table::define_as_constant): Likewise.
10598         (Symbol_table::do_define_as_constant): Likewise.
10599         * script.h (class Symbol_assignment): Add is_defsym parameter to
10600         constructor; change all callers.
10601         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10602         parameter.  Change all callers.  Add is_defsym_ field.
10603         (class Parser_closure): Add parsing_defsym parameter to
10604         constructor; change all callers.  Add parsing_defsym accessor
10605         function.  Add parsing_defsym_ field.
10606
10607 2009-12-28  Ian Lance Taylor  <iant@google.com>
10608
10609         * gold.cc (queue_middle_tasks): Fix formatting.
10610         * object.cc (Relobj::is_section_name_included): Likewise.
10611
10612 2009-12-23  Ian Lance Taylor  <iant@google.com>
10613
10614         * i386.cc (Target_i386::do_calls_non_split): Recognize
10615         -fsplit-stack prologue for a function with a static chain.
10616         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10617         -fsplit-stack prologue when using %r11.
10618
10619 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10620
10621         * options.cc (General_options::parse_version): Make -v continue and do
10622         the link like GNU ld does.
10623
10624 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10625
10626         * Makefile.am (CCFILES): Add timer.cc.
10627         (HFILES): Add timer.h.
10628         * configure.ac: Check for sysconf and times.
10629         * main.cc: include timer.h.
10630         (main): Use Timer instead of get_run_time.
10631         * timer.cc: New.
10632         * timer.h: New.
10633         * workqueue.cc: include timer.h.
10634         (Workqueue::find_and_run_task):
10635         Report user, sys and wall time.
10636         * Makefile.in: Regenerate.
10637         * config.in: Regenerate.
10638         * configure: Regenerate.
10639
10640 2009-12-16  Doug Kwan  <dougkwan@google.com>
10641
10642         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10643         sections.
10644         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10645         relaxed input sections.
10646         * output.cc (Output_section::find_relaxed_input_section): Change
10647         return type to Output_relaxed_input_section pointer.  Adjust code
10648         for new type of relaxed_input_section_map_.
10649         * output.h (Output_section::find_relaxed_input_section): Change
10650         return type to Output_relaxed_input_section pointer.
10651         (Output_section::Output_relaxed_input_section_by_input_section_map):
10652         New type.
10653         (Output_section::relaxed_input_section_map_): Change type to
10654         Output_section::Output_relaxed_input_section_by_input_section_map.
10655         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10656         input section.
10657
10658 2009-12-15  Ian Lance Taylor  <iant@google.com>
10659
10660         * layout.cc (Layout::create_shstrtab): Only write out after input
10661         sections if we are compressing debug sections.
10662
10663 2009-12-15  Ian Lance Taylor  <iant@google.com>
10664
10665         * archive.cc (Archive::add_symbols): Only look up a symbol without
10666         a version if there is, in fact, a version.
10667
10668 2009-12-14  Ian Lance Taylor  <iant@google.com>
10669
10670         Revert -Wshadow changes, all changes from:
10671         2009-12-11  Doug Kwan  <dougkwan@google.com>
10672         2009-12-11  Nick Clifton  <nickc@redhat.com>
10673         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10674
10675 2009-12-11  Doug Kwan  <dougkwan@google.com>
10676
10677         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10678         due to -Wshadow.
10679         * attributes.cc (Object_attribute::size): Ditto.
10680         (Attributes_section_data::size): Ditto.
10681         (Attributes_section_data::Attributes_section_data): Ditto.
10682         (Output_attributes_section_data::do_write): Ditto.
10683         * attributes.h (Object_attribute::set_type): Ditto.
10684         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10685
10686 2009-12-11  Nick Clifton  <nickc@redhat.com>
10687
10688         * archive.cc: Fix shadowed variable warnings.
10689         * arm.cc: Likewise.
10690         * compressed_output.cc: Likewise.
10691         * compressed_output.h: Likewise.
10692         * configure: Likewise.
10693         * dwarf_reader.cc: Likewise.
10694         * dynobj.cc: Likewise.
10695         * dynobj.h: Likewise.
10696         * ehframe.cc: Likewise.
10697         * ehframe.h: Likewise.
10698         * errors.cc: Likewise.
10699         * expression.cc: Likewise.
10700         * fileread.cc: Likewise.
10701         * fileread.h: Likewise.
10702         * freebsd.h: Likewise.
10703         * i386.cc: Likewise.
10704         * icf.cc: Likewise.
10705         * incremental.h: Likewise.
10706         * layout.cc: Likewise.
10707         * layout.h: Likewise.
10708         * mapfile.cc: Likewise.
10709         * merge.cc: Likewise.
10710         * merge.h: Likewise.
10711         * object.cc: Likewise.
10712         * object.h: Likewise.
10713         * options.h: Likewise.
10714         * output.cc: Likewise.
10715         * output.h: Likewise.
10716         * parameters.cc: Likewise.
10717         * plugin.cc: Likewise.
10718         * powerpc.cc: Likewise.
10719         * reduced_debug_output.cc: Likewise.
10720         * reduced_debug_output.h: Likewise.
10721         * reloc.cc: Likewise.
10722         * reloc.h: Likewise.
10723         * resolve.cc: Likewise.
10724         * script-sections.cc: Likewise.
10725         * script.cc: Likewise.
10726         * script.h: Likewise.
10727         * sparc.cc: Likewise.
10728         * symtab.cc: Likewise.
10729         * symtab.h: Likewise.
10730         * target-select.cc: Likewise.
10731         * target-select.h: Likewise.
10732         * token.h: Likewise.
10733         * workqueue.cc: Likewise.
10734         * workqueue.h: Likewise.
10735         * x86_64.cc: Likewise.
10736
10737 2009-12-10  Doug Kwan  <dougkwan@google.com>
10738
10739         * arm.cc (attributes.h): New include.
10740         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10741         (Arm_relobj::~Arm_relobj): Delete object pointed by
10742         attributes_section_data_.
10743         (Arm_relobj::attributes_section_data): New method definition.
10744         (Arm_relobj::attributes_section_data_): New data member declaration.
10745         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10746         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10747         attributes_section_data_.
10748         (Arm_dynobj::attributes_section_data): New method definition.
10749         (Arm_dynobj::attributes_section_data_): New data member declaration.
10750         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10751         initialization value of may_use_blx_ to false.
10752         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10753         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10754         object attributes to compute results instead of hard-coding.
10755         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10756         Target_arm::get_secondary_compatible_arch,
10757         Target_arm::set_secondary_compatible_arch
10758         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10759         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10760         New method declarations.
10761         (Target_arm::get_aeabi_object_attribute): New method definition.
10762         (Target_arm::attributes_section_data_): New data member declaration.
10763         (read_arm_attributes_section): New template definition.
10764         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10765         (Arm_dynobj::do_read_symbols): Ditto.
10766         (Target_arm::do_finalize_sections): Merge attributes sections from
10767         input.  Check for BLX use after attributes section merging.
10768         Fix __exidx_start and __exidx_end visibility.  Create an
10769         .ARM.attributes section if necessary.
10770         (Target_arm::get_secondary_compatible_arch,
10771         Target_arm::set_secondary_compatible_arch,
10772         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10773         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10774         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10775         New method definitions.
10776
10777 2009-12-09  Ian Lance Taylor  <iant@google.com>
10778
10779         * plugin.cc (Plugin::load): Don't cast from void* to a function
10780         pointer.
10781
10782 2009-12-09  Ian Lance Taylor  <iant@google.com>
10783
10784         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10785         information fields.
10786
10787 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10788
10789         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10790         Replace two_file_shared_1.so with two_file_shared_2.so.
10791         * testsuite/Makefile.in: Regenerated.
10792
10793 2009-12-08  Doug Kwan  <dougkwan@google.com>
10794
10795         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10796         (HFILES): Add attributes.h and int_encoding.h.
10797         * Makefile.in: Regenerate.
10798         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10799         function definitions to int_encoding.cc
10800         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10801         prototypes to int_encoding.h
10802         * reduced_debug_output.cc (int_encoding.h): New include.
10803         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10804         function definitions to int_encoding.cc
10805         (insert_into_vector, read_from_pointer): Move template definitions to
10806         int_encoding.h
10807         * attributes.cc: New file.
10808         * attributes.h: New file.
10809         * int_encoding.cc: New file.
10810         * int_encoding.h: New file.
10811
10812 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10813
10814         PR gold/11055
10815         * incremental-dump.cc (dump_incremental_inputs): New.
10816         (main): Use dump_incremental_inputs.
10817
10818 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10819
10820         PR gold/10893
10821         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10822         checking elfcpp::STT_FUNC.
10823         (Target_i386::Relocate::relocate): Likewise.
10824         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10825
10826         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10827         symbols from shared libraries into normal FUNC symbols.
10828
10829         * symtab.h (Symbol): Add is_func and use it.
10830
10831 2009-12-05  Doug Kwan  <dougkwan@google.com>
10832
10833         * arm.cc (Target_arm::arm_info): Initialize new fields
10834         attributes_section and attributes_vendor.
10835         * i386.cc (Target_i386::i386_info): Same.
10836         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10837         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10838         fields attributes_section and attributes_vendor.
10839         * sparc.cc (Target_sparc::sparc_info): Same.
10840         * target.h (Target::attributes_section, Target::attributes_vendor,
10841         Target::is_attributes_section, Target::attribute_arg_type,
10842         Target::attributes_order): New method definitions.
10843         (Target::Target_info::attributes_section,
10844         Target::Target_info::attributes_vendor): New fields.
10845         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10846         virtual method definitions.
10847         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10848         attributes_section and attributes_vendor.
10849         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10850
10851 2009-12-05  Doug Kwan  <dougkwan@google.com>
10852
10853         * arm.cc: Update comments about interworking and stub generation.
10854         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10855         considered as non-PIC.
10856         (Arm_relocate_functions::base_abs): Fix formatting.
10857         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10858         of function to use GOT entry address instead of offset.
10859         (Target_arm::Scan::global): Issue an error if a symbol would need a
10860         PLT does not get one because it is untyped.  Remove code to create
10861         dynamic symbols for relative branches.
10862         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10863         takes unsigned integer instead of boolean.
10864
10865 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10866
10867         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10868         (two_file_test_LDADD): Likewise.
10869         (common_test_1_LDADD): Likewise.
10870         (exception_test_LDADD) Likewise.
10871         (weak_test_LDADD): Likewise.
10872         (many_sections_test_LDADD): Likewise.
10873         (initpri1_LDADD): Likewise.
10874         (script_test_1_LDADD): Likewise.
10875         (script_test_2_LDADD): Likewise.
10876         (justsyms_LDADD): Likewise.
10877         (binary_test_LDADD): Likewise.
10878         (large_LDADD): Likewise.
10879         * testsuite/Makefile.in: Regenerated.
10880
10881 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10882
10883         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10884         (Symbol_table::override_with_special): Likewise.
10885         (Symbol_table::add_from_object): Likewise.
10886
10887 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10888
10889         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10890         Don't set the data_offset twice.
10891
10892 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10893
10894         * testsuite/Makefile.in: Regenerate.
10895
10896 2009-12-03  Doug Kwan  <dougkwan@google.com>
10897
10898         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10899         (Target_arm::do_finalize_sections): Add parameter for symbol table
10900         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10901         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10902         parameter for symbol table pointer.
10903         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10904         an additional parameter for a pointer to symbol table.
10905         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10906         parameter for a symbol table pointer.
10907         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10908         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10909         Ditto.
10910         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10911         parameter for a symbol table pointer.
10912
10913 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10914
10915         * incremental.cc (Incremental_inputs_header)
10916         (Incremental_inputs_header_write, Incremental_inputs_entry)
10917         (Incremental_inputs_entry_write): Move ...
10918         * incremental.h (Incremental_inputs_header)
10919         (Incremental_inputs_header_write, Incremental_inputs_entry)
10920         (Incremental_inputs_entry_write): here.
10921
10922 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10923
10924         * incremental.cc (make_sized_incremental_binary): Set the target.
10925         Error if it is incompatible.
10926         * output.h (Output_file): Add filename method.
10927
10928 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10929
10930         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10931         from the get_* methods.
10932
10933 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10934
10935         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10936         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10937         Write 0 for the data_offset of scripts.
10938
10939 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10940
10941         * testsuite/Makefile.am: Add the incremental_test.sh test.
10942         * testsuite/incremental_test.sh: New.
10943         * testsuite/incremental_test_1.c: New.
10944         * testsuite/incremental_test_2.c: New.
10945
10946 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10947
10948         * incremental-dump.cc (main): Fix typos.
10949
10950 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10951
10952         PR gold/11025
10953         * incremental-dump.cc (main): Use llu to print 64 bit values.
10954
10955 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10956             H.J. Lu  <hongjiu.lu@intel.com>
10957
10958         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10959         $(LIBDL).
10960         (incremental_dump_LDADD): Likewise.
10961         * Makefile.in: Regenerated.
10962
10963 2009-11-25  Doug Kwan  <dougkwan@google.com>
10964
10965         Revert:
10966
10967         2009-11-25  Doug Kwan  <dougkwan@google.com>
10968
10969                 * arm.cc (Target_arm::Target_arm): Move method definition
10970                 outside of class definition.  Add code to handle
10971                 --target1-rel, --target1-abs and --target2= options.
10972                 (Target_arm::get_reloc_reloc_type): Change method to be
10973                 non-static and const.
10974                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10975                 New data member declaration.
10976                 (Target_arm::Scan::local, Target_arm::Scan::global,
10977                 Target_arm::Relocate::relocate,
10978                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10979                 Adjust call to Target_arm::get_real_reloc_type.
10980                 (Target_arm::get_real_reloc_type): Use command line options
10981                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10982                 * options.h (--target1-rel, --target1-abs, --target2): New
10983                 ARM-only options.
10984
10985 2009-11-25  Doug Kwan  <dougkwan@google.com>
10986
10987         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10988         class definition.  Add code to handle --target1-rel, --target1-abs
10989         and --target2= options.
10990         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10991         and const.
10992         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10993         member declaration.
10994         (Target_arm::Scan::local, Target_arm::Scan::global,
10995         Target_arm::Relocate::relocate,
10996         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10997         call to Target_arm::get_real_reloc_type.
10998         (Target_arm::get_real_reloc_type): Use command line options to
10999         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11000         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11001         options.
11002
11003 2009-11-25  Doug Kwan  <dougkwan@google.com>
11004
11005         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11006         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11007         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11008         formatting.
11009         (Arm_relocate_functions::thm_call): Replace body with a call to
11010         Arm_relocate_functions::thumb_branch_common.
11011         (Arm_relocate_functions::thm_jump24,
11012         Arm_relocate_functions::thm_xpc22): New method definitions.
11013         (Arm_relocate_functions::thumb_branch_common): New method definition.
11014         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11015         operator.
11016         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11017         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11018
11019 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11020
11021         * Makefile.am: Build incremental-dump
11022         * Makefile.in: Regenerate.
11023         * incremental-dump.cc: New.
11024         * incremental.cc (Incremental_inputs_header_data,
11025         Incremental_inputs_entry_data): Move to incremental.h
11026         * incremental.h: (Incremental_inputs_header_data,
11027         Incremental_inputs_entry_data): Move from incremental.cc
11028
11029 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11030
11031         * incremental.cc (Incremental_inputs_header,
11032         Incremental_inputs_header_write, Incremental_inputs_entry,
11033         Incremental_inputs_entry_write): Add a typedef with the data type.
11034
11035 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11036
11037         * incremental.cc (Incremental_inputs_header,
11038         Incremental_inputs_header_write, Incremental_inputs_entry,
11039         Incremental_inputs_entry_write): Update comment about which
11040         type has the filed descriptions.
11041
11042 2009-11-15  Doug Kwan  <dougkwan@google.com>
11043
11044         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11045         (Arm_relocate_functions::arm_branch_common): Change method defintion
11046         in class definition to a method declaration and update list of formal
11047         parameters.
11048         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11049         Arm_relocation_functions::jump24): Adjust call to
11050         Arm_relocate_functions::arm_branch_common.  Update list of formal
11051         parameters.
11052         (Arm_relocate_functions::xpc25): New method definition.
11053         (Arm_relocate_functions::arm_branch_common): Move method defintion
11054         out from class definition.  Use stubs for mode-switching and extending
11055         branch ranges.
11056         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11057         specially.  Change code to enable use of stubs in ARM branches.
11058
11059 2009-11-10  Doug Kwan  <dougkwan@google.com>
11060
11061         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11062         in method declaration.
11063         (Target_arm::relocate_stub): New method declaration.
11064         (Target_arm::default_target): Change to return a pointer instead of
11065         a const reference.
11066         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11067         Target_arm::default_target.
11068         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11069         method definition.
11070         (Target_arm::relocate_section): Adjust view.
11071         (Target_arm::relocate_stub): New method definition.
11072
11073 2009-11-10  Doug Kwan  <dougkwan@google.com>
11074
11075         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11076         a format warning.
11077         * incremental.cc (open_incremental_binary): Initialized local
11078         variables to avoid warnings.
11079         * object.cc (make_elf_object): Ditto.
11080         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11081         a format warning.
11082
11083 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11084
11085         PR gold/10930
11086         * testsuite/plugin_test.c: Include "config.h".
11087
11088 2009-11-09  Doug Kwan  <dougkwan@google.com>
11089
11090         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11091         (arm_symbol_value): Remove.
11092         (Arm_relocate_functions::arm_branch_common,
11093         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11094         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11095         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11096         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11097         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11098         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11099         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11100         Arm_relocate_functions::thm_mobw_abs_nc,
11101         Arm_relocate_functions::thm_mov_abs,
11102         Arm_relocate_functions::movw_prel_nc,
11103         Arm_relocate_functions::thm_movt_abs,
11104         Arm_relocate_functions::movt_prel,
11105         Arm_relocate_functions::thm_movw_prel_nc,
11106         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11107         (Target_arm::Relocate::relocate): Only decompose address into two
11108         parts if relocation type uses the thumb-bit and pass the actual
11109         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11110         calls to methods in Arm_relocate_functions for this change.
11111
11112 2009-11-08  Ian Lance Taylor  <iant@google.com>
11113
11114         PR 10925
11115         * reloc.cc: Instantiate
11116         Sized_relobj::initialize_input_to_output_maps and
11117         Sized_relobj:free_input_to_output_maps.
11118
11119 2009-11-06  Ian Lance Taylor  <iant@google.com>
11120
11121         PR 10876
11122         * defstd.cc (in_segment): Set only_if_ref true for "end".
11123
11124 2009-11-06  Doug Kwan  <dougkwan@google.com>
11125
11126         * arm.cc (class Reloc_stub): Correct a comment.
11127         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11128         (Target_arm::scan_section_for_stubs): New method declaration.
11129         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11130         Change methods from private to protected.
11131         (Target_arm::do_may_relax): New method definition.
11132         (Target_arm::do_relax, Target_arm::group_sections,
11133         Target_arm::scan_reloc_for_stub,
11134         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11135         (Target_arm::arm_input_section_map_): New data member declaration.
11136         (Target_arm::scan_reloc_for_stub,
11137         Target_arm::scan_reloc_section_for_stubs,
11138         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11139         Target_arm::do_relax): New method definitions.
11140
11141 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11142
11143         * configure.ac: Check for (struct stat)::st_mtim
11144         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11145         * config.in: Regenerate.
11146         * configure: Regenerate.
11147
11148 2009-11-05  Ian Lance Taylor  <iant@google.com>
11149
11150         PR 10910
11151         * output.cc (Output_segment::add_output_section): Add missing
11152         return statement.
11153
11154 2009-11-04  Ian Lance Taylor  <iant@google.com>
11155
11156         PR 10880
11157         * object.h (class Object): Add is_needed and set_is_needed
11158         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11159         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11160         defined in a dynamic object and referenced by a regular object,
11161         set is_needed for the dynamic object.
11162         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11163         if the file is marked with as_needed and it is not needed.
11164
11165 2009-11-04  Ian Lance Taylor  <iant@google.com>
11166
11167         PR 10887
11168         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11169         tags if data is discarded by linker script.
11170         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11171         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11172         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11173         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11174
11175 2009-11-04  Ian Lance Taylor  <iant@google.com>
11176
11177         * layout.cc (Layout::get_output_section): Add is_interp and
11178         is_dynamic_linker_section parameters.  Change all callers.
11179         (Layout::choose_output_section): Likewise.
11180         (Layout::make_output_section): Likewise.
11181         (Layout::add_output_section_data): Add is_dynamic_linker_section
11182         parameter.  Change all callers.
11183         * layout.h (class Layout): Update declarations.
11184         * output.h (class Output_section): Add is_interp, set_is_interp,
11185         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11186         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11187         generate_code_fills_at_write_ to a bitfield.
11188         * output.cc (Output_section::Output_sections): Initialize new
11189         fields.
11190         (Output_segment::add_output_section): Add do_sort parameter.
11191         Change all callers.
11192
11193 2009-11-03  Ian Lance Taylor  <iant@google.com>
11194
11195         PR 10860
11196         * options.h (class General_options): Add --warn-common.
11197         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11198         merging two common symbols.
11199         (Symbol_table::should_override): Handle --warn-common when merging
11200         a common symbol with a defined symbol.  Use report_resolve_problem
11201         for multiple definitions.
11202         (Symbol_table::report_resolve_problem): New function.
11203         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11204
11205 2009-11-03  Doug Kwan  <dougkwan@google.com>
11206
11207         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11208         stub_factory_.
11209         (Target_arm::stub_factory): New method definition.
11210         (Target_arm::new_arm_input_section,
11211         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11212         Target_arm::reloc_uses_thumb_bit): New method declarations.
11213         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11214         New type definitions.
11215         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11216         member declarations.
11217         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11218         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11219         New method definitions.
11220
11221 2009-11-03  Ian Lance Taylor  <iant@google.com>
11222
11223         * options.h (class General_options): Add --warn_constructors.
11224
11225 2009-11-03  Ian Lance Taylor  <iant@google.com>
11226
11227         PR 10893
11228         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11229         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11230
11231 2009-11-03  Ian Lance Taylor  <iant@google.com>
11232
11233         PR 10895
11234         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11235         --msgid-bugs-address.
11236         (install-pdf): New target.
11237         (install-data_yes): Look up one directory to find mkinstalldirs.
11238
11239 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11240
11241         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11242         tree.
11243
11244 2009-10-30  Doug Kwan  <dougkwan@google.com>
11245
11246         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11247
11248 2009-10-30  Doug Kwan  <dougkwan@google.com>
11249
11250         * arm.cc (Stub_addend_reader): New struct template definition
11251         and partial specializations.
11252         (Stub_addend_reader::operator()): New method definition for a
11253         partially specialized template.
11254
11255 2009-10-30  Doug Kwan  <dougkwan@google.com>
11256
11257         * arm.cc (Arm_relobj::processor_specific_flags): New method
11258         definition.
11259         (Arm_relobj::do_read_symbols): New method declaration.
11260         (Arm_relobj::processor_specific_flags_): New data member declaration.
11261         (Arm_dynobj): New class definition.
11262         (Target_arm::do_finalize_sections): Add input_objects parameter.
11263         (Target_arm::do_adjust_elf_header): New method declaration.
11264         (Target_arm::are_eabi_versions_compatible,
11265         (Target_arm::merge_processor_specific_flags): New method declaration.
11266         (Target_arm::do_make_elf_object): New overloaded method definitions
11267         and declaration.
11268         (Arm_relobj::do_read_symbols): New method definition.
11269         (Arm_dynobj::do_read_symbols): Ditto.
11270         (Target_arm::do_finalize_sections): Add input_objects parameters.
11271         Merge processor-specific flags from all input objects.
11272         (Target_arm::are_eabi_versions_compatible,
11273         Target_arm::merge_processor_specific_flags,
11274         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11275         New method definitions.
11276         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11277         Input_objects pointer type parameter.
11278         * layout.cc (Layout::finalize): Pass input objects to target's.
11279         finalize_sections function.
11280         * output.cc (Output_file_header::do_sized_write): Set ELF file
11281         header's processor-specific flags.
11282         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11283         Input_objects pointer type parameter.
11284         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11285         * target.h (Input_objects): New forward class declaration.
11286         (Target::processor_specific_flags,
11287         Target::are_processor_specific_flags_sect): New method definitions.
11288         (Target::finalize_sections): Add input_objects parameter.
11289         (Target::Target): Initialize processor_specific_flags_ and
11290         are_processor_specific_flags_set_.
11291         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11292         parameter.
11293         (Target::set_processor_specific_flags): New method definition.
11294         (Target::processor_specific_flags_,
11295         Target::are_processor_specific_flags_set_): New data member
11296         declarations.
11297         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11298         Input_objects pointer type parameter.
11299
11300 2009-10-30  Doug Kwan  <dougkwan@google.com>
11301
11302         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11303
11304 2009-10-28  Ian Lance Taylor  <iant@google.com>
11305
11306         * object.h (class Relobj): Drop options parameter from
11307         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11308         do_scan_relocs, do_relocate.  Change all callers.
11309         (class Sized_relobj): Drop options parameters from
11310         do_gc_process_relocs, do_scan_relocs, do_relocate,
11311         do_relocate_sections, relocate_sections, emit_relocs_scan,
11312         emit_relocs_scan_reltype.  Change all callers.
11313         (struct Relocate_info): Remove options field and all references to
11314         it.
11315         * reloc.h (class Read_relocs): Remove options constructor
11316         parameter and options_ field.  Change all callers.
11317         (class Gc_process_relocs, class Scan_relocs): Likewise.
11318         (class Relocate_task): Likewise.
11319         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11320         all callers.
11321         (scan_relocatable_relocs): Likewise.
11322         * target.h (class Sized_target): Remove options parameter from
11323         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11324         all callers.
11325         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11326         callers.
11327         * arm.cc: Update functions to remove options parameters.
11328         * i386.cc: Likewise.
11329         * powerpc.cc: Likewise.
11330         * sparc.cc: Likewise.
11331         * x86_64.cc: Likewise.
11332         * testsuite/testfile.cc: Likewise.
11333
11334 2009-10-28  Doug Kwan  <dougkwan@google.com>
11335
11336         * arm.cc (Arm_relobj): New class definition.
11337         (Arm_relobj::scan_sections_for_stubs,
11338         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11339         New method definitions.
11340
11341 2009-10-28  Cary Coutant  <ccoutant@google.com>
11342
11343         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11344         (Plugin::cleanup_done_): New member.
11345         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11346         (Plugin_manager::cleanup_done_): Remove.
11347         (Plugin_manager::add_input_file): Edit error message.
11348         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11349         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11350
11351 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11352
11353         * fileread.cc: (File_read::View::~View): Use the new
11354         data_ownership_ filed.
11355         (File_read::~File_read): Dispose the new whole_file_view_.
11356         (File_read::open): Mmap the whole file if needed.
11357         (File_read::open): Use whole_file_view_ instead of contents_.
11358         (File_read::find_view): Use whole_file_view_ if applicable.
11359         (File_read::do_read): Use whole_file_view_ instead of contents_.
11360         (File_read::make_view): Use whole_file_view_ instead of contents_,
11361         update File_read::View::View call.
11362         (File_read::find_or_make_view): Update File_read::View::View
11363         call.
11364         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11365         remove contents_
11366         (File_read::View::Data_ownership): New enum.
11367         (File_read::View::View): Replace bool mapped_ with Data_ownership
11368         argument.
11369         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11370         (File_read::View::data_ownership_): New field.
11371         (File_read::contents_): Remove (replaced by whole_file_view_).
11372         (File_read::whole_file_view_): New field.
11373         * options.h (class General_options): Add --keep-files-mapped.
11374
11375 2009-10-27  Cary Coutant  <ccoutant@google.com>
11376
11377         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11378         * testsuite/Makefile.am (plugin_test_5): New test case.
11379         * testsuite/Makefile.in: Regenerate.
11380
11381 2009-10-25  Doug Kwan  <dougkwan@google.com>
11382
11383         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11384         from private to protected to allow access by child class.
11385         (Sized_relobj::do_relocate_sections): New method declaration.
11386         (Sized_relobj::relocate_sections): Virtualize.
11387         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11388         Sized_relobj::relocate_sections.  Instantiate template explicitly
11389         for different target sizes and endianity.
11390
11391 2009-10-24  Doug Kwan  <dougkwan@google.com>
11392
11393         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11394         (Arm_input_section::as_arm_input_section): New method.
11395         (Arm_output_section): New class definition.
11396         (Arm_output_section::create_stub_group,
11397         Arm_output_section::group_sections): New method definitions.
11398
11399 2009-10-22  Doug Kwan  <dougkwan@google.com>
11400
11401         * arm.cc (Arm_input_section): New class definition.
11402         (Arm_input_section::init, Arm_input_section:do_write,
11403         Arm_input_section::set_final_data_size,
11404         Arm_input_section::do_reset_address_and_file_offset): New method
11405         definitions.
11406
11407 2009-10-21  Doug Kwan  <dougkwan@google.com>
11408
11409         * arm.cc (Stub_table, Arm_input_section): New forward class
11410         declarations.
11411         (Stub_table): New class defintion.
11412         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11413         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11414         New method definition.
11415
11416 2009-10-21  Doug Kwan  <dougkwan@google.com>
11417
11418         * arm.cc: Update copyright comments.
11419         (Target_arm): New forward class template declaration.
11420         (Arm_address): New type.
11421         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11422         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11423         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11424         constants.
11425         (Insn_template): Same.
11426         (DEF_STUBS): New macro.
11427         (Stub_type): New enum type.
11428         (Stub_template): New class definition.
11429         (Stub): Same.
11430         (Reloc_stub): Same.
11431         (Stub_factory): Same.
11432         (Target_arm::Target_arm): Initialize may_use_blx_ and
11433         should_force_pic_veneer_.
11434         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11435         Target_arm::should_force_pic_veneer,
11436         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11437         Target_arm::using_thumb_only, Target_arm:;default_target): New
11438         method defintions.
11439         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11440         New data member declarations.
11441         (Insn_template::size, Insn_template::alignment): New method defintions.
11442         (Stub_template::Stub_template): New method definition.
11443         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11444         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11445         (Stub_factory::Stub_factory): New method definition.
11446         * gold.h (string_hash): New template.
11447         * output.h (Input_section_specifier::hash_value): Use
11448         gold::string_hash.
11449         (Input_section_specifier::string_hash): Remove.
11450         * stringpool.cc (Stringpool_template::string_hash): Use
11451         gold::string_hash.
11452
11453 2009-10-20  Doug Kwan  <dougkwan@google.com>
11454
11455         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11456         symbols of relaxed input sections.
11457         * output.h (Output_section::find_relaxed_input_section): Make
11458         method public.
11459
11460 2009-10-16  Doug Kwan  <dougkwan@google.com>
11461
11462         * dynobj.cc (Versions::Versions): Initialize version_script_.
11463         Only insert base version symbol definition for a shared object
11464         if version script defines any version versions.
11465         (Versions::define_base_version): New method definition.
11466         (Versions::add_def): Check that base version is not needed.
11467         (Versions::add_need): Define base version lazily.
11468         * dynobj.h (Versions::define_base_version): New method declaration.
11469         (Versions::needs_base_version_): New data member declaration.
11470         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11471         (check_DATA): Add no_version_test.stdout.
11472         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11473         New make rules.
11474         * testsuite/Makefile.in: Regenerate.
11475         * testsuite/no_version_test.c: New file.
11476         * testsuite/no_version_test.sh: Ditto.
11477
11478 2009-10-16  Doug Kwan  <dougkwan@google.com>
11479
11480         * expression.cc (class Segment_start_expression): New class definition.
11481         (Segment_start_expression::value): New method definition.
11482         (script_exp_function_segment_start): Return a new
11483         Segment_start_expression.
11484         * gold/script-c.h (script_saw_segment_start_expression): New function
11485         prototype.
11486         * script-sections.cc (Script_sections::Script_sections): Initialize
11487         SAW_SEGMENT_START_EXPRESSION_ to false.
11488         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11489         and -Tbbs options to specify section addresses if given in
11490         command line and no SEGMENT_START expression is seen in a script.
11491         * script-sections.h (Script_sections::saw_segment_start_expression,
11492         Script_sections::set_saw_segment_start_expression): New method
11493         definition.
11494         (Script_sections::saw_segment_start_expression_): New data member
11495         declaration.
11496         * script.cc (script_saw_segment_start_expression): New function.
11497         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11498         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11499         script_test_7.sh and script_test_8.sh.
11500         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11501         script_test_8.stdout.
11502         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11503         (script_test_6, script_test_6.stdout, script_test_7,
11504         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11505         * Makefile.in: Regenerate.
11506         * testsuite/script_test_6.sh: New file.
11507         * testsuite/script_test_6.t: Same.
11508         * testsuite/script_test_7.sh: Same.
11509         * testsuite/script_test_7.t: Same.
11510         * testsuite/script_test_8.sh: Same.
11511
11512 2009-10-16  Doug Kwan  <dougkwan@google.com>
11513
11514         * output.cc (Output_segment::set_section_list_address): Cast
11515         expressions to unsigned long long type to avoid format warnings.
11516
11517 2009-10-15  Ian Lance Taylor  <iant@google.com>
11518
11519         * script.cc (Script_options::add_symbol_assignment): Always add a
11520         dot assignment to script_sections_.
11521         * script-sections.cc (Script_sections::add_dot_assignment):
11522         Initialize if necessary.
11523
11524         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11525         program headers with no load segment if there is a linker script.
11526
11527         * layout.cc (Layout::set_segment_offsets): Align the file offset
11528         to the segment aligment for -N or -n with no load segment.
11529         * output.cc (Output_segment::add_output_section): Don't crash if
11530         the first section is a TLS section.
11531         (Output_segment::set_section_list_addresses): Print an error
11532         message if the address moves backward in a linker script.
11533         * script-sections.cc
11534         (Output_section_element_input::set_section_addresses): Don't
11535         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11536         (Orphan_output_section::set_section_addresses): Likewise.
11537
11538 2009-10-15  Doug Kwan  <dougkwan@google.com>
11539
11540         * layout.cc (Layout::finish_dynamic_section): Generate tags
11541         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11542         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11543         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11544
11545 2009-10-14  Ian Lance Taylor  <iant@google.com>
11546
11547         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11548         fields.
11549         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11550         data_shdr fields of relinfo.
11551         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11552         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11553         R_386_TLS_LDO_32, adjust based on section flags.
11554         (Target_i386::Relocate::fix_up_ldo): Remove.
11555
11556 2009-10-13  Ian Lance Taylor  <iant@google.com>
11557
11558         Add support for -pie.
11559         * options.h (class General_options): Add -pie and
11560         --pic-executable.
11561         (General_options::output_is_position_independent): Test -pie.
11562         (General_options::output_is_executable): Return true if not shared
11563         and not relocatable.
11564         (General_options::output_is_pie): Remove.
11565         * options.cc (General_options::finalize): Reject incompatible uses
11566         of -pie.
11567         * gold.cc (queue_middle_tasks): A -pie link is not static.
11568         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11569         * symtab.cc (Symbol::final_value_is_known): Return false if
11570         output_is_position_independent.
11571         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11572         output_is_position_independent.
11573         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11574         output_is_position_independent.
11575         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11576         output_is_position_independent.
11577         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11578         two_file_pie_test.
11579         (basic_pie_test.o, basic_pie_test): New targets.
11580         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11581         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11582         (two_file_pie_test): New target.
11583         * testsuite/Makefile.in: Rebuild.
11584         * README: Remove note saying that -pie is not supported.
11585
11586 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11587
11588         * options.h (class General_options): Add -init and -fini.
11589         * layout.cc (Layout::finish_dynamic_section): Emit
11590         given init and fini functions.
11591
11592 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11593
11594         * gc.h (gc_process_relocs): Check if icf is enabled using new
11595         function.
11596         * gold.cc (queue_initial_tasks): Likewise.
11597         (queue_middle_tasks): Likewise.
11598         * object.cc (do_layout): Likewise.
11599         * symtab.cc (is_section_folded): Likewise.
11600         * main.cc (main): Likewise.
11601         * reloc.cc (Read_relocs::run): Likewise.
11602         (Sized_relobj::do_scan_relocs): Likewise.
11603         * icf.cc (is_function_ctor_or_dtor): New function.
11604         (Icf::find_identical_sections): Check if function is ctor or dtor when
11605         safe icf is chosen.
11606         * options.h (General_options::icf): Change option to be an enum.
11607         (Icf_status): New enum.
11608         (icf_enabled): New method.
11609         (icf_safe_folding): New method.
11610         (set_icf_status): New method.
11611         (icf_status_): New variable.
11612         * (options.cc) (General_options::finalize): Set icf_status_.
11613         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11614         icf_test and icf_keep_unique_test to use the --icf enum flag.
11615         * testsuite/icf_safe_test.sh: New file.
11616         * testsuite/icf_safe_test.cc: New file.
11617
11618 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11619
11620         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11621         includes to gc.h and icf.h.
11622         * arm.cc: Include gc.h.
11623         * gold.cc: Likewise.
11624         * i386.cc: Likewise.
11625         * powerpc.cc: Likewise.
11626         * sparc.cc: Likewise.
11627         * x86_64.cc: Likewise.
11628         * gc.h: Include icf.h.
11629
11630 2009-10-11  Ian Lance Taylor  <iant@google.com>
11631
11632         * plugin.cc: Include "gold.h" before other header files.
11633
11634 2009-10-10  Chris Demetriou  <cgd@google.com>
11635
11636         * options.h (Input_file_argument::Input_file_type): New enum.
11637         (Input_file_argument::is_lib_): Replace with...
11638         (Input_file_argument::type_): New member.
11639         (Input_file_argument::Input_file_argument): Take Input_file_type
11640         'type' rather than boolean 'is_lib' as second argument.
11641         (Input_file_argument::is_lib): Use type_.
11642         (Input_file_argument::is_searched_file): New function.
11643         (Input_file_argument::may_need_search): Handle is_searched_file.
11644         * options.cc (General_options::parse_library): Support -l:filename.
11645         (General_options::parse_just_symbols): Update for Input_file_argument
11646         changes.
11647         (Command_line::process): Likewise.
11648         * archive.cc (Archive::get_file_and_offset): Likewise.
11649         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11650         * script.cc (read_script_file, script_add_file): Likewise.
11651         * fileread.cc (Input_file::Input_file): Likewise.
11652         (Input_file::will_search_for): Handle is_searched_file.
11653         (Input_file::open): Likewise.
11654         * readsyms.cc (Read_symbols::get_name): Likewise.
11655         * testsuite/Makefile.am (searched_file_test): New test.
11656         * testsuite/Makefile.in: Regenerate.
11657         * testsuite/searched_file_test.cc: New file.
11658         * testsuite/searched_file_test_lib.cc: New file.
11659
11660 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11661             Ian Lance Taylor  <iant@google.com>
11662
11663         * descriptor.cc: Include <cstdio> and "binary-io.h".
11664         (Descriptors::open): Open the files in binary mode always.
11665         * script.cc (Lex::get_token): Treat \r as whitespace.
11666
11667 2009-10-09  Ian Lance Taylor  <iant@google.com>
11668
11669         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11670
11671 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11672             Ian Lance Taylor  <iant@google.com>
11673
11674         * configure.ac: Check for readv function also.
11675         * fileread.cc (readv): Define if not HAVE_READV.
11676         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11677         does not exist.
11678         * config.in: Regenerate.
11679         * configure: Regenerate.
11680
11681 2009-10-09  Doug Kwan  <dougkwan@google.com>
11682
11683         * layout.cc (Layout::make_output_section): Call target hook to make
11684         ordinary output section.
11685         (Layout::finalize): Adjust parameter list of call the
11686         Target::may_relax().
11687         * layout.h (class Layout::section_list): New method.
11688         * merge.h (Output_merge_base::entsize): Change visibility to public.
11689         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11690         New methods.
11691         (Output_merge_string::do_is_string): New method.
11692         * object.cc (Sized_relobj::do_setup): renamed from
11693         Sized_relobj::set_up.
11694         * object.h (Sized_relobj::adjust_shndx,
11695         Sized_relobj::initializ_input_to_output_maps,
11696         Sized_relobj::free_input_to_output_maps): Change visibilities to
11697         protected.
11698         (Sized_relobj::setup): Virtualize.
11699         (Sized_relobj::do_setup): New method declaration.
11700         (Sized_relobj::invalidate_section_offset,
11701         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11702         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11703         * options.cc (parse_int): New function.
11704         * options.h (parse_int): New declaration.
11705         (DEFINE_int): New macro.
11706         (stub_group_size): New option.
11707         * output.cc (Output_section::Output_section): Initialize memebers
11708         merge_section_map_, merge_section_by_properties_map_,
11709         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11710         (Output_section::add_input_section): Handled deferred code-fill
11711         generation and remove an old comment.
11712         (Output_section::add_relaxed_input_section): New method definition.
11713         (Output_section::add_merge_input_section): Use merge section by
11714         properties map to speed to search.  Update merge section maps
11715         as appropriate.
11716         (Output_section::build_relaxation_map): New method definition.
11717         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11718         Same.
11719         (Output_section::relax_input_section): Renamed to
11720         Output_section::convert_input_sections_to_relaxed_sections and change
11721         interface to take a vector of pointers to relaxed sections.
11722         (Output_section::find_merge_section,
11723         Output_section::find_relaxed_input_section): New method definitions.
11724         (Output_section::is_input_address_mapped,
11725         Output_section::output_offset, Output_section::output_address):
11726         Use output section data maps to speed up searching.
11727         (Output_section::find_starting_output_address): Add comments.
11728         (Output_section::do_write,
11729         Output_section::write_to_postprocessing_buffer): Do code-fill
11730         generation as appropriate.
11731         (Output_section::get_input_sections): Invalidate relaxed input section
11732         map.
11733         (Output_section::restore_states): Adjust type of checkpoint .
11734         Invalidate relaxed input section map.
11735         * output.h (Output_merge_base): New class declaration.
11736         (Input_section_specifier): New class defintion.
11737         (class Output_relaxed_input_section) Change base class to
11738         Output_section_data_build.
11739         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11740         base class initializer.
11741         (Output_section::add_relaxed_input_section): New method declaration.
11742         (Output_section::Input_section): Change visibility to protected.
11743         (Output_section::Input_section::relobj,
11744         Output_section::Input_section::shndx): Handle relaxed input sections.
11745         Output_section::input_sections) Change visibility to protected.  Also
11746         define overload to return a non-const pointer.
11747         (Output_section::Merge_section_properties): New class defintion.
11748         (Output_section::Merge_section_by_properties_map,
11749         Output_section::Output_section_data_by_input_section_map,
11750         Output_section::Relaxation_map): New types.
11751         (Output_section::relax_input_section): Rename method to
11752         Output_section::convert_input_sections_to_relaxed_sections and change
11753         interface to take a vector of relaxed section pointers.
11754         (Output_section::find_merge_section,
11755         Output_section::find_relaxed_input_section,
11756         Output_section::build_relaxation_map,
11757         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11758         New method declarations.
11759         (Output_section::merge_section_map_
11760         Output_section::merge_section_by_properties_map_,
11761         Output_section::relaxed_input_section_map_,
11762         Output_section::is_relaxed_input_section_map_valid_,
11763         Output_section::generate_code_fills_at_write_): New data members.
11764         * script-sections.cc
11765         (Output_section_element_input::set_section_addresses): Call
11766         current_data_size and addralign methods of relaxed input sections.
11767         (Orphan_output_section::set_section_addresses): Call current_data_size
11768         and addralign methods of relaxed input sections.
11769         * symtab.cc (Symbol_table::compute_final_value): Extract template
11770         from the body of Symbol_table::sized_finalize_symbol.
11771         (Symbol_table::sized_finalized_symbol): Call
11772         Symbol_table::compute_final_value.
11773         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11774         (Symbol_table::compute_final_value): New templated method declaration.
11775         * target.cc (Target::do_make_output_section): New method defintion.
11776         * target.h (Target::make_output_section): New method declaration.
11777         (Target::relax): Add more parameters for input objects, symbol table
11778         and layout.  Adjust call to do_relax.
11779         (Target::do_make_output_section): New method declaration.
11780         (Target::do_relax): Add parameters for input objects, symbol table
11781         and layout.
11782
11783 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11784
11785         * pread.c: Include stdio.h.
11786
11787 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11788
11789         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11790         defined.
11791
11792 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11793
11794         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11795         Change read_shndx type to unsigned int.
11796         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11797         int.
11798         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11799         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11800         Change read_shndx type to unsigned int.
11801         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11802         int.
11803         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11804         * layout.cc (Layout::create_symtab_sections): Cast the result of
11805         local_symcount * symsize to off_t in the gold_assert.
11806
11807 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11808
11809         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11810         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11811         R_ARM_BASE_ABS.
11812         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11813         (Arm_relocate_functions::thm_abs5): New function.
11814         (Arm_relocate_functions::abs12): New function.
11815         (Arm_relocate_functions::abs16): New function.
11816         (Arm_relocate_functions::base_abs): New function.
11817         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11818         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11819         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11820         R_ARM_BASE_ABS.
11821         (Scan::global): Likewise.
11822         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11823         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11824         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11825         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11826         R_ARM_BASE_ABS.
11827
11828 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11829
11830         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11831         (Arm_relocate_functions::movt_prel): New function.
11832         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11833         (Arm_relocate_functions::thm_movt_prel): New function.
11834         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11835         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11836         (Scan::global, Relocate::relocate): Likewise.
11837         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11838
11839 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11840
11841         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11842         Incremental_checker.
11843         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11844         unsigned int.
11845         (class Incremental_inputs_header): New class.
11846         (Incremental_inputs_header_writer): Edit comment.
11847         (Incremental_inputs_entry): New class.
11848         (Incremental_inputs_entry_writer): Edit comment.
11849         (Sized_incremental_binary::do_find_incremental_inputs_section):
11850         Add *strtab_shndx parameter, fill it.
11851         (Sized_incremental_binary::do_check_inputs): New method.
11852         (Incremental_checker::can_incrementally_link_output_file): Use
11853         Sized_incremental_binary::check_inputs.
11854         (Incremental_inputs::report_command_line): Save command line in
11855         command_line_.
11856         * incremental.h:
11857         (Incremental_binary::find_incremental_inputs_section): New
11858         method.
11859         (Incremental_binary::do_find_incremental_inputs_section): Add
11860         strtab_shndx parameter.
11861         (Incremental_binary::do_check_inputs): New pure virtual method.
11862         (Sized_incremental_binary::do_check_inputs): Declare.
11863         (Incremental_checker::Incremental_checker): Add incremental_inputs
11864         parameter, use it to initialize incremental_inputs_.
11865         (Incremental_checker::incremental_inputs_): New field.
11866         (Incremental_checker::command_line): New method.
11867         (Incremental_checker::inputs): New method.
11868         (Incremental_checker::command_line_): New field.
11869
11870 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11871
11872         * incremental.cc: Include <cstdarg> and "target-select.h".
11873         (vexplain_no_incremental): New function.
11874         (explain_no_incremental): New function.
11875         (Incremental_binary::error): New method.
11876         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11877         method.
11878         (make_sized_incremental_binary): New function.
11879         (open_incremental_binary): New function.
11880         (can_incrementally_link_file): Add checks if output is ELF and has
11881         inputs section.
11882         * incremental.h: Include "elfcpp_file.h" and "output.h".
11883         (Incremental_binary): New class.
11884         (Sized_incremental_binary): New class.
11885         (open_incremental_binary): Declare.
11886         * object.cc (is_elf_object): Use
11887         elfcpp::Elf_recognizer::is_elf_file.
11888         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11889         * output.h (Output_file::filesize): New method.
11890
11891 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11892
11893         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11894         New function.
11895         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11896         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11897         function.
11898         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11899         function.
11900         (Arm_relocate_functions::movw_abs_nc): New function.
11901         (Arm_relocate_functions::movt_abs): New function.
11902         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11903         (Arm_relocate_functions::thm_movt_abs): New function.
11904         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11905         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11906         (Scan::global): Likewise.
11907         (Relocate::relocate): Likewise.
11908         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11909
11910 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11911
11912         * arm.cc (Arm_relocate_functions::got_prel) New function.
11913         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11914         (Relocate::relocate): Likewise.
11915         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11916
11917 2009-10-06  Ian Lance Taylor  <iant@google.com>
11918
11919         * options.h (class General_options): Define
11920         split_stack_adjust_size parameter.
11921         * object.h (class Object): Add uses_split_stack_ and
11922         has_no_split_stack_ fields.  Add uses_split_stack and
11923         has_no_split_stack accessor functions.  Declare
11924         handle_split_stack_section.
11925         (class Reloc_symbol_changes): Define.
11926         (class Sized_relobj): Define Function_offsets.  Declare
11927         split_stack_adjust, split_stack_adjust_reltype, and
11928         find_functions.
11929         * object.cc (Object::handle_split_stack_section): New function.
11930         (Sized_relobj::do_layout): Call handle_split_stack_section.
11931         * dynobj.cc (Sized_dynobj::do_layout): Call
11932         handle_split_stack_section.
11933         * reloc.cc (Sized_relobj::relocate_sections): Call
11934         split_stack_adjust for executable sections in split_stack
11935         objects.  Pass reloc_map to relocate_section.
11936         (Sized_relobj::split_stack_adjust): New function.
11937         (Sized_relobj::split_stack_adjust_reltype): New function.
11938         (Sized_relobj::find_functions): New function.
11939         * target-reloc.h: Include "object.h".
11940         (relocate_section): Add reloc_symbol_changes parameter.  Change
11941         all callers.
11942         * target.h (class Target): Add calls_non_split method.  Declare
11943         do_calls_non_split virtual method.  Declare match_view and
11944         set_view_to_nop.
11945         * target.cc: Include "elfcpp.h".
11946         (Target::do_calls_non_split): New function.
11947         (Target::match_view): New function.
11948         (Target::set_view_to_nop): New function.
11949         * gold.cc (queue_middle_tasks): Give an error if mixing
11950         split-stack and non-split-stack objects with -r.
11951         * i386.cc (Target_i386::relocate_section): Add
11952         reloc_symbol_changes parameter.
11953         (Target_i386::do_calls_non_split): New function.
11954         * x86_64.cc (Target_x86_64::relocate_section): Add
11955         reloc_symbol_changes parameter.
11956         (Target_x86_64::do_calls_non_split): New function.
11957         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11958         parameter.
11959         * powerpc.cc (Target_powerpc::relocate_section): Add
11960         reloc_symbol_changes parameter.
11961         * sparc.cc (Target_sparc::relocate_section): Add
11962         reloc_symbol_changes parameter.
11963         * configure.ac: Call AM_CONDITIONAL for the default target.
11964         * configure: Rebuild.
11965         * testsuite/Makefile.am (TEST_AS): New variable.
11966         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11967         (check_DATA): Add split_i386 and split_x86_64 files.
11968         (SPLIT_DEFSYMS): Define.
11969         (split_i386_[1234n].o): New targets.
11970         (split_i386_[124]): New targets.
11971         (split_i386_[1234r].stdout): New targets.
11972         (split_x86_64_[1234n].o): New targets.
11973         (split_x86_64_[124]): New targets.
11974         (split_x86_64_[1234r].stdout): New targets.
11975         (MOSTLYCLEANFILES): Add new executables.
11976         * testsuite/split_i386.sh: New file.
11977         * testsuite/split_x86_64.sh: New file.
11978         * testsuite/split_i386_1.s: New file.
11979         * testsuite/split_i386_2.s: New file.
11980         * testsuite/split_i386_3.s: New file.
11981         * testsuite/split_i386_4.s: New file.
11982         * testsuite/split_i386_n.s: New file.
11983         * testsuite/split_x86_64_1.s: New file.
11984         * testsuite/split_x86_64_2.s: New file.
11985         * testsuite/split_x86_64_3.s: New file.
11986         * testsuite/split_x86_64_4.s: New file.
11987         * testsuite/split_x86_64_n.s: New file.
11988         * testsuite/testfile.cc (Target_test): Update relocation_section
11989         function.
11990         * testsuite/Makefile.in: Rebuild.
11991
11992 2009-10-06  Ian Lance Taylor  <iant@google.com>
11993
11994         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11995         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11996         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11997         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11998         the address on ldo_addrs_.
11999         (Target_i386::Relocate::fix_up_ldo): New function.
12000
12001 2009-10-06   Rafael Espindola  <espindola@google.com>
12002
12003         * plugin.cc (add_input_library): New.
12004         (Plugin::load): Add add_input_library to tv.
12005         (Plugin_manager::add_input_file): Add the is_lib argument.
12006         (add_input_file): Update call to Plugin_manager::add_input_file.
12007         (add_input_library): New.
12008         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12009
12010 2009-09-30  Doug Kwan  <dougkwan@google.com>
12011
12012         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12013         symbol and call Symbol::may_need_copy_reloc to determine if
12014         a copy reloc is needed.
12015         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12016         nocopyreloc is given in command line.
12017         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12018         given in command line.
12019         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12020         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12021         of the removed Target_i386::may_need_copy_reloc.
12022         * options.h (copyreloc): New option with default value false.
12023         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12024         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12025         instead of the removed Target_powerpc::may_need_copy_reloc.
12026         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12027         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12028         instead of the removed Target_sparc::may_need_copy_reloc.
12029         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12030         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12031         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12032         instead of the removed Target_x86_64::may_need_copy_reloc.
12033
12034 2009-09-30  Ian Lance Taylor  <iant@google.com>
12035
12036         * object.h (class Object): Remove target_ field, and target,
12037         sized_target, and set_target methods.
12038         (Object::sized_target): Remove.
12039         (class Sized_relobj): Update declarations.  Remove sized_target.
12040         * object.cc (Sized_relobj::setup): Remove target parameter.
12041         Change all callers.
12042         (Input_objects::add_object): Don't do anything with the target.
12043         (make_elf_sized_object): Add punconfigured parameter.  Change all
12044         callers.  Set or test parameter target.
12045         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12046         Change all callers.
12047         * parameters.cc (Parameters::set_target): Change parameter type to
12048         be non-const.
12049         (Parameters::default_target): Remove.
12050         (set_parameters_target): Change parameter type to be non-const.
12051         (parameters_force_valid_target): New function.
12052         (parameters_clear_target): New function.
12053         * parameters.h (class Parameters): Update declarations.  Remove
12054         default_target method.  Add sized_target and clear_target
12055         methods.  Change target_ to be non-const.
12056         (set_parameters_target): Update declaration.
12057         (parameters_force_valid_target): Declare.
12058         (parameters_clear_target): Declare.
12059         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12060         as NULL if we aren't searching.
12061         (Add_symbols::run): Don't check for compatible target.
12062         * fileread.cc (Input_file::open_binary): Call
12063         parameters_force_valid_target.
12064         * gold.cc (queue_middle_tasks): Likewise.
12065         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12066         set_target on object.
12067         * dynobj.h (class Sized_dynobj): Update declarations.
12068         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12069         make_elf_object returns NULL.
12070         (Archive::include_member): Don't check whether object target is
12071         compatible.
12072         * output.cc (Output_section::add_input_section): Get target from
12073         parameters.
12074         (Output_section::relax_input_section): Likewise.
12075         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12076         parameters.
12077         (Sized_relobj::do_scan_relocs): Likewise.
12078         (Sized_relobj::relocate_sections): Likewise.
12079         * resolve.cc (Symbol_table::resolve): Likewise.
12080         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12081         parameter.  Change all callers.
12082         (Symbol_table::add_from_object): Get target from parameters.
12083         (Symbol_table::add_from_relobj): Don't check object target.
12084         (Symbol_table::add_from_dynobj): Likewise.
12085         (Symbol_table::define_special_symbol): Get target from
12086         parameters.
12087         * symtab.h (class Symbol_table): Update declaration.
12088         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12089         parameter.  Change all callers.  Clear parameter target.
12090         (Binary_test): Test target here.
12091         * testsuite/object_unittest.cc (gold_testsuite): Remove
12092         target_test_pointer parameter.  Change all callers.
12093         (Object_test): Test target here.
12094
12095 2009-09-26  Ian Lance Taylor  <iant@google.com>
12096
12097         * testsuite/initpri1.c: Don't try to use constructor priorities if
12098         compiling with gcc before 4.3.
12099
12100 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12101
12102         * testsuite/retain_symbols_file_test.sh (check_present): Change
12103         output file name to retain_symbols_file_test.stdout.
12104         (check_absent): Likewise.
12105
12106 2009-09-18  Craig Silverstein  <csilvers@google.com>
12107
12108         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12109         * options.cc: Include <cerrno> and <fstream>.
12110         (General_options::finalize): Parse -retain-symbols-file tag.
12111         * options.h: New flag.
12112         (General_options): New method should_retain_symbol, new
12113         variable symbols_to_retain.
12114         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12115         should_retain_symbol map.
12116         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12117         * testsuite/Makefile.in: Regenerate.
12118         * testsuite/retain_symbols_file_test.sh: New file.
12119
12120 2009-09-18  Nick Clifton  <nickc@redhat.com>
12121
12122         * po/es.po: Updated Spanish translation.
12123
12124 2009-09-17  Doug Kwan  <dougkwan@google.com>
12125
12126         * debug.h (DEBUG_RELAXATION): New constant.
12127         (DEBUG_ALL): Add DEBUG_RELAXATION.
12128         (debug_string_to_enum): Add relaxation debug option.
12129         * layout.cc
12130         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12131         Layout::Relaxation_debug_check::read_sections,
12132         Layout::Relaxation_debug_check::read_sections): New method definitions.
12133         (Layout::Layout): Initialize data members
12134         record_output_section_data_from_scrips_,
12135         script_output_section_data_list_ and relaxation_debug_check_.
12136         (Layout::save_segments, Layout::restore_segments,
12137         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12138         Layout::relaxation_loop_body): New method definitions.
12139         (Layout::finalize): Support relaxation.  Move section layout code to
12140         Layout::relaxation_loop_body.
12141         (Layout::set_asection_address_from_script): Move code for orphan
12142         section placement out.
12143         (Layout::place_orphan_sections_in_script): New method definition.
12144         * layout.h (Output_segment_headers, Output_file_header):
12145         New forward class declarations.
12146         (Layout::~Layout): Define.
12147         (Layout::new_output_section_data_from_script): New method definition.
12148         (Layout::place_orphan_sections_in_script): New method declaration.
12149         (Layout::Segment_states): New type declaration.
12150         (Layout::save_segments, Layout::restore_segments,
12151         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12152         Layout::relaxation_loop_body): New method declarations.
12153         (Layout::Output_section_data_list): New type declaration.
12154         (Layout::Relaxation_debug_check): New class definition.
12155         (Layout::record_output_section_data_from_script_,
12156         Layout::script_output_section_data_list_, Layout::segment_states_,
12157         Layout::relaxation_debug_check_): New data members.
12158         * output.cc: (Output_section_headers::do_size): New method definition.
12159         (Output_section_headers::Output_section_headers): Move size
12160         computation to Output_section_headers::do_size.
12161         (Output_segment_headers::do_size): New method definition.
12162         (Output_file_header::Output_file_header): Move size computation to
12163         Output_file_header::do_size and call it.
12164         (Output_file_header::do_size): New method definition.
12165         (Output_data_group::Output_data_group): Adjust call to
12166         Output_section_data.
12167         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12168         (Output_symtab_xindex::do_write): Add array bound check.
12169         (Output_section::Input_section::print_to_mapfile): Handle
12170         RELAXED_INPUT_SECTION_CODE.
12171         (Output_section::Output_section): Initialize data member checkpoint_.
12172         (Output_section::~Output_section): Delete checkpoint object pointed
12173         by checkpoint_.
12174         (Output_section::add_input_section): Always add an Input_section if
12175         relaxing.
12176         (Output_section::add_merge_input_section): Add assert.
12177         (Output_section::relax_input_section): New method definition.
12178         (Output_section::set_final_data_size): Set load address to zero for
12179         an unallocated section.
12180         (Output_section::do_address_and_file_offset_have_reset_values):
12181         New method definition.
12182         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12183         Handle relaxed input section.
12184         (Output_section::sort_attached_input_sections): Checkpoint input
12185         section list lazily.
12186         (Output_section::get_input_sections): Change type of input_sections to
12187         list of Simple_input_section pointers.  Checkpoint input section list
12188         lazily.  Also handle relaxed input sections.
12189         (Output_section::add_input_section_for_script): Take a reference to
12190         a Simple_input_section object instead of Relobj pointer and section
12191         index as parameter.  Handle relaxed input sections.
12192         (Output_section::save_states, Output_section::restore_states): New
12193         method definitions.
12194         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12195         (Output_data::is_data_size_fixed): New method definition.
12196         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12197         if it is fixed.
12198         (Output_data::address_and_file_offset_have_reset_values): New method
12199         definition.
12200         (Output_data::do_address_and_file_offset_have_reset_values): New method
12201         definition.
12202         (Output_data::set_data_size): Check that data size is not fixed.
12203         (Output_data::fix_data_size): New method definition.
12204         (Output_data::is_data_size_fixed_): New data member.
12205         (Output_section_headers::set_final_data_size): New method definition.
12206         (Output_section_headers::do_size): New method declaration.
12207         (Output_segment_headers::set_final_data_size): New method definition.
12208         (Output_segment_headers::do_size): New method declaration.
12209         (Output_file_header::set_final_data_size)::New method definition.
12210         (Output_file_header::do_size)::New method declaration.
12211         (Output_section_data::Output_section_data): Add new parameter
12212         is_data_size_fixed and use it to fix data size.
12213         (Output_data_const::Output_data_const): Adjust call to base class
12214         constructor and fix data size.
12215         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12216         base class constructor and fix data size.
12217         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12218         base class constructor and fix data size.
12219         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12220         class constructor and fix data size.
12221         (Output_data_group::set_final_data_size): New method definition.
12222         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12223         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12224         class constructor and fix data size.
12225         (Output_relaxed_input_section): New class definition.
12226         (Output_section::Simple_input_section): New class definition.
12227         (Output_section::get_input_sections): Adjust parameter list.
12228         (Output_section::add_input_section_for_script): Same.
12229         (Output_section::save_states, Output_section::restore_states,
12230         Output_section::do_address_and_file_offset_have_reset_values,
12231         (Output_section::Input_section::Input_section): Handle
12232         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12233         Output_relaxed_input_section.
12234         (Output_section::Input_section::is_input_section,
12235         Output_section::Input_section::set_output_section): Handle relaxed
12236         input section.
12237         (Output_section::Input_section::is_relaxed_input_section,
12238         Output_section::Input_section::output_section_data,
12239         Output_section::Input_section::relaxed_input_section): New method
12240         definitions.
12241         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12242         value.
12243         (Output_section::Input_section::u1_): Update comments.
12244         (Output_section::Input_section::u2_): Add new union member poris.
12245         (Output_section::Checkpoint_output_section): New classs definition.
12246         (Output_section::relax_input_section): New method declaration.
12247         (Output_section::checkpoint_): New data member.
12248         (Output_segment): Update comments.
12249         (Output_segment::Output_segment): Un-privatize copy constructor.
12250         (Output_segment::operator=): Un-privatize.
12251         * script-sections.cc (Output_section_element::Input_section_list):
12252         Change element type to Output_section::Simple_input_section.
12253         (Output_section_element_dot_assignment::set_section_addresses):
12254         Register output section data for relaxation clean up.
12255         (Output_data_exression::Output_data_expression): Adjust call to base
12256         constructor to fix data size.
12257         (Output_section_element_data::set_section_addresses): Register
12258         Output_data_expression object for relaxation clean up.
12259         (struct Input_section_info): Replace Relobj pointer and section index
12260         pair with Output_section::Simple_input_section and Convert struct to a
12261         class.
12262         (Input_section_sorter::operator()): Adjust access to
12263         Input_section_info data member to use accessors.
12264         (Output_section_element_input::set_section_addresses): Use layout
12265         parameter.  Adjust code to use Output_section::Simple_input_section
12266         and Input_secction_info classes.  Register filler for relaxation
12267         clean up.
12268         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12269         and section index pair with Output_section::Simple_input_section
12270         class.  Adjust code accordingly.
12271         (Phdrs_element::release_segment): New method definition.
12272         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12273         segment list.
12274         (Script_sections::release_segments): New method definition.
12275         * gold/script-sections.h (Script_sections::release_segments): New
12276         method declaration.
12277         * gold/target.h (Target::may_relax, Target::relax,
12278         Target::do_may_relax, Target::do_relax): New method definitions.
12279
12280 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12281
12282         * arm.cc (has_signed_unsigned_overflow): New function.
12283         (Arm_relocate_functions::abs8): New function.
12284         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12285         (Target_arm::Scan::global): Likewise.
12286         (Target_arm::relocate::relocate): Likewise.
12287         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12288         Likewise.
12289
12290 2009-09-16  Cary Coutant  <ccoutant@google.com>
12291
12292         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12293         * testsuite/Makefile.in: Regenerate.
12294
12295 2009-09-11  Nick Clifton  <nickc@redhat.com>
12296
12297         * po/gold.pot: Updated by the Translation project.
12298
12299 2009-09-08  Cary Coutant  <ccoutant@google.com>
12300
12301         * output.cc (Output_file::open): Add execute permission to empty file.
12302         * testsuite/Makefile.am (permission_test): New test.
12303         * testsuite/Makefile.in: Regenerate.
12304
12305 2009-09-02  Ian Lance Taylor  <iant@google.com>
12306
12307         * output.cc (Output_file::resize): Call map_no_anonymous rather
12308         than map.
12309
12310 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12311
12312         * gold.cc: Include "incremental.h".
12313         (queue_initial_tasks): Call Incremental_checker methods.
12314         * incremental.cc: Include "output.h".
12315         (Incremental_checker::can_incrementally_link_output_file): New
12316         method.
12317         * incremental.h (Incremental_checker): New class.
12318
12319         * output.cc (Output_file::open_for_modification): New method.
12320         (Output_file::map_anonymous): Changed return type to bool.  Record
12321         map in base_ field.
12322         (Output_file::map_no_anonymous): New method, broken out of map.
12323         (Output_file::map): Use map_no_anonymous and map_anonymous.
12324         * output.h (class Output_file): Update declarations.
12325
12326 2009-08-24  Cary Coutant  <ccoutant@google.com>
12327
12328         * options.h (Command_line::Pre_options): New class.
12329         (Command_line::pre_options): New member.
12330         * options.cc (gold::options::ready_to_register): New variable.
12331         (One_option::register_option): Do nothing if not registering options.
12332         Assert if same short option registered twice.
12333         (General_options::General_options): Turn off option registration when
12334         done constructing.
12335         (Command_line::Pre_options::Pre_options): New constructor.
12336
12337 2009-08-24  Cary Coutant  <ccoutant@google.com>
12338
12339         * options.h (General_options::no_keep_memory): Remove incorrect
12340         short option.
12341
12342 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12343
12344         * Makefile.am (am__skiplex, am__skipyacc): New.
12345         * Makefile.in: Regenerate.
12346
12347 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12348
12349         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12350         (INCLUDES): ... this.
12351         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12352         (AM_CPPFLAGS): Renamed from ...
12353         (INCLUDE): ... this.
12354         * Makefile.in, testsuite/Makefile.in: Regenerate.
12355
12356         * Makefile.in: Regenerate.
12357         * aclocal.m4: Likewise.
12358         * config.in: Likewise.
12359         * configure: Likewise.
12360         * testsuite/Makefile.in: Likewise.
12361
12362         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12363         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12364         * Makefile.in: Regenerate.
12365         * testsuite/Makefile.in: Regenerate.
12366
12367 2009-08-19  Cary Coutant  <ccoutant@google.com>
12368
12369         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12370         symbols in shared libraries overridden by hidden or internal symbols
12371         in the main program.
12372
12373 2009-08-19  Chris Demetriou  <cgd@google.com>
12374
12375         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12376         checking source file names in error messages.
12377
12378 2009-08-18  Doug Kwan  <dougkwan@google.com>
12379
12380         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12381         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12382         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12383         an elfcpp::Ehdr as parameter.
12384         * object.cc (Object::set_target): Remove the version that looks up
12385         a target and sets it.
12386         (Sized_relobj::setup): Take a Target object instead of
12387         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12388         (make_elf_sized_object): Find target and ask target to
12389         make an ELF object.
12390         * object.h: (Object::set_target): Remove the version that looks up
12391         a target and sets it.
12392         (Sized_relobj::setup): Take a Target object instead of
12393         an elfcpp:Ehdr as parameter.
12394         * target.cc: Include dynobj.h.
12395         (Target::do_make_elf_object_implementation): New.
12396         (Target::do_make_elf_object): New.
12397         * target.h (Target::make_elf_object): New template declaration.
12398         (Target::do_make_elf_object): New method declarations.
12399         (Target::do_make_elf_object_implementation): New template declaration.
12400
12401 2009-08-14  Ian Lance Taylor  <iant@google.com>
12402
12403         * gold.h (FUNCTION_NAME): Define.
12404         (gold_unreachable): Use FUNCTION_NAME.
12405
12406 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12407
12408         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12409         symbol in the --keep-unique list is not found.
12410
12411 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12412
12413         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12414         been maked as --keep-unique.
12415         (Icf::unfold_section): New function.
12416         * icf.h (Icf::unfold_section): New function.
12417         * options.h (General_options::keep_unique): New option.
12418         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12419         * testsuite/Makefile.in: Regenerate.
12420         * testsuite/icf_keep_unique_test.sh: New file.
12421         * testsuite/icf_keep_unique_test.cc: New file.
12422
12423 2009-08-12  Cary Coutant  <ccoutant@google.com>
12424
12425         PR 10471
12426         * resolve.cc (Symbol_table::resolve): Check for references from
12427         dynamic objects to hidden and internal symbols.
12428         * testsuite/Makefile.am (hidden_test.sh): New test.
12429         * testsuite/Makefile.in: Regenerate.
12430         * testsuite/hidden_test.sh: New script.
12431         * testsuite/hidden_test_1.c: New test source.
12432         * testsuite/hidden_test_main.c: New test source.
12433
12434 2009-08-11  Doug Kwan  <dougkwan@google.com>
12435
12436         * arm.cc: Update comments.
12437         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12438         segment to locate the .ARM.exidx section if present.
12439
12440 2009-08-09  Doug Kwan  <dougkwan@google.com>
12441
12442         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12443         patch.
12444
12445 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12446         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12447         compiler warnings.
12448
12449 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12450
12451         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12452         valid tls_segment only for non-debug-section relocations.
12453         * testsuite/Makefile.am: Add gc_tls_test.
12454         * testsuite/Makefile.in: Regenerate.
12455         * testsuite/gc_tls_test.cc: New file.
12456         * testsuite/gc_tls_test.sh: New file.
12457
12458 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12459
12460         * icf.cc: New file.
12461         * icf.h: New file.
12462         * Makefile.am (CCFILES): Add icf.cc.
12463         (HFILES): Add icf.h
12464         * Makefile.in: Regenerate.
12465         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12466         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12467         section, symbol and addend information for the relocs.
12468         * gold.cc (queue_middle_tasks): Call identical code folding.
12469         * gold.h: Add defines for multimap.
12470         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12471         to the call of finalize_local_symbols.
12472         * main.cc (main): Create object of class Icf.
12473         * object.cc (Sized_relobj::do_layout): Allow this function to be
12474         called twice during icf.
12475         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12476         to sections marked as identical by icf.
12477         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12478         when available.
12479         (Sized_relobj::do_section_entsize): New function.
12480         * object.h (Object::section_entsize): New function.
12481         (Object::do_section_entsize): New pure virtual function.
12482         (Relobj::finalize_local_symbols): Add new parameter.
12483         (Relobj::do_section_entsize): New function.
12484         * options.h (General_options::icf): New option.
12485         (General_options::icf_iterations): New option.
12486         (General_options::print_icf_sections): New option.
12487         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12488         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12489         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12490         icf.
12491         * symtab.cc (Symbol_table::is_section_folded): New function.
12492         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12493         to sections marked as identical by icf.
12494         * symtab.h (Symbol_table::set_icf): New function.
12495         (Symbol_table::icf): New function.
12496         (Symbol_table::is_section_folded): New function.
12497         (Symbol_table::icf_): New data member.
12498         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12499         * testsuite/Makefile.am: Add commands to build icf_test.
12500         * testsuite/Makefile.in: Regenerate.
12501         * testsuite/icf_test.sh: New file.
12502         * testsuite/icf_test.cc: New file.
12503
12504 2009-07-24  Chris Demetriou  <cgd@google.com>
12505
12506         * layout.cc (is_compressible_debug_section): Fix incorrect
12507         comment about compressed section names.
12508
12509 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12510
12511         PR 10419
12512         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12513
12514 2009-07-16  Ian Lance Taylor  <iant@google.com>
12515
12516         PR 10400
12517         * layout.h: #include <map>.
12518         (class Kept_section): Change from struct to class.  Add accessors
12519         and setters.  Add section size to Comdat_group mapping.  Change
12520         Comdat_group to std::map.  Add is_comdat_ field.  Add
12521         linkonce_size field in union.
12522         (class Layout): Update declaration of find_or_add_kept_section.
12523         Don't declare find_kept_object.
12524         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12525         parameter.  Add object, shndx, is_comdat, and is_group_name
12526         parameters.  Change all callers.  Adjust for new Kept_section.
12527         (Layout::find_kept_object): Remove.
12528         * object.cc (Sized_relobj::include_section_group): Update use of
12529         Kept_section.  Rename secnum to shndx.  Only record
12530         Kept_comdat_section if sections are the same size.
12531         (Sized_relobj::include_linkonce_section): Update use of
12532         Kept_section.  Only record Kept_comdat_section if sections are the
12533         same size.  Set size of linkonce section.
12534         (Sized_relobj::map_to_kept_section): Update call to
12535         get_kept_comdat_section.
12536         * object.h (class Sized_relobj): Rename fields in
12537         Kept_comdat_section to drop trailing underscores; change object
12538         field to Relobj*.  Change Kept_comdat_section_table to store
12539         struct rather than pointer.
12540         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12541         Add kept_object and kept_shndx parameters.  Change all callers.
12542         (Sized_relobj::get_kept_comdat_section): Change return type to
12543         bool.  Add kept_object and kept_shndx parameters.  Change all
12544         callers.
12545         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12546         Layout::find_or_add_kept_section.
12547
12548 2009-07-09  Ian Lance Taylor  <iant@google.com>
12549
12550         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12551         Reserve space in the hash table.
12552
12553 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12554
12555         * fileread.cc (File_read::get_mtime): New method.
12556         * fileread.h (Timespec): New structure.
12557         (File_read::get_mtime): New method.
12558         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12559         Renamed from timestamp_nsec.
12560         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12561         Elf_Xword.
12562         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12563         timestamp_nsec.
12564         (Incremental_inputs::report_archive): Save mtime; style fix.
12565         (Incremental_inputs::report_obejct): Save mtime; style fix.
12566         (Incremental_inputs::report_script): Save mtime; style fix.
12567         (Incremental_inputs::finalize_inputs): Style fix.
12568         (Incremental_inputs::finalize): Style fix.
12569         (Incremental_inputs::create_input_section_data): Store inputs
12570         mtime.
12571         * incremental.h (Incremental_inputs::report_script): Add mtime
12572         argument.
12573         (Incremental_inputs::Input_info::Input_info): Intialize only one
12574         union member.
12575         (Incremental_inputs::Input_info::archive): Move to nameless
12576         union.
12577         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12578         (Incremental_inputs::Input_info::script): Move to nameless union.
12579         (Incremental_inputs::mtime): New field.
12580         * script.cc (read_input_script): Pass file mtime to
12581         Incremental_input.
12582         * script.h (Script_info::inputs): Style fix.
12583
12584 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12585
12586         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12587         instead of 32.
12588
12589 2009-06-24  Ian Lance Taylor  <iant@google.com>
12590
12591         PR 10156
12592         * layout.cc (Layout::choose_output_section): If we find an
12593         existing section, update the flags.
12594         (Layout::create_notes): New function, broken out of
12595         Layout::finalize.
12596         (Layout::finalize): Don't create note sections.
12597         (Layout::create_note): Don't crash if linker script discards
12598         section.
12599         (Layout::create_gold_note): Likewise.
12600         (Layout::create_build_id): Likewise.  Don't set
12601         after_input_sections on the section.
12602         (Layout::create_executable_stack_info): Remove target parameter.
12603         Change caller.
12604         * layout.h (class Layout): Declare create_notes.  Update
12605         declaration of create_executable_stack_info.
12606         * gold.cc (queue_middle_tasks): Call create_notes.
12607         * output.cc (Output_section::update_flags_for_input_section): Move
12608         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12609         invalid.
12610         * output.h (Output_data::mark_address_invalid): New function.
12611         (class Output_section): Only declare, not define,
12612         update_flags_for_input_section.  Remove set_flags.
12613
12614 2009-06-24  Ian Lance Taylor  <iant@google.com>
12615
12616         * script-sections.cc (Output_section_definition::
12617         set_section_addresses): Rename shadowing local load_address to
12618         laddr.
12619
12620 2009-06-24  Ian Lance Taylor  <iant@google.com>
12621
12622         PR 10244
12623         * reloc.cc (relocate_sections): Skip empty relocation sections.
12624
12625 2009-06-23  Ian Lance Taylor  <iant@google.com>
12626
12627         PR 10156
12628         * layout.cc (Layout::create_note): Use choose_output_section
12629         rather than make_output_section.
12630
12631 2009-06-23  Ian Lance Taylor  <iant@google.com>
12632
12633         PR 10237
12634         * options.cc (General_options::parse_V): Set printed_version_.
12635         (General_options::General_options): Initialize printed_version_.
12636         * options.h (class General_options): Add printed_version_ field.
12637         * gold.cc (queue_initial_tasks): If there are no input files,
12638         don't give a fatal error if we printed the version information.
12639         (queue_middle_tasks): If using -r with a shared object, give a
12640         fatal error rather than an ordinary error.
12641
12642 2009-06-23  Ian Lance Taylor  <iant@google.com>
12643
12644         PR 10219
12645         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12646         (Layout::make_output_section): Set have_stabstr_section_ if we see
12647         a .stab*str section.
12648         (Layout::finalize): Call link_stabs_sections.
12649         (Layout::link_stabs_sections): New file.
12650         * layout.h (class Layout): Add have_stabstr_section_ field.
12651         Declare link_stabs_sections.
12652
12653 2009-06-23  Doug Kwan  <dougkwan@google.com>
12654
12655         * Makefile.am (libgold_a_LIBADD): New.
12656         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12657         * Makefile.in: Regenerate.
12658         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12659         * configure: Regenerate.
12660         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12661         * fileread.cc: Include sys/state.h
12662         * gold.h: Declare memmem and strndup if found missing.
12663         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12664
12665 2009-06-23  Ian Lance Taylor  <iant@google.com>
12666
12667         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12668         * configure: Rebuild.
12669
12670 2009-06-23  Ian Lance Taylor  <iant@google.com>
12671
12672         PR 10147
12673         * object.cc (Object::section_contents): Don't try to get a view if
12674         the section has length zero.
12675         (Object::handle_gnu_warning_section): If the section is empty, use
12676         the name of the section as the warning.
12677
12678 2009-06-23  Ian Lance Taylor  <iant@google.com>
12679
12680         PR 10133
12681         * stringpool.h (class Stringpool_template): Add optimize_ field.
12682         (Stringpool_template::set_optimize): New function.
12683         * stringpool.cc (Stringpool_template::Stringpool_template):
12684         Initialize optimize_ field.
12685         (Stringpool_template::set_string_offsets): Test local optimize
12686         fild rather than parameter.
12687         * layout.cc (Layout::Layout): Call set_optimize on the section
12688         name stringpool.
12689
12690 2009-06-22  Ian Lance Taylor  <iant@google.com>
12691
12692         PR 10030
12693         * yyscript.y: Parse TARGET.
12694         * script.cc (script_set_target): New function.
12695         * script-c.h (script_set_target): Declare.
12696         * options.cc (General_options::string_to_object_format): Rename
12697         from string_to_object_format in anonymous namespace.  Change
12698         callers.
12699         * options.h (class General_options): Declare
12700         string_to_object_format.
12701
12702 2009-06-22  Ian Lance Taylor  <iant@google.com>
12703
12704         * script-sections.cc (Script_sections::create_segments): Don't put
12705         program headers in a PT_LOAD segment if -n or -N.
12706
12707 2009-06-22  Ian Lance Taylor  <iant@google.com>
12708
12709         PR 10141
12710         * options.h (class General_options): Add -z lazy and -z now.  Sort
12711         -z options into alphabetical order.
12712         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12713
12714 2009-06-21  Ian Lance Taylor  <iant@google.com>
12715
12716         * layout.cc (Layout::make_output_section): Call
12717         Target::new_output_section.
12718         (Layout::attach_allocated_section_to_segment): Put large section
12719         sections in a separate load segment with the large segment flag
12720         set.
12721         (Layout::segment_precedes): Sort large data segments after other
12722         load segments.
12723         (align_file_offset): New static function.
12724         (Layout::set_segment_offsets): Use align_file_offset.
12725         * output.h (class Output_section): Add is_small_section_ and
12726         is_large_section_ fields.
12727         (Output_section::is_small_section): New function.
12728         (Output_section::set_is_small_section):  New function.
12729         (Output_section::is_large_section): New function.
12730         (Output_section::set_is_large_section): New function.
12731         (Output_section::is_large_data_section): New function.
12732         (class Output_segment): Add is_large_data_segment_ field.
12733         (Output_segment::is_large_data_segment): New function.
12734         (Output_segment::set_is_large_data_segment): New function.
12735         * output.cc (Output_section::Output_section): Initialize new
12736         fields.
12737         (Output_segment::Output_segment): Likewise.
12738         (Output_segment::add_output_section): Add assertion that large
12739         data sections always go in large data segments.  Force small data
12740         sections to the end of the list of data sections.  Force small BSS
12741         sections to the start of the list of BSS sections.  For large BSS
12742         sections to the end of the list of BSS sections.
12743         * symtab.h (class Symbol): Declare is_common_shndx.
12744         (Symbol::is_defined): Check Symbol::is_common_shndx.
12745         (Symbol::is_common): Likewise.
12746         (class Symbol_table): Define enum Commons_section_type.  Update
12747         declarations.  Add small_commons_ and large_commons_ fields.
12748         * symtab.cc (Symbol::is_common_shndx): New function.
12749         (Symbol_table::Symbol_table): Initialize new fields.
12750         (Symbol_table::add_from_object): Put small and large common
12751         symbols in the right list.
12752         (Symbol_table::sized_finalized_symbol): Check
12753         Symbol::is_common_shndx.
12754         (Symbol_table::sized_write_globals): Likewise.
12755         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12756         common symbol lists.  Don't call do_allocate_commons_list if the
12757         list is empty.
12758         (Symbol_table::do_allocate_commons_list): Remove is_tls
12759         parameter.  Add comons_section_type parameter.  Change all
12760         callers.  Handle small and large common symbols.
12761         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12762         Symbol::is_common_shndx.
12763         * resolve.cc (symbol_to_bits): Likewise.
12764         * target.h (Target::small_common_shndx): New function.
12765         (Target::small_common_section_flags): New function.
12766         (Target::large_common_shndx): New function.
12767         (Target::large_common_section_flags): New function.
12768         (Target::new_output_section): New function.
12769         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12770         small_common_section_flags, and large_common_section_flags
12771         fields.
12772         (Target::do_new_output_section): New virtual function.
12773         * arm.cc (Target_arm::arm_info): Initialize new fields.
12774         * i386.cc (Target_i386::i386_info): Likewise.
12775         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12776         Likewise.
12777         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12778         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12779         (Target_x86_64::do_new_output_section): New function.
12780         * configure.ac: Define conditional MCMODEL_MEDIUM.
12781         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12782         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12783         (large_LDFLAGS): Define.
12784         * testsuite/large.c: New file.
12785         * testsuite/testfile.cc (Target_test::test_target_info):
12786         Initialize new fields.
12787         * configure, testsuite/Makefile.in: Rebuild.
12788
12789 2009-06-05  Doug Kwan  <dougkwan@google.com>
12790
12791         * Makefile.am (CCFILES): Add target.cc.
12792         * Makefile.in: Regenerate.
12793         * i386.cc (class Target_i386): Define new virtual method to
12794         override do_is_local_label_name in parent.
12795         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12796         local symbols if --discard-locals or -X is given.
12797         * options.h (class General_options): Declare new options
12798         '--discard-locals' and '-X' for discarding locals.
12799         * target.h (class Target): Define new methods is_local_label_name.
12800         Declare new virtual method do_is_local_label_name.
12801         * target.cc: New file.
12802         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12803         (check_SCRIPTS): Add discard_locals_test.sh.
12804         (check_DATA): Add discard_local_tests.syms.
12805         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12806         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12807         * testsuite/Makefile.in: Regenerate.
12808         * testsuite/discard_locals_test.c: New file.
12809         * testsuite/discard_locals_test.sh: Same.
12810
12811 2009-06-05  Doug Kwan  <dougkwan@google.com>
12812
12813         * object.cc (Sized_relobj::Sized_relobj): Initialize
12814         discarded_eh_frame_shndx_ to -1U.
12815         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12816         section.
12817         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12818         a discarded .eh_frame section.
12819         (Sized_relobj::do_finalize_local_symbols): Ditto.
12820         * object.h (class Sized_relobj): Declare new member
12821         discarded_eh_frame_shndx_.
12822         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12823         (local_labels_test.o, local_labels_test): New rules.
12824         * testsuite/Makefile.in: Regenerate.
12825
12826 2009-06-04  Doug Kwan  <dougkwan@google.com>
12827
12828         * layout.cc (Layout::section_name_mapping): Add mapping for
12829         special ARM sections.
12830
12831 2009-06-03  Doug Kwan  <dougkwan@google.com>
12832
12833         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12834         (utils::has_overflow): Same.
12835
12836 2009-06-03  Ian Lance Taylor  <iant@google.com>
12837
12838         * layout.cc (Layout::section_name_mapping): New array, replacing
12839         Layout::linkonce_mapping.
12840         (Layout::section_name_mapping_count): New variable, replacing
12841         Layout::linkonce_mapping_count.
12842         (Layout::linkonce_output_name): Remove.
12843         (Layout::output_section_name): Rewrite.
12844         * layout.h (class Layout): Rename Linkonce_mapping to
12845         Section_name_mapping, linkonce_mapping to section_name_mapping,
12846         linkonce_mapping_count to section_name_mapping_count.  Don't
12847         declare linkonce_output_name.
12848
12849 2009-06-03  Doug Kwan  <dougkwan@google.com>
12850
12851         * gold/arm.cc (namespace utils): New.
12852         (Target_arm::reloc_is_non_pic): Define new method.
12853         (class Arm_relocate_functions): New.
12854         (Target_arm::Relocate::relocate): Handle relocation types used by
12855         Android.
12856
12857 2009-06-03  Ian Lance Taylor  <iant@google.com>
12858
12859         * arm.cc (Target_arm::scan::global): Use || instead of |.
12860
12861 2009-06-02  Doug Kwan  <dougkwan@google.com>
12862
12863         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12864         issued_non_pic_error_.
12865         (class Target_arm::Scan): Declare new method check_non_pic.
12866         Define new method symbol_needs_plt_entry.
12867         Declare new data member issued_non_pic_error_.
12868         (class Target_arm::Relocate): Declare new method
12869         should_apply_static_reloc.
12870         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12871         (Target_arm::Scan::check_non_pic): Define new method.
12872         (Target_arm::Scan::local): Handle a small subset of reloc types used
12873         by Android.
12874         (Target_arm::Scan::local): Same.
12875         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12876
12877 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12878
12879         * incremental.cc (Incremental_inputs::report_command_line): Filter
12880         out --incremental-* options.
12881
12882 2009-05-29  Doug Kwan  <dougkwan@google.com>
12883
12884         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12885         template class.
12886         (class Target_arm): Update comment.
12887         (Target_arm::Target_arm): Initialize new data members GOT_,
12888         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12889         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12890         and Target_arm::rel_dyn_section.
12891         Declare new_enum Target_arm::Got_type.
12892         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12893         and DYNBSS_.
12894         Update commments for member do_dynsym_value.
12895         (Target_arm::got_size, Target_arm::plt_section,
12896         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12897         new methods inside class defintion.
12898         (Target_arm::got_section): Define new method.
12899         (Target_arm::rel_dyn_section): Same.
12900         (Output_data_plt_arm): New template class.
12901         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12902         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12903         (Output_data_plt_arm::add_entry): Same.
12904         (Output_data_plt_arm::first_plt_entry): Define new
12905         static data member for PLT instruction template.
12906         (Output_data_plt_arm::plt_entry): Same.
12907         (Output_data_plt_arm::do_write): Define new method.
12908         (Target_arm::make_plt_entry): Same.
12909         (Target_arm::do_finalize_sections): Same.
12910         (Target_arm::do_dynsym_value): Same.
12911
12912 2009-05-28  Doug Kwan  <dougkwan@google.com>
12913
12914         * Makefile.am (TARGETSOURCES): Add arm.cc.
12915         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12916         * Makefile.in: Regenerate.
12917         * arm.cc: New file.
12918         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12919
12920 2009-05-26  Doug Kwan  <dougkwan@google.com>
12921
12922         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12923         (General_options::check_excluded_libs): Strip off directories in
12924         archive name before matching like GNU ld does.
12925         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12926         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12927         (exclude_libs_test_LDFLAGS): Add linker option
12928         -Wl,--exclude-libs,libexclude_libs_test_3
12929         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12930         an explicit archive without using -l.
12931         (alt/libexclude_libs_test_3.a): New make rule.
12932         * testsuite/Makefile.in: Regenerate.
12933         * testsuite/exclude_libs_test.c : Declare lib3_default().
12934         (main): Call it.
12935         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12936         * exclude_libs_test_3.c: New file.
12937
12938 2009-05-26  Nick Clifton  <nickc@redhat.com>
12939
12940         * po/id.po: New Indonesian translation.
12941         * po/gold.pot: Updated template file.
12942
12943 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12944
12945         * testsuite/Makefile.am: Add -ffunction-sections to compile
12946         gc_comdat_test files.  Add -Wl,--gc-sections to build
12947         gc_comdat_test.
12948         * testsuite/Makefile.in: Regenerate.
12949         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12950
12951 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12952
12953         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12954         kept comdat section was garbage collected.
12955         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12956         * testsuite/Makefile.in: Regenerate.
12957         * testsuite/gc_comdat_test.sh: New file.
12958         * testsuite/gc_comdat_test_1.cc: New file.
12959         * testsuite/gc_comdat_test_2.cc: New file.
12960
12961 2009-05-19  Doug Kwan  <dougkwan@google.com>
12962
12963         * archive.cc (Archive::Archive): Move constructor from archive.h
12964         to here.  Initialize no_export_.
12965         (Archive::get_elf_object_for_member): Set no_export flag of object.
12966         * archive.h (Archive::Archive): Move constructor body to
12967         archive.cc.
12968         (Archive::no_export): New method.
12969         (Archive::no_export_): New field.
12970         * object.h (Object::Object): Initialize no_export_ to false.
12971         (Object::no_export, Object::set_no_export): New methods.
12972         (Object::no_export_): New field.
12973         * options.cc (General_options::parse_exclude_libs): New method.
12974         (General_options::check_excluded_libs) Same.
12975         * options.h (exclude_libs): New option.
12976         (General_options::check_excluded_libs): New method declaration.
12977         (General_options::excluded_libs_): New field.
12978         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12979         default or protected visibility if an object has no-export flag set.
12980         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12981         (check_SCRIPTS): Add exclude_libs_test.sh.
12982         (check_DATA): Add exclude_libs_test.syms.
12983         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12984         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12985         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12986         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12987         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12988         libexclude_libs_test_2.a): New rules.
12989         * testsuite/Makefile.in: Regenerate.
12990         * testsuite/exclude_libs_test.c: New file.
12991         * testsuite/exclude_libs_test.sh: Ditto.
12992         * testsuite/exclude_libs_test_1.c: Ditto.
12993         * testsuite/exclude_libs_test_2.c: Ditto.
12994
12995 2009-05-15  Ian Lance Taylor  <iant@google.com>
12996
12997         * configure.ac: Check for declarations for cases where libiberty.h
12998         checks HAVE_DECL_xxx.
12999         * configure, config.in: Rebuild.
13000
13001 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13002
13003         * gold.h (Incremental_argument_list): Remove (invalid) forward
13004         declaration.
13005         * incremental.cc (Incremental_inputs::report_achive): New method.
13006         (Incremental_inputs::report_object): New method.
13007         (Incremental_inputs::report_script): New method.
13008         (Incremental_inputs::finalize_inputs): New method.
13009         (Incremental_inputs::finalize): Call finalize_inputs().
13010         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13011         Create inputs entries.
13012         * incremental.h (Incremental_input_type): New enum.
13013         (Incremental_inputs::Incremental_input): Initialize new fields.
13014         (Incremental_inputs::report_inputs): New method.
13015         (Incremental_inputs::report_achive): New method.
13016         (Incremental_inputs::report_object): New method.
13017         (Incremental_inputs::report_script): New method.
13018         (Incremental_inputs::finalize_inputs): New method.
13019         (Incremental_inputs::Input_info): New struct.
13020         (Incremental_inputs::Input_info_map): New typedef.
13021         (Incremental_inputs::lock_): New field.
13022         (Incremental_inputs::Inputs_): New field.
13023         (Incremental_inputs::Inputs_map): New field.
13024         * main.cc (main): Call Incremental_input::report_inputs.
13025         * options.h (Input_argument_list): Typedef moved from
13026         Input_arguments.
13027         (Input_file_group::Files): Remove, use ::Input_argument_list.
13028         (Input_file_group::Input_argument_list): Remove, use
13029         ::Input_argument_list.
13030         * plugin.cc (Plugin_manager::add_input_file): Add error in
13031         incremental build.
13032         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13033         functions.
13034         * script.cc (read_input_script): Call
13035         Incremental_input::report_script.
13036         * script.h (Script_info): New class.
13037
13038 2009-04-27  Ian Lance Taylor  <iant@google.com>
13039
13040         * x86_64.cc (do_adjust_output_section): Set entsize to
13041         plt_entry_size.
13042
13043 2009-04-23  Elliott Hughes  <enh@google.com>
13044
13045         * output.cc (Output_file::close): After short writes, continue
13046         writing from the correct offset in the buffer being written.
13047
13048 2009-04-23  Chris Demetriou  <cgd@google.com>
13049
13050         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13051         * configure: Regenerate.
13052         * config.in: Regenerate.
13053         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13054         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13055
13056 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13057
13058         * incremental.cc (Incremental_inputs_header_data): Renamed from
13059         Incremental_input_header_data.
13060         (Incremental_inputs_header_data::data_size): New field.
13061         (Incremental_inputs_header_data::put_input_file_count): Renamed
13062         from input_file_count.
13063         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13064         from command_line_offset.
13065         (Incremental_inputs_header_data::put_reserved): Renamed from
13066         put_reserved.
13067         (Incremental_inputs_entry_data): Renamed from
13068         Incremental_input_entry_data.
13069         (Incremental_inputs_entry_data::data_size): New field.
13070         (Incremental_inputs::report_command_line): New method.
13071         (Incremental_inputs::finalize): New method.
13072         (Incremental_inputs::create_incremental_inputs_data): New method.
13073         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13074         * incremental.h: New file.
13075         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13076         (Layout::finalize): Create incremental inputs section in
13077         incremental builds.
13078         (Layout::create_incremental_info_sections): New method.
13079         * layout.h (Layout::incremental_inputs): New method.
13080         (Layout::create_incremental_info_sections): New method.
13081         (Layout::incremental_inputs_): New field.
13082         * main.cc (main): Notify Incremental_input of the command line.
13083
13084 2009-04-01  Ian Lance Taylor  <iant@google.com>
13085             Mikolaj Zalewski  <mikolajz@google.com>
13086
13087         * gold.h (reserve_unordered_map): Define, three versions, one for
13088         each version of Unordered_map.
13089         * layout.cc (Layout::Layout): Remove options parameter.  Add
13090         number_of_input_files parameter.  Don't initialize options_.
13091         Initialize number_of_input_files_ and resized_signatures_.  Move
13092         sections_are_attached_.
13093         (Layout::layout_group): Reserve space for group_signatures_.
13094         (Layout::find_or_add_kept_section): Change name parameter to be a
13095         reference.  Resize signatures_ map when it gets large enough.
13096         (Layout::layout_eh_frame): Use parameters->options() instead of
13097         this->options_.
13098         (Layout::make_output_section): Likewise.
13099         (Layout::attach_allocated_section_to_segment): Likewise.
13100         (Layout::finalize, Layout::create_executable_stack): Likewise.
13101         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13102         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13103         * layout.h (class Layout): Update declarations.  Remove options_
13104         field.  Add number_of_input_files_ and resized_signatures_
13105         fields.  Move sections_are_attached_ field.
13106         * main.cc (main): Pass number of input files to Layout
13107         constructor.  Don't pass options.
13108
13109 2009-03-30  Ian Lance Taylor  <iant@google.com>
13110
13111         * ffsll.c (ffsll): Correct implementation.
13112
13113 2009-03-27  Ian Lance Taylor  <iant@google.com>
13114
13115         * ffsll.c: New file.
13116         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13117         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13118         * ftruncate.c (ftruncate): Declare before definition.
13119         * mremap.c (mremap): Likewise.
13120         * pread.c (pread): Likewise.
13121         * configure, Makefile.in, config.in: Rebuild.
13122
13123         * mremap.c: New file.
13124         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13125         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13126         (mremap): Declare if HAVE_MREMAP is not defined.
13127         * configure, Makefile.in, config.in: Rebuild.
13128
13129 2009-03-27  Cary Coutant  <ccoutant@google.com>
13130
13131         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13132         position independent.
13133         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13134         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13135
13136 2009-03-24  Cary Coutant  <ccoutant@google.com>
13137
13138         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13139         an executable.
13140         (needs_dynamic_reloc): Likewise.
13141
13142 2009-03-24  Ian Lance Taylor  <iant@google.com>
13143
13144         * yyscript.y (file_cmd): Recognize EXTERN.
13145         (extern_name_list, extern_name_list_body): New nonterminals.
13146         * script.cc (script_add_extern): Define.
13147         * script-c.h (script_add_extern): Declare.
13148
13149 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13150
13151         * object.cc (is_elf_object): Define.
13152         * object.h (is_elf_object): Declare.
13153         * archive.cc (Archive::get_elf_object_for_member): Call
13154         is_elf_object.
13155         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13156
13157 2009-03-24  Elliott Hughes  <enh@google.com>
13158
13159         * output.cc (Output_file::map_anonymous): Define.
13160         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13161         try an anonymous one.  Report the size if the mmap fails.
13162         * output.h (class Output_file): Declare map_anonymous.
13163
13164 2009-03-24  Ian Lance Taylor  <iant@google.com>
13165
13166         * target-select.cc (instantiate_target): Don't acquire the lock if
13167         the instantiated_target_ field has already been set.
13168
13169 2009-03-23  Ian Lance Taylor  <iant@google.com>
13170
13171         * gold-threads.h (class Initialize_lock): Define.
13172         * gold-threads.cc (class Initialize_lock_once): Define.
13173         (initialize_lock_control): New static variable.
13174         (initialize_lock_pointer): New static variable.
13175         (initialize_lock_once): New static function.
13176         (Initialize_lock::Initialize_lock): Define.
13177         (Initialize_lock::initialize): Define.
13178         * target-select.h: Include "gold-threads.h".
13179         (class Target_selector): Add lock_ and initialize_lock_ fields.
13180         Don't define instantiate_target, just declare it.
13181         * target-select.cc (Target_selector::Target_selector): Initialize
13182         new fields.
13183         (Target_selector::instantiate_target): Define.
13184         * descriptors.h: Include "gold-threads.h".
13185         (class Descriptors): Add initialize_lock_ field.
13186         * descriptors.cc (Descriptors::Descriptors): Initialize new
13187         field.
13188         (Descriptors::open): Use initialize_lock_ field
13189         * errors.h (class Errors): Add initialize_lock_ field.
13190         * errors.cc (Errors::Errors): Initialize new field.
13191         (Errors::initialize_lock): Use initialize_lock_ field.
13192         * powerpc.cc (class Target_selector_powerpc): Remove
13193         instantiated_target_ field.  In do_recognize call
13194         instantiate_target rather than do_instantiate_target.  In
13195         do_instantiate_target just allocate a new target.
13196         * sparc.cc (class Target_selector_sparc): Likewise.
13197
13198         * freebsd.h: New file.
13199         * i386.cc: Include "freebsd.h".
13200         (Target_i386): Derive from Target_freebsd rather than
13201         Sized_target.
13202         (Target_selector_i386): Derive from Target_selector_freebsd rather
13203         than Target_selector.
13204         * x86_64.cc: Include "freebsd.h".
13205         (Target_x86_64): Derive from Target_freebsd rather than
13206         Sized_target.
13207         (Target_selector_x86_64): Derive from Target_selector_freebsd
13208         rather than Target_selector.
13209         * target.h (class Target): Add adjust_elf_header and
13210         do_adjust_elf_header.
13211         * output.cc (Output_file_header:: do_sized_write): Call target
13212         adjust_elf_header routine.
13213         * configure.tgt: Set targ_osabi.
13214         * configure.ac: Define GOLD_DEFAULT_OSABI.
13215         * parameters.cc (Parameters::default_target): Pass
13216         GOLD_DEFAULT_OSABI to select_target.
13217         * target-select.h (class Target_selector): Make instantiate_target
13218         protected rather than private.
13219         * Makefile.am (HFILES): Add freebsd.h.
13220         * configure, Makefile.in, config.in: Rebuild.
13221
13222         * merge.cc (do_add_input_section): Correct pend value.  Change
13223         message about last entry not being null terminated from error to
13224         warning.
13225
13226 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13227
13228         * incremental.cc: New file.
13229         * Makefile.am (CCFILES): Add incremental.cc.
13230         * Makefile.in: Rebuild.
13231
13232 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13233
13234         * layout.cc (Layout::output_section_name): Preserve names
13235         of '.note.' sections.
13236
13237 2009-03-19  Ian Lance Taylor  <iant@google.com>
13238
13239         * descriptors.cc (Descriptors::open): Check that the options are
13240         valid before using them.
13241
13242 2009-03-18  Ian Lance Taylor  <iant@google.com>
13243
13244         * script-sections.h: Include <list>.
13245         (class Script_sections): Change Sections_elements from std::vector
13246         to std::list.  Typedef public Elements_iterator.  Add
13247         orphan_section_placement_, data_segment_align_start_, and
13248         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13249         field.
13250         * script-sections.cc (class Orphan_section_placement): New class.
13251         (class Sections_element): Add virtual functions is_relro and
13252         orphan_section_init.  Remove virtual function place_orphan_here.
13253         (class Output_section_definition): Add is_relro and
13254         orphan_section_init.  Remove place_orphan_here.
13255         (class Orphan_output_section): Likewise.
13256         (Script_sections::Script_sections): Update for field changes.
13257         (Script_sections::data_segment_align): Set saw_data_segment_align_
13258         and data_segment_align_start_, not data_segment_align_index.
13259         (Script_sections::data_segment_relro_end): Check
13260         saw_data_segment_align_.  Use data_segment_align_start_ rather
13261         than data_segment_align_index_.
13262         (Script_sections::place_orphan): Rewrite to use
13263         Orphan_section_placement.
13264
13265 2009-03-17  Ian Lance Taylor  <iant@google.com>
13266
13267         * archive.cc (Archive::add_symbols): Check for a version attached
13268         to the symbol name in the archive map.
13269         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13270         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13271         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13272         (ver_test_11.a): New target.
13273         * testsuite/Makefile.in: Rebuild.
13274
13275         * configure.ac: Check for chsize and posix_fallocate.  Replace
13276         ftruncate.
13277         * ftruncate.c: New file, from gnulib.
13278         * output.cc (posix_fallocate): Define dummy version if not
13279         HAVE_POSIX_FALLOCATE.
13280         (Output_file::map): Call posix_fallocate rather than lseek and
13281         write.
13282         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13283         * configure, Makefile.in, config.in: Rebuild.
13284
13285 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13286
13287         * layout.h (Layout::create_note): Add section_name parameter.
13288         * layout.cc (Layout::create_note): Likewise.
13289         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13290
13291 2009-03-17  Ian Lance Taylor  <iant@google.com>
13292
13293         * descriptors.cc: Include "options.h".
13294         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13295         (Descriptors::open): Always use O_CLOEXEC when opening a new
13296         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13297         then set FD_CLOEXEC.
13298
13299         * sparc.cc (class Target_sparc): Add has_got_section.
13300         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13301         make sure we have a GOT section.
13302
13303         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13304         (Target_sparc::Scan::local): Likewise.
13305         (Target_sparc::Scan::global): Likewise.
13306         (Target_sparc::Relocate::relocate): Likewise.
13307         (Target_sparc::Relocate::relocate_tls): Likewise.
13308
13309         * symtab.cc (Symbol_table::define_default_version): New function,
13310         broken out of add_from_object.
13311         (Symbol_table::add_from_object): Call define_default_version.
13312         (Symbol_table::define_special_symbol): Add resolve_oldsym
13313         parameter.  Change all callers.  If the version for a symbol comes
13314         from a version script, resolve it with the symbol with the same
13315         name with no version.  Also add the symbol without a version if
13316         appropriate.
13317         (do_define_in_output_data): If resolving with oldsym, don't delete
13318         sym.
13319         (do_define_in_output_segment): Likewise.
13320         (do_define_as_constant): Likewise.
13321         * symtab.h (class Symbol_table): Update declarations.
13322
13323 2009-03-13  Ian Lance Taylor  <iant@google.com>
13324
13325         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13326         (Read_symbols::requeue): New function.
13327         (Read_symbols::do_read_symbols): If make_elf_object fails because
13328         the target type is not configured, and the file was searched for,
13329         issue a warning and retry with the next directory.
13330         (Add_symbols::run): If the file has an incompatible format, and
13331         it was searched for, requeue the Read_symbols task.  On error,
13332         release the object.
13333         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13334         dirindex parameter to constructor.  Change all callers.  Declare
13335         incompatible_warning and requeue.
13336         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13337         input_argument_ and input_group_ fields.  Add them to
13338         constructor.  Change all callers.
13339         (class Read_script): Add dirindex_ field.  Add it to constructor.
13340         Change all callers.
13341         * archive.cc (Archive::setup): Remove input_objects parameter.
13342         Change all callers.
13343         (Archive::get_file_and_offset): Likewise.
13344         (Archive::read_all_symbols): Likewise.
13345         (Archive::read_symbols): Likewise.
13346         (Archive::get_elf_object_for_member): Remove input_objects
13347         parameter.  Add punconfigured parameter.  Change all callers.
13348         (Archive::add_symbols): Change return type to bool.  Check return
13349         value of include_member.
13350         (Archive::include_all_members): Likewise.
13351         (Archive::include_member): Change return type to bool.  Return
13352         false if first included object has incompatible target.  Set
13353         included_member_ field.
13354         (Add_archive_symbols::run): If add_symbols returns false, requeue
13355         Read_symbols task.
13356         * archive.h (class Archive): Add included_member_ field.
13357         Initialize it in constructor.  Add input_file and searched_for
13358         methods.  Update declarations.
13359         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13360         input_argument_ fields.  Add them to constructor.  Change all
13361         callers.
13362         * script.cc: Include "target-select.h".
13363         (class Parser_closure): Add skip_on_incompatible_target_ and
13364         found_incompatible_target_ fields.  Add
13365         skip_on_incompatible_target parameter to constructor.  Change all
13366         callers.  Add methods skip_on_incompatible_target,
13367         clear_skip_on_incompatible_target, found_incompatible_target, and
13368         set_found_incompatible_target.
13369         (read_input_script): Add dirindex parameter.  Change all callers.
13370         If parser finds an incompatible target, requeue Read_symbols
13371         task.
13372         (script_set_symbol): Clear skip_on_incompatible_target in
13373         closure.
13374         (script_add_assertion, script_parse_option): Likewise.
13375         (script_start_sections, script_add_phdr): Likewise.
13376         (script_check_output_format): New function.
13377         * script.h (read_input_script): Update declaration.
13378         * script-c.h (script_check_output_format): Declare.
13379         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13380         (ignore_cmd): Remove OUTPUT_FORMAT.
13381         * fileread.cc (Input_file::Input_file): Add explicit this.
13382         (Input_file::will_search_for): New function.
13383         (Input_file::open): Add pindex parameter.  Change all callers.
13384         * fileread.h (class Input_file): Add input_file_argument method.
13385         Declare will_search_for.  Update declarations.
13386         * object.cc (make_elf_object): Add punconfigured parameter.
13387         Change all callers.
13388         * object.h (class Object): Make input_file public.  Add
13389         searched_for method.
13390         (make_elf_object): Update declaration.
13391         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13392         restart search.
13393         * dirsearch.h (class Dirsearch): Update declaration.
13394         * options.h (class General_options): Add --warn-search-mismatch.
13395         * parameters.cc (Parameters::is_compatible_target): New function.
13396         * parameters.h (class Parameters): Declare is_compatible_target.
13397         * workqueue.cc (Workqueue::add_blocker): New function.
13398         * workqueue.h (class Workqueue): Declare add_blocker.
13399
13400         * fileread.cc (Input_file::open): Remove options parameter.
13401         Change all callers.
13402         (Input_file::open_binary): Likewise.
13403         * script.cc (read_input_script): Likewise.
13404         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13405         options parameter from constructor.  Change all callers.
13406         (class Read_script): Likewise.
13407         * fileread.h (class Input_file): Update declarations.
13408         * script.h (read_input_script): Update declaration.
13409
13410 2009-03-10  Nick Clifton  <nickc@redhat.com>
13411
13412         * po/es.po: New Spanish translation.
13413
13414 2009-03-06  Cary Coutant  <ccoutant@google.com>
13415
13416         * options.cc (parse_short_option): Keep dash_z from registering itself.
13417
13418 2009-03-03  Ian Lance Taylor  <iant@google.com>
13419
13420         PR 9918
13421         * target-reloc.h (relocate_section): Pass output_section to
13422         relocate.
13423         * i386.cc (Target_i386::should_apply_static_reloc): Add
13424         output_section parameter.  Change all callers.
13425         (Target_i386::Relocate::relocate): Add output_section parameter.
13426         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13427         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13428         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13429         * testsuite/two_file_shared.sh: New script.
13430         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13431         (check_DATA): Add two_file_shared.dbg.
13432         (two_file_shared.dbg): New target.
13433         * testsuite/Makefile.in: Rebuild.
13434
13435 2009-03-01  Ian Lance Taylor  <iant@google.com>
13436
13437         * configure.ac: Check for byteswap.h.
13438         * configure: Rebuild.
13439         * config.in: Rebuild.
13440
13441 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13442
13443         * layout.cc (Layout::find_or_add_kept_section): New function.
13444         (Layout::add_comdat): Removed.
13445         * layout.h (struct Kept_section): Move out of class Layout.
13446         Remove trailing underscores from field names.  Add group_sections
13447         field.  Rename group_ field to is_group.  Change all uses.
13448         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13449         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13450         comdat_groups_ field.
13451         (Sized_relobj::include_section_group): Use
13452         find_or_add_kept_section and Kept_section::group_sections.
13453         (Sized_relobj::include_linkonce_section): Likewise.
13454         * object.cc (class Sized_relobj): Don't define Comdat_group or
13455         Comdat_group_table.  Remove find_comdat_group and
13456         add_comdat_group.  Remove comdat_groups_ field.
13457         * plugin.cc (include_comdat_group): Use
13458         Layout::find_or_add_kept_section.
13459
13460 2009-02-28  Ian Lance Taylor  <iant@google.com>
13461
13462         * README: --gc-sections and map files are now supported.  Document
13463         some build requirements.
13464
13465         PR 6992
13466         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13467         relocatable link set the value of the section symbol to zero.
13468         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13469         relocatable link don't include the section address in the local
13470         symbol value.
13471
13472 2009-02-27  Ian Lance Taylor  <iant@google.com>
13473
13474         PR 6811
13475         * options.h (class Search_directory): Add is_system_directory.
13476         (class General_options): Declare is_in_system_directory.
13477         * options.cc (get_relative_sysroot): Make static.
13478         (get_default_sysroot): Make static.
13479         (General_optoins::is_in_system_directory): New function.
13480         * fileread.cc (Input_file::is_in_system_directory): New function.
13481         * fileread.h (class Input_file): Declare is_in_system_directory.
13482         * object.h (class Object): Add is_in_system_directory.
13483         (class Input_objects): Remove system_library_directory_ field.
13484         * object.cc (Input_objects::add_object): Don't set
13485         system_library_directory_.
13486         (input_objects::found_in_system_library_directory): Remove.
13487         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13488         parameter.  Change all callers.
13489         (Symbol_table::sized_write_globals): Likewise.
13490         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13491         Call Object::is_in_system_directory.
13492         * symtab.h (class Symbol_table): Update declarations.
13493
13494         PR 5990
13495         * descriptors.h (Open_descriptor): Add is_on_stack field.
13496         * descriptors.cc (Descriptors::open): If the descriptor is on the
13497         top of the stack, remove it.  Initialize is_on_stack field.
13498         (Descriptors::release): Only add pod to stack if it is not on the
13499         stack already.
13500         (Descriptors::close_some_descriptor): Clear stack_next and
13501         is_on_stack fields.
13502
13503         PR 7091
13504         * output.cc (Output_section::find_starting_output_address): Rename
13505         from starting_output_address; add PADDR parameter; change return
13506         type.
13507         * output.h (class Output_section): Declare
13508         find_starting_output_address instead of starting_output_address.
13509         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13510         section symbol for which we can't find a merge section.
13511
13512         PR 9836
13513         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13514         hidden or internal, force the symbol to be local.
13515         * resolve.cc (Symbol::override_visibility): Define.
13516         (Symbol::override_base): Use override_visibility.
13517         (Symbol_table::resolve): Likewise.
13518         (Symbol::override_base_with_special): Likewise.
13519         (Symbol_table::override_with_special): If the visibility is hidden
13520         or internal, force the symbol to be local.
13521         * symtab.h (class Symbol): Add set_visibility and
13522         override_visibility.
13523         * testsuite/ver_test_1.sh: New file.
13524         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13525         (check_DATA): Add ver_test_1.syms.
13526         (ver_test_1.syms): New target.
13527         * testsuite/Makefile.in: Rebuild.
13528
13529 2009-02-25  Cary Coutant  <ccoutant@google.com>
13530
13531         * layout.cc (Layout::choose_output_section): Don't rename sections
13532         when using a linker script that has a SECTIONS clause.
13533         * Makefile.in: Regenerate.
13534
13535         * testsuite/Makefile.am (script_test_5.sh): New test case.
13536         * testsuite/Makefile.in: Regenerate.
13537         * testsuite/script_test_5.cc: New file.
13538         * testsuite/script_test_5.sh: New file.
13539         * testsuite/script_test_5.t: New file.
13540
13541 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13542
13543         * archive.cc (Archive::include_member): Update calls to add_symbols.
13544         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13545         the Layout argument.
13546         * dynobj.h (do_add_symbols): Add the Layout argument.
13547         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13548         Layout argument.
13549         * object.h (Object::add_symbols): Add the Layout argument.
13550         (Object::do_add_symbols): Add the Layout argument.
13551         (Sized_relobj::do_add_symbols): Add the Layout argument.
13552         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13553         Unify the two versions.
13554         (Add_plugin_symbols): Remove.
13555         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13556         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13557         (Add_plugin_symbols): Remove.
13558         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13559         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13560         (Add_symbols::run): Make it work with Pulginobj.
13561
13562 2009-02-06  Ian Lance Taylor  <iant@google.com>
13563
13564         * object.cc (Sized_relobj::do_layout): Make info message start
13565         with lower case letter.
13566
13567 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13568
13569         * binary.cc: Fix file comment.
13570
13571         * options.h (enum Incremental_disposition): Define.
13572         (class General_options): Add new options: --incremental,
13573         --incremental_changed, --incremental_unchanged,
13574         --incremental_unknown.  Add incremental_disposition_ and
13575         implicit_incremental_ fields.
13576         (General_options::incremental_disposition): New function.
13577         (class Position_dependent_options): Add incremental_disposition
13578         option.
13579         (Position_dependent_options::copy_from_options): Set incremental
13580         dispositions.
13581         * options.cc (General_options::parse_incremental_changed): New
13582         function.
13583         (General_options::parse_incremental_unchanged): New function.
13584         (General_options::parse_incremental_unknown): New function.
13585         (General_options::General_options): Initialize new fields
13586         incremental_disposition_ and implicit_incremental_.
13587         (General_options::finalize): Check for uasge of --incremental-*
13588         without --incremental.
13589
13590 2009-02-06  Chris Demetriou  <cgd@google.com>
13591
13592         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13593         pointer and to report location as the file name associated with
13594         the symbol.
13595         (gold_undefined_symbol_at_location): New function to replace the
13596         old gold_undefined_symbol functionality.
13597         * target-reloc.h (relocate_section): Update to use
13598         gold_undefined_symbol_at_location.
13599         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13600         Call gold_undefined_symbol function rather than gold_error.
13601         * errors.h (Errors::undefined_symbol): Take location as a
13602         string, rather than calculating it from a relocation.
13603         * errors.cc (Errors::fatal): Print "fatal error:" before the
13604         formatted message.
13605         (Errors::error, Errors::error_at_location): Print "error: "
13606         before the formatted message.
13607         (Errors::undefined_symbol): Take location as a string, rather
13608         than calculating it from a relocation.
13609         (gold_undefined_symbol_at_location): New function akin to
13610         old gold_undefined_symbol, calculates location from relocation.
13611         (gold_undefined_symbol): Change to take only a Symbol pointer
13612         and to report location as the file name associated with the symbol.
13613         * testsuite/debug_msg.sh: Update for changed error messages.
13614         * testsuite/undef_symbol.sh: Likewise.
13615
13616 2009-02-04  Duncan Sands  <baldrick@free.fr>
13617
13618         PR 9812
13619         * reduced_debug_output.h
13620         (Output_reduced_debug_abbrev_section::failed): Use format for
13621         gold_warning.
13622         (Output_reduced_debug_info_section::faild): Likewise.
13623
13624 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13625
13626         * script.cc (Lazy_demangler): New class.
13627         (Version_script_info::get_symbol_version_helper): Demangle a
13628         symbol only once.
13629
13630 2009-01-29  Cary Coutant  <ccoutant@google.com>
13631
13632         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13633         to __tls_get_addr.
13634         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13635
13636 2009-01-28  Ian Lance Taylor  <iant@google.com>
13637
13638         * version.cc (version_string): Bump to 1.9.
13639
13640         * gold.h: Include <cstring> and <stdint.h>.
13641         * version.cc: Include <cstdio>.
13642         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13643         warning.
13644         * reduced_debug_output.cc (insert_into_vector): Rename from
13645         Insert_into_vector; change all callers.  Use Swap_unaligned to
13646         avoid aliasing issue; remove union since it is unnecessary.
13647
13648 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13649
13650         * Makefile.am (CCFILES): Add gc.cc.
13651         (HFILES): Add gc.h.
13652         * Makefile.in: Regenerate.
13653         * gold.cc (Gc_runner): New class.
13654         (queue_initial_tasks): Call garbage collection related tasks
13655         when corresponding options are invoked.
13656         (queue_middle_gc_tasks): New function.
13657         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13658         processed early before laying out sections during garbage collection.
13659         * gold.h (queue_middle_gc_tasks): New function.
13660         (is_prefix_of): Move from "layout.cc".
13661         * i386.cc (Target_i386::gc_process_relocs): New function.
13662         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13663         * main.cc (main): Create object of class "Garbage_collection".
13664         * object.cc (Relobj::copy_symbols_data): New function.
13665         (Relobj::is_section_name_included): New function.
13666         (Sized_relobj::do_layout): Allow this function to be called twice
13667         during garbage collection and defer layout of section during the
13668         first call.
13669         * object.h (Relobj::get_symbols_data): New function.
13670         (Relobj::is_section_name_included): New function.
13671         (Relobj::copy_symbols_data): New function.
13672         (Relobj::set_symbols_data): New function.
13673         (Relobj::get_relocs_data): New function.
13674         (Relobj::set_relocs_data): New function.
13675         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13676         (Relobj::gc_process_relocs): New function.
13677         (Relobj::do_gc_process_relocs): New pure virtual function.
13678         (Relobj::sd_): New data member.
13679         (Sized_relobj::is_output_section_offset_invalid): New function.
13680         (Sized_relobj::do_gc_process_relocs): New function.
13681         * options.h (General_options::gc_sections): Modify to not be a no-op.
13682         (General_options::print_gc_sections): New option.
13683         * plugin.cc (Plugin_finish::run): Remove function call to
13684         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13685         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13686         * reloc.cc (Read_relocs::run): Add task to process relocs and
13687         determine unreferenced sections when doing garbage collection.
13688         (Gc_process_relocs): New class.
13689         (Sized_relobj::do_gc_process_relocs): New function.
13690         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13691         sections that are garbage collected.
13692         * reloc.h (Gc_process_relocs): New class.
13693         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13694         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13695         symbols whose corresponding sections are garbage collected.
13696         (Symbol_table::Symbol_table): Add new parameter for the garbage
13697         collection object.
13698         (Symbol_table::gc_mark_undef_symbols): New function.
13699         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13700         (Symbol_table::gc_mark_dyn_syms): New function.
13701         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13702         as garbage.
13703         (Symbol_table::add_from_object): Likewise.
13704         (Symbol_table::add_from_relobj): When building shared objects, do not
13705         treat externally visible symbols as garbage.
13706         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13707         table information for static and relocatable links.
13708         * symtab.h (Symbol_table::set_gc): New function.
13709         (Symbol_table::gc): New function.
13710         (Symbol_table::gc_mark_undef_symbols): New function.
13711         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13712         (Symbol_table::gc_mark_dyn_syms): New function.
13713         (Symbol_table::gc_): New data member.
13714         * target.h (Sized_target::gc_process_relocs): New pure virtual
13715         function.
13716         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13717         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13718
13719 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13720
13721         * options.h (General_options::gc_sections): Define as a no-op for now.
13722         (General_options::no_keep_memory): Ditto.
13723         (General_options::Bshareable): Define.
13724         * options.cc (General_options::finalize): Honor -Bshareable.
13725
13726 2009-01-20  Andreas Schwab  <schwab@suse.de>
13727
13728         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13729         read the value in the contents, since we don't use it.  Use the
13730         template endianness when writing.
13731         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13732
13733 2009-01-19  Andreas Schwab  <schwab@suse.de>
13734
13735         * configure.tgt (powerpc64-*): Fix targ_obj.
13736
13737 2009-01-15  Ian Lance Taylor  <iant@google.com>
13738
13739         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13740         local symbols when stripping all symbols.
13741
13742 2009-01-14  Cary Coutant  <ccoutant@google.com>
13743
13744         * output.cc (Output_reloc): Add explicit instantiations.
13745
13746 2009-01-14  Cary Coutant  <ccoutant@google.com>
13747
13748         * archive.cc (Archive::get_elf_object_for_member): Remove call
13749         to File_read::claim_for_plugin.
13750         * descriptors.cc (Descriptors::open): Remove reference to
13751         is_claimed.
13752         (Descriptors::claim_for_plugin): Remove.
13753         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13754         (Descriptors::is_claimed): Remove.
13755         (claim_descriptor_for_plugin): Remove.
13756         * fileread.cc (File_read::claim_for_plugin): Remove.
13757         * fileread.h (File_read::claim_for_plugin): Remove.
13758         (File_read::descriptor): Reopen descriptor if necessary.
13759         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13760         (Plugin_manager::all_symbols_read): Add task parameter. Change
13761         all callers.
13762         (Plugin_manager::get_input_file): New function.
13763         (Plugin_manager::release_input_file): New function.
13764         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13765         corresponding data member.
13766         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13767         and pass to base constructor. Change all callers.
13768         (get_input_file, release_input_file): New functions.
13769         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13770         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13771         (Plugin_manager::all_symbols_read): Add task parameter.
13772         (Plugin_manager::get_input_file): New function.
13773         (Plugin_manager::release_input_file): New function.
13774         (Plugin_manager::task_): New data member.
13775         (Pluginobj::Pluginobj): Add filesize parameter.
13776         (Pluginobj::filename): New function.
13777         (Pluginobj::descriptor): New function.
13778         (Pluginobj::filesize): New function.
13779         (Pluginobj::filesize_): New data member.
13780         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13781         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13782         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13783
13784         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13785         with archive libraries.
13786         * testsuite/Makefile.in: Regenerate.
13787         * testsuite/plugin_test.c (struct sym_info): New type.
13788         (get_input_file, release_input_file): New static variables.
13789         (onload): Capture new transfer vector entries.
13790         (claim_file_hook): Stop reading at end of file according to filesize.
13791         Factor out parsing of readelf output into separate function.
13792         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13793         APIs and get the source file name from the symbol table.  Convert
13794         source file name to corresponding object file name.  Print info
13795         message when adding new input files.
13796         (parse_readelf_line): New function.
13797         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13798         * testsuite/plugin_test_2.sh: Likewise.
13799         * testsuite/plugin_test_3.sh: Likewise.
13800         * testsuite/plugin_test_4.sh: New test case.
13801
13802 2009-01-07  Ian Lance Taylor  <iant@google.com>
13803
13804         * version.cc (version_string): Bump to 1.8.
13805
13806 2008-12-23  Cary Coutant  <ccoutant@google.com>
13807
13808         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13809         * plugin.cc (Plugin_manager::finish): Rename as
13810         layout_deferred_objects.  Move cleanup to separate function.
13811         (Plugin_manager::cleanup): New function.
13812         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13813         separately.
13814         * plugin.h (Plugin_manager::finish): Rename as
13815         layout_deferred_objects.
13816         (Plugin_manager::cleanup): New function.
13817         (Plugin_manager::cleanup_done): New field.
13818
13819 2008-12-23  Cary Coutant  <ccoutant@google.com>
13820
13821         * plugin.cc (is_visible_from_outside): New function.
13822         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13823         so we don't return "IR only" status for exported symbols or -r links.
13824
13825         * testsuite/Makefile.am (plugin_test_3): New test case.
13826         * testsuite/Makefile.in: Regenerate.
13827         * testsuite/plugin_test_3.sh: New file.
13828
13829 2008-12-22  Cary Coutant  <ccoutant@google.com>
13830
13831         * object.cc (Sized_relobj::layout_section): New function.
13832         (Sized_relobj::do_layout): Defer layout of input sections until after
13833         plugin has provided replacement files.
13834         (Sized_relobj::do_layout_deferred_sections): New function.
13835         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13836         (Relobj::layout_deferred_sections): New function.
13837         (Relobj::do_layout_deferred_sections): New function.
13838         (Sized_relobj::do_layout_deferred_sections): New function.
13839         (Sized_relobj::layout_section): New function.
13840         (Sized_relobj::Deferred_layout): New structure.
13841         (Sized_relobj::deferred_layout_): New field.
13842         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13843         Change all callers.  Layout deferred sections.
13844         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13845         references.
13846         (Plugin_hook::run): Move code from do_plugin_hook inline.
13847         (Plugin_hook::do_plugin_hook): Remove.
13848         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13849         (Plugin_manager::finish): Renamed, was cleanup.
13850         (Plugin_manager::should_defer_layout): New function.
13851         (Plugin_manager::add_deferred_layout_object): New function.
13852         (Plugin_manager::Deferred_layout_list): New type.
13853         (Plugin_manager::deferred_layout_objects_): New field.
13854         (Plugin_hook::do_plugin_hook): Remove.
13855
13856 2008-12-17  Ian Lance Taylor  <iant@google.com>
13857
13858         * options.h (class General_options): Add --no case for
13859         --export-dynamic.
13860
13861 2008-12-16  Cary Coutant  <ccoutant@google.com>
13862
13863         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13864         vector.
13865         (Plugin_manager::claim_file): Create plugin object even if
13866         plugin did not call the add_symbols callback.
13867         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13868         asking for more symbols than were added.
13869         * testsuite/Makefile.am (plugin_test_1): Add test case with
13870         no global symbols.
13871         (empty.syms): New target.
13872         * testsuite/Makefile.in: Regenerate.
13873         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13874         message. Don't call add_symbols if no globals.
13875         (all_symbols_read_hook): Don't provide replacement for empty
13876         claimed file.
13877
13878 2008-12-12  Ian Lance Taylor  <iant@google.com>
13879
13880         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13881         r_type == 0 for a local symbol with r_sym == 0.
13882         (scan_relocatable_relocs): Pass r_sym to
13883         local_non_section_strategy.
13884         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13885         r_sym parameter.
13886
13887         * configure.ac: Update test for TLS descriptors: they are
13888         supported as of glibc 2.9.
13889         * configure: Rebuild.
13890
13891 2008-12-11  Ian Lance Taylor  <iant@google.com>
13892
13893         PR 7091
13894         * target-reloc.h (Default_scan_relocatable_relocs): For each
13895         function, map r_type == 0 to RELOC_DISCARD.
13896
13897 2008-12-10  Cary Coutant  <ccoutant@google.com>
13898
13899         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13900         object to override a kept COMDAT group from a plugin object.
13901
13902 2008-12-09  Ian Lance Taylor  <iant@google.com>
13903
13904         PR 7088
13905         * yyscript.y (file_cmd): Handle INPUT.
13906
13907         * testsuite/initpri1.c: Change all declarations to be full
13908         prototypes by adding void, to avoid compiler warnings.
13909
13910 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13911
13912         * options.cc (General_options::parse_plugin_opt): New.
13913         (General_options::add_plugin): The argument now is just the filename.
13914         (General_options::add_plugin_option): New.
13915         * options.h (plugin_opt): New.
13916         (add_plugin): Change argument name.
13917         (add_plugin_option): New.
13918         * plugin.cc (Plugin::load): Don't parse the plugin option.
13919         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13920         (Plugin::add_option): New.
13921         (Plugin::args_): Change type.
13922         (Plugin::filename_): New.
13923         (Plugin_manager::add_plugin_option): New.
13924         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13925         * testsuite/Makefile.in: Regenerate.
13926
13927 2008-12-05  Cary Coutant  <ccoutant@google.com>
13928
13929         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13930         Handle --strip-lto-sections option.
13931         * options.h (strip_lto_sections): New option.
13932
13933 2008-12-01  Cary Coutant  <ccoutant@google.com>
13934
13935         * plugin.cc (ld_plugin_message): Change format parameter to const.
13936         Fix mismatch between new[] and delete.
13937
13938 2008-11-14  Cary Coutant  <ccoutant@google.com>
13939
13940         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13941         instead of -1U.
13942
13943 2008-11-05  Craig Silverstein  <csilvers@google.com>
13944
13945         * options.cc (General_options::parse_dynamic_list): New function.
13946         * options.h (General_options): New flags dynamic_list,
13947         dynamic_list_data, dynamic_list_cpp_new, and
13948         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13949         (General_options::in_dynamic_list): New function.
13950         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13951         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13952         (Lex::can_continue_name): Likewise.
13953         (yylex): Likewise.
13954         (read_script_file): New parameter script_options.
13955         (read_dynamic_list): New function.
13956         (Script_options::define_dynamic_list): New function.
13957         (dynamic_list_keyword_parsecodes): New variable.
13958         (dynamic_list_keywords): New variable.
13959         * script.h (Script_options::define_dynamic_list): New function
13960         prototype.
13961         (read_dynamic_list): New function prototype.
13962         * symtab.cc (strprefix): New macro.
13963         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13964         dynamic_list_data, dynamic_list_cpp_new, and
13965         dynamic_list_cpp_typeinfo.
13966         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13967         (dynamic_list_expr): New rule.
13968         (dynamic_list_nodes): Likewise.
13969         (dynamic_list_node): Likewise.
13970         * testsuite/Makefile.am (dynamic_list): New test.
13971         * testsuite/Makefile.in: Regenerated.
13972         * testsuite/dynamic_list.t: New file.
13973         * testsuite/dynamic_list.sh: New file.
13974
13975 2008-11-05  Craig Silverstein  <csilvers@google.com>
13976
13977         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13978         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13979         (t11_last): Likewise.
13980         * testsuite/ver_test_6.c (main): Likewise.
13981
13982 2008-10-07  Cary Coutant  <ccoutant@google.com>
13983
13984         * options.c (General_options::finalize): Add check for -static and
13985         -shared.
13986         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13987         is not empty.
13988
13989 2008-10-02  Cary Coutant  <ccoutant@google.com>
13990
13991         * plugin.cc (make_sized_plugin_object): Fix conditional
13992         compilation to work when not all targets are enabled.
13993
13994 2008-09-29  Cary Coutant  <ccoutant@google.com>
13995
13996         * archive.cc (Archive::get_file_and_offset): Use filename instead
13997         of name to get library path.
13998         (Archive::include_member): Unlock external member of a thin archive.
13999
14000         * testsuite/Makefile.am (TEST_AR): New variable.
14001         (thin_archive_test_1): New test.
14002         (thin_archive_test_2): New test.
14003         * testsuite/Makefile.in: Regenerate.
14004         * testsuite/thin_archive_main.cc: New file.
14005         * testsuite/thin_archive_test_1.cc: New file.
14006         * testsuite/thin_archive_test_2.cc: New file.
14007         * testsuite/thin_archive_test_3.cc: New file.
14008         * testsuite/thin_archive_test_4.cc: New file.
14009
14010 2008-09-29  Cary Coutant  <ccoutant@google.com>
14011
14012         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14013         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14014         instead of -1U.
14015         (Sized_relobj::do_finalize_local_symbols): Likewise.
14016         (Sized_relobj::map_to_kept_section): Likewise.
14017         * object.h (Sized_relobj::invalid_address): New constant.
14018         (Sized_relobj::do_output_section_offset): Check for invalid_address
14019         and return -1ULL.
14020         * output.cc (Output_reloc::local_section_offset): Use constant
14021         invalid_address instead of -1U.
14022         (Output_reloc::get_address): Likewise.
14023         (Output_section::output_address): Change -1U to -1ULL.
14024         * output.h (Output_reloc::invalid_address): New constant.
14025         * reloc.cc (Sized_relobj::write_sections): Use constant
14026         invalid_address instead of -1U.
14027         (Sized_relobj::relocate_sections): Likewise.
14028         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14029         values for merge sections.
14030         * target-reloc.h (relocate_for_relocatable): Use constant
14031         invalid_address instead of -1U.
14032
14033 2008-09-19  Cary Coutant  <ccoutant@google.com>
14034
14035         Add plugin functionality for link-time optimization (LTO).
14036         * configure.ac (plugins): Add --enable-plugins option.
14037         * configure: Regenerate.
14038         * config.in: Regenerate.
14039         * Makefile.am (LIBDL): New variable.
14040         (CCFILES): Add plugin.cc.
14041         (HFILES): Add plugin.h.
14042         (ldadd_var): Add LIBDL.
14043         * Makefile.in: Regenerate.
14044
14045         * archive.cc: Include "plugin.h".
14046         (Archive::setup): Don't preread archive symbols when using a plugin.
14047         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14048         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14049         files.
14050         (Archive::include_member): Add symbols from plugin objects.
14051         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14052         * descriptors.cc (Descriptors::open): Check for file descriptors
14053         abandoned by plugins.
14054         (Descriptors::claim_for_plugin): New function.
14055         * descriptors.h (Descriptors::claim_for_plugin): New function.
14056         (Open_descriptor::is_claimed): New field.
14057         (claim_descriptor_for_plugin): New function.
14058         * fileread.cc (File_read::claim_for_plugin): New function.
14059         * fileread.h (File_read::claim_for_plugin): New function.
14060         (File_read::descriptor): New function.
14061         * gold.cc: Include "plugin.h".
14062         (queue_initial_tasks): Add task to call plugin hooks for generating
14063         new object files.
14064         * main.cc: Include "plugin.h".
14065         (main): Load plugin libraries.
14066         * object.h (Pluginobj): Declare.
14067         (Object::pluginobj): New function.
14068         (Object::do_pluginobj): New function.
14069         (Object::set_target): New function.
14070         * options.cc: Include "plugin.h".
14071         (General_options::parse_plugin): New function.
14072         (General_options::General_options): Initialize plugins_ field.
14073         (General_options::add_plugin): New function.
14074         * options.h (Plugin_manager): Declare.
14075         (General_options): Add --plugin option.
14076         (General_options::has_plugins): New function.
14077         (General_options::plugins): New function.
14078         (General_options::add_plugin): New function.
14079         (General_options::plugins_): New field.
14080         * plugin.cc: New file.
14081         * plugin.h: New file.
14082         * readsyms.cc: Include "plugin.h".
14083         (Read_symbols::do_read_symbols): Check for archive before checking
14084         for ELF file.  Call plugin hooks to claim files.
14085         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14086         from a real object file; force override when processing replacement
14087         files.
14088         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14089         (Symbol::init_base_object): Likewise.
14090         (Symbol::init_base_output_data): Likewise.
14091         (Symbol::init_base_output_segment): Likewise.
14092         (Symbol::init_base_constant): Likewise.
14093         (Symbol::init_base_undefined): Likewise.
14094         (Symbol::output_section): Assert that object is not a plugin.
14095         (Symbol_table::add_from_pluginobj): New function.
14096         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14097         undefined.
14098         (Symbol_table::sized_write_globals): Likewise.
14099         (Symbol_table::add_from_pluginobj): Instantiate template.
14100         * symtab.h (Sized_pluginobj): Declare.
14101         (Symbol::in_real_elf): New function.
14102         (Symbol::set_in_real_elf): New function.
14103         (Symbol::in_real_elf_): New field.
14104         (Symbol_table::add_from_pluginobj): New function.
14105
14106         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14107         (LIBDL): New variable.
14108         (LDADD): Add LIBDL.
14109         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14110         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14111         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14112         (MOSTLYCLEANFILES): Likewise.
14113         * testsuite/Makefile.in: Regenerate.
14114         * testsuite/plugin_test.c: New file.
14115         * testsuite/plugin_test_1.sh: New file.
14116         * testsuite/plugin_test_2.sh: New file.
14117
14118 2008-09-16  Ian Lance Taylor  <iant@google.com>
14119
14120         * target-reloc.h (relocate_section): Check whether a symbol is
14121         defined by the ABI before reporting an undefined symbol error.
14122         * target.h (Target::is_defined_by_abi): Make parameter const.
14123         (Target::do_is_defined_by_abi): Likewise.
14124         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14125         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14126         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14127         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14128         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14129         * testsuite/Makefile.in: Rebuild.
14130
14131         * fileread.cc (make_view): Add casts to avoid warning.
14132
14133 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14134
14135         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14136         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14137
14138 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14139
14140         * options.h (General_options::output_is_executable): New.
14141         (General_options::output_is_pie): New.
14142         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14143         for shared libraries.
14144         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14145
14146 2008-09-11  Chris Demetriou  <cgd@google.com>
14147
14148         * options.h (origin): New -z option.
14149         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14150         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14151         in DT_FLAGS_1.
14152
14153 2008-09-05  Cary Coutant  <ccoutant@google.com>
14154
14155         * fileread.cc (File_read::make_view): Add check for attempt to map
14156         beyond end of file.
14157
14158 2008-09-05  Cary Coutant  <ccoutant@google.com>
14159
14160         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14161         explicit instantiations.
14162
14163 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14164
14165         PR gold/6858
14166         * options.cc (General_options::finalize): Allow undefined symbols
14167         in shlibs if linking -shared.
14168
14169         PR gold/6859
14170         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14171         symbols as not needing a dynsym entry.
14172
14173 2008-08-20  Craig Silverstein  <csilvers@google.com>
14174
14175         * fileread.cc (File_read::open): Do not lock the file unless it
14176         was successfully opened.
14177
14178 2008-08-14  Cary Coutant  <ccoutant@google.com>
14179
14180         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14181         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14182         * testsuite/tls_test.cc (struct int128): 128-bit struct
14183         for testing TLS relocs with non-zero addend.
14184         (v12): New TLS variable.
14185         (t12): New test.
14186         (t_last): Add check for v12.
14187         * testsuite/tls_test.h (t12): New function.
14188         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14189
14190 2008-08-13  Ian Lance Taylor  <iant@google.com>
14191
14192         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14193         set tls_segment_ or relro_segment_.
14194         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14195         when appropriate.
14196         * output.h (Output_section::clear_is_relro): New function.
14197         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14198         sections specially even when output_data_ is empty.
14199         (Output_segment::maximum_alignment): When first section is relro,
14200         only force alignment for PT_LOAD segments.
14201         * script.cc (script_data_segment_align): New function.
14202         (script_data_segment_relro_end): New function.
14203         * script-c.h (script_data_segment_align): Declare.
14204         (script_data_segment_relro_end): Declare.
14205         * script-sections.h (class Script_sections): Declare
14206         data_segment_align and data_segment_relro_end.  Add fields
14207         segment_align_index_ and saw_relro_end_.
14208         * script-sections.cc (class Sections_element): Add set_is_relro
14209         virtual function.  Add new bool* parameter to place_orphan_here.
14210         Add get_output_section virtual function.
14211         (class Output_section_definition): Add set_is_relro.  Add new
14212         bool* parameter to place_orphan_here.  Add get_output_section.
14213         Add is_relro_ field.
14214         (Output_section_definition::Output_section_definition): Initialize
14215         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14216         and is_relro_ fields.
14217         (Output_section_definition::place_orphan_here): Add is_relro
14218         parameter.
14219         (Output_section_definition::set_section_addresses): Set relro for
14220         output section.
14221         (Output_section_definition::alternate_constraint): Likewise.
14222         (class Orphan_output_section): Add new bool* parameter to
14223         place_orphan_here.  Add get_output_section.
14224         (Orphan_output_section::place_orphan_here): Add is_relro
14225         parameter.
14226         (Script_sections::Script_sections): Initialize
14227         data_segment_align_index_ and saw_relro_end_.
14228         (Script_sections::data_segment_align): New function.
14229         (Script_sections::data_segment_relro_end): New function.
14230         (Script_sections::place_orphan): Set or clear is_relro.
14231         (Script_sections::set_section_addresses): Force alignment of first
14232         TLS section.
14233         * yyscript.y (exp): Call script_data_segment_align and
14234         script_data_segment_relro_end.
14235         * testsuite/relro_script_test.t: New file.
14236         * testsuite/relro_test.cc (using_script): Declare.
14237         (t1, t2): Test using_script.
14238         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14239         (relro_script_test_SOURCES): Define.
14240         (relro_script_test_DEPENDENCIES): Define.
14241         (relro_script_test_LDFLAGS): Define.
14242         (relro_script_test_LDADD): Define.
14243         (relro_script_test.so): New target.
14244         * testsuite/Makefile.in: Rebuild.
14245
14246 2008-08-06  Cary Coutant <ccoutant@google.com>
14247
14248         * archive.cc (Archive::total_archives, Archive::total_members)
14249         (Archive::total_members_loaded): New variables.
14250         (Archive::setup): Add parameter.  Add option to preread
14251         archive symbols.
14252         (Archive::read_armap): Add counter.
14253         (Archive::get_file_and_offset): New function.
14254         (Archive::get_elf_object_for_member): New function.
14255         (Archive::read_all_symbols): New function.
14256         (Archive::read_symbols): New function.
14257         (Archive::add_symbols): Add counters.
14258         (Archive::include_all_members): Use armap to find members if it's
14259         already built.
14260         (Archive::include_member): Skip reading symbols if already read.
14261         Factored code into Archive::get_file_and_offset and
14262         Archive::get_elf_object_for_member.  Changed call to
14263         Mapfile::report_include_archive_member.
14264         (Archive::print_stats): New function.
14265         * archive.h: Declare Object and Read_symbols_data classes.
14266         (Archive::Archive): Add initializers for new members.
14267         (Archive::setup): Add parameter.
14268         (Archive::print_stats): New function.
14269         (Archive::total_archives, Archive::total_members)
14270         (Archive::total_members_loaded): New variables.
14271         (Archive::get_file_and_offset): New function.
14272         (Archive::get_elf_object_for_member): New function.
14273         (Archive::read_all_symbols): New function.
14274         (Archive::read_symbols): New function.
14275         (Archive::Archive_member): New class.
14276         (Archive::members_): New member.
14277         (Archive::num_members_): New member.
14278         * main.cc: Include archive.h.
14279         (main): Call Archive::print_stats.
14280         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14281         archive parameter; member_name is now the fully-decorated name.
14282         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14283         * options.h: (General_options): Add --preread-archive-symbols option.
14284         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14285         Archive::setup.
14286
14287 2008-08-04  Ian Lance Taylor  <iant@google.com>
14288
14289         * symtab.h (Symbol::use_plt_offset): New function.
14290         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14291         * powerpc.cc (Relocate::relocate): Likewise.
14292         * sparc.cc (Relocate::relocate): Likewise.
14293         * x86_64.cc (Relocate::relocate): Likewise.
14294         * testsuite/weak_plt.sh: New test.
14295         * testsuite/weak_plt_main.cc: New test.
14296         * testsuite/weak_plt_shared.cc: New test.
14297         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14298         (check_PROGRAMS): Add weak_plt.
14299         (check_DATA): Add weak_plt_shared.so.
14300         (weak_plt_main_pic.o, weak_plt): New targets.
14301         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14302         * testsuite/Makefile.in: Rebuild.
14303
14304         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14305         gcctestdir/ld.
14306         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14307         * testsuite/Makefile.in: Rebuild.
14308
14309 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14310
14311         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14312         * Makefile.in: Regenerate.
14313         * po/POTFILES.in: Regenerate.
14314
14315 2008-07-29  Ian Lance Taylor  <iant@google.com>
14316
14317         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14318         symbols before other symbols.
14319         * testsuite/script_test_2.cc (test_addr): Declare.
14320         (test_addr_alias): Declare.
14321         (main): Check that test_addr and test_addr_alias have the right
14322         values.
14323         * testsuite/script_test_2.t: Define test_addr_alias and
14324         test_addr.
14325
14326 2008-07-24  Ian Lance Taylor  <iant@google.com>
14327
14328         PR 5990
14329         * descriptors.cc: New file.
14330         * descriptors.h: New file.
14331         * gold-threads.h (class Hold_optional_lock): New class.
14332         * fileread.cc: Include "descriptors.h".
14333         (File_read::~File_read): Release descriptor rather than closing
14334         it.
14335         (File_read::open) [file]: Call open_descriptor rather than open.
14336         Set is_descriptor_opened_.
14337         (File_read::open) [memory]: Assert that descriptor is not open.
14338         (File_read::reopen_descriptor): New function.
14339         (File_read::release): Release descriptor.
14340         (File_read::do_read): Make non-const.  Reopen descriptor.
14341         (File_read::read): Make non-const.
14342         (File_read::make_view): Reopen descriptor.
14343         (File_read::do_readv): Likewise.
14344         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14345         Update declarations.
14346         * layout.cc: Include "descriptors.h".
14347         (Layout::create_build_id): Use open_descriptor rather than open.
14348         * output.cc: Include "descriptors.h".
14349         (Output_file::open): Use open_descriptor rather than open.
14350         * archive.cc (Archive::const_iterator): Change Archive to be
14351         non-const.
14352         (Archive::begin, Archive::end): Make non-const.
14353         (Archive::count_members): Likewise.
14354         * archive.h (class Archive): Update declarations.
14355         * object.h (Object::read): Make non-const.
14356         * Makefile.am (CCFILES): Add descriptors.cc.
14357         (HFILES): Add descriptors.h.
14358         * Makefile.in: Rebuild.
14359
14360         PR 6716
14361         * gold.h: Always include <clocale>.  Add Solaris workarounds
14362         following code in binutils/sysdep.h.
14363
14364         PR 6048
14365         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14366         this->eh_frame_hdr_ is NULL before using it.
14367
14368         * dynobj.cc (Versions::Versions): Update comment.
14369
14370         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14371         the base version name.
14372
14373         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14374         array size plus one.
14375         (Stringpool_template::set_string_offsets): Subtract one from key
14376         before using it as an array index.
14377         (Stringpool_template::get_offset_with_length): Likewise.
14378         (Stringpool_template::write_to_buffer): Likewise.
14379         * stringpool.h (Stringpool_template::get_offset_from_key):
14380         Likewise.
14381
14382 2008-07-23  Ian Lance Taylor  <iant@google.com>
14383
14384         PR 6658
14385         * object.h (Merged_symbol_value::value): Do our best to handle a
14386         negative addend.
14387
14388         PR 6647
14389         * script.cc (Version_script_info::get_versions): Don't add empty
14390         version tag to return value.
14391         (Version_script_info::get_symbol_version_helper): Change return
14392         type to bool.  Add pversion parameter.  Change all callers.
14393         (script_register_vers_node): Don't require a non-NULL tag.
14394         * script.h (class Version_script_info): Update declarations.
14395         (Version_script_info::get_symbol_version): Change return type to
14396         bool.  Add version parameter.  Change all callers.
14397         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14398         handling.  Handle an empty version from a version script.
14399         (Symbol_table::define_special_symbol): Likewise.
14400         * testsuite/ver_test_10.script: New file.
14401         * testsuite/ver_test_10.sh: New file.
14402         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14403         (check_DATA): Add ver_test_10.syms.
14404         (ver_test_10.syms, ver_test_10.so): New target.
14405         * testsuite/Makefile.in: Rebuild.
14406
14407 2008-07-23  Simon Baldwin  <simonb@google.com>
14408
14409         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14410         to zero for undefined symbols from dynamic libraries.
14411
14412 2008-07-23  Ian Lance Taylor  <iant@google.com>
14413
14414         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14415         Change all callers.
14416         * symtab.h (class Symbol_table): Update declaration.
14417         * testsuite/ver_test_9.cc: New file.
14418         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14419         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14420         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14421         (ver_test_9.so, ver_test_9.o): New targets.
14422         * testsuite/Makefile.in: Rebuild.
14423
14424 2008-07-22  Ian Lance Taylor  <iant@google.com>
14425
14426         * options.h (class General_options): Define --check-sections.
14427         * layout.cc (Layout::set_segment_offsets): Handle
14428         --check-sections.
14429
14430         * options.h (class General_options): Define -n/--nmagic and
14431         -N/--omagic.
14432         * options.cc (General_options::finalize): For -n/--nmagic or
14433         -N/--omagic, set -static.
14434         * layout.cc (Layout::attach_allocated_section_to_segment): If
14435         -N/--omagic, don't put read-only and read-write sections in
14436         different segments.
14437         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14438         finding a read-only segment.
14439         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14440         don't set the minimum segment alignment to the common page size,
14441         and don't set the file offset to the address modulo the page size.
14442         * script-sections.cc (Script_sections::create_segments): If
14443         -n/--omagic, don't put read-only and read-write sections in
14444         different segments.
14445
14446         * cref.cc: New file.
14447         * cref.h: New file.
14448         * options.h (class General_options): Add --print-symbol-counts.
14449         * main.cc (main): Issue defined symbol report if requested.
14450         * archive.cc (Archive::interpret_header): Make into a const member
14451         function.
14452         (Archive::add_symbols): Call Input_objects::archive_start and
14453         archive_stop.
14454         (Archive::const_iterator): Define new class.
14455         (Archive::begin, Archive::end): New functions.
14456         (Archive::include_all_members): Rewrite to use iterator.
14457         (Archive::count_members): New function.
14458         * archive.h (class Archive): Update declarations.
14459         (Archive::filename): New function.
14460         * object.cc: Include "cref.h".
14461         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14462         (Sized_relobj::do_get_global_symbol_counts): New function.
14463         (Input_objects::add_object): Add object to cross-referencer.
14464         (Input_objects::archive_start): New function.
14465         (Input_objects::archive_stop): New function.
14466         (Input_objects::print_symbol_counts): New function.
14467         * object.h: Declare Cref and Archive.
14468         (Object::get_global_symbol_counts): New function.
14469         (Object::do_get_global_symbol_counts): New pure virtual function.
14470         (class Sized_relobj): Add defined_count_ field.  Update
14471         declarations.
14472         (class Input_objects): Add cref_ field.  Update constructor.
14473         Update declarations.
14474         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14475         defined_count_.
14476         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14477         symbol counts.
14478         (Sized_dynobj::do_get_global_symbol_counts): New function.
14479         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14480         defined_count_.  Update declarations.  Define Symbols typedef.
14481         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14482         parameter.  Change all callers.
14483         (Symbol_table::add_from_dynobj): Add sympointers and defined
14484         parameters.  Change all callers.
14485         * symtab.h (class Symbol_table): Update declarations.
14486         * Makefile.am (CCFILES): Add cref.cc.
14487         (HFILES): Add cref.h.
14488         * Makefile.in: Rebuild.
14489
14490 2008-07-22  Simon Baldwin  <simonb@google.com>
14491
14492         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14493         to zero when writing undefined symbols.
14494
14495 2008-07-22  Ian Lance Taylor  <iant@google.com>
14496
14497         * output.cc (Output_section::add_input_section): Don't try to
14498         merge empty merge sections.
14499
14500 2008-07-21  Craig Silverstein  <csilvers@google.com>
14501
14502         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14503         Include symbol version in error message.
14504
14505 2008-07-20  Chris Demetriou  <cgd@google.com>
14506
14507         * configure.ac (gold_cv_c_random_seed): New configured variable.
14508         (RANDOM_SEED_CFLAGS): New substituted variable.
14509         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14510         * configure: Rebuild.
14511         * Makefile.in: Likewise.
14512         * testsuite/Makefile.in: Likewise.
14513
14514 2008-07-18  Ian Lance Taylor  <iant@google.com>
14515
14516         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14517         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14518         * testsuite/ver_test_main.cc (main): Call t4.
14519         (t4, t4_2a): Define.
14520         * testsuite/ver_test_2.cc (t4_2): Define.
14521         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14522         * testsuite/ver_test_4.cc (t4_2a): Define.
14523         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14524         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14525
14526 2008-07-17  Ian Lance Taylor  <iant@google.com>
14527
14528         * dynobj.cc (Versions::add_def): If we give an error about a
14529         missing version, go ahead and create the version anyhow.
14530
14531 2008-07-10  Ian Lance Taylor  <iant@google.com>
14532
14533         Handle output sections with more than 0x7fffffff bytes.
14534         * object.h (class Relobj): Change map_to_output_ to
14535         output_sections_, and just keep a section pointer.  Change all
14536         uses.  Move comdat group support to Sized_relobj.
14537         (Relobj::is_section_specially_mapped): Remove.
14538         (Relobj::output_section): Remove poff parameter.  Change all
14539         callers.
14540         (Relobj::output_section_offset): New function.
14541         (Relobj::set_section_offset): Rewrite.
14542         (Relobj::map_to_output): Remove.
14543         (Relobj::output_sections): New function.
14544         (Relobj::do_output_section_offset): New pure virtual function.
14545         (Relobj::do_set_section_offset): Likewise.
14546         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14547         group support from Relobj.  Update declarations.
14548         (Sized_relobj::get_output_section_offset): New function.
14549         (Sized_relobj::do_output_section_offset): New function.
14550         (Sized_relobj::do_set_section_offset): New function.
14551         * object.cc (Relobj::output_section_address): Remove.
14552         (Sized_relobj::Sized_relobj): Initialize new fields.
14553         (Sized_relobj::include_section_group): Cast find_kept_object to
14554         Sized_relobj.
14555         (Sized_relobj::include_linkonce_section): Likewise.
14556         (Sized_relobj::do_layout): Use separate arrays for output section
14557         and output offset.
14558         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14559         output_sections.
14560         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14561         output_sections and section_offsets.
14562         (Sized_relobj::write_local_symbols): Likewise.
14563         (map_to_kept_section): Compute output address directly.
14564         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14565         output_sections and section_offsets.
14566         (Sized_relobj::write_sections): Likewise.
14567         (Sized_relobj::relocate_sections): Likewise.
14568         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14569         * output.h (class Output_reloc): Update declarations.  Change
14570         u2_.relobj to Sized_relobj*.
14571         (class Output_data_reloc): Change add functions to use
14572         Sized_relobj*.
14573         * output.cc (Output_reloc::Output_reloc): Change relobj to
14574         Sized_relobj*.
14575         (Output_reloc::local_section_offset): Change return type to
14576         Elf_Addr.  Use get_output_section_offset.
14577         (Output_reloc::get_address): Likewise.
14578         (Output_section::is_input_address_mapped): Don't call
14579         is_section_specially_mapped.
14580         (Output_section::output_offset): Likewise.
14581         (Output_section::output_address): Likewise.
14582         (Output_section::starting_output_address): Likewise.
14583         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14584         parameter to Sized_relobj*.
14585         (Copy_relocs::need_copy_reloc): Likewise.
14586         (Copy_relocs::save): Likewise.
14587         * copy-relocs.h (class Copy_relocs): Update declarations.
14588         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14589         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14590         * target-reloc.h (relocate_for_relocatable): Change
14591         offset_in_output_section type to Elf_Addr.  Change code that uses
14592         it as well.
14593         * layout.cc (Layout::layout): Always set *off.
14594         * mapfile.cc (Mapfile::print_input_section): Use
14595         output_section_offset.
14596         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14597         Sized_relobj*.
14598         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14599         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14600         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14601
14602 2008-07-03  Ian Lance Taylor  <iant@google.com>
14603
14604         * layout.cc (Layout::include_section): Do not discard unrecognized
14605         SHT_STRTAB sections.
14606
14607 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14608
14609         * script.cc (Lex::can_continue_name): Make '?' allowable in
14610         version-script names.
14611         * testsuite/version_script.map: Change glob pattern to use '?'
14612
14613 2008-06-30  Manish Singh  <yosh@gimp.org>
14614
14615         PR 6585
14616         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14617         Correct typo.
14618
14619 2008-06-30  Ian Lance Taylor  <iant@google.com>
14620
14621         PR 6660
14622         PR 6682
14623         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14624         versions]: Don't try to read the value in the contents, since we
14625         don't use it.  Use the template endianness when writing.
14626
14627 2008-06-25  Cary Coutant  <ccoutant@google.com>
14628
14629         * fileread.cc (File_read::make_view): Assert on zero-length view.
14630         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14631         symbol table when there are no symbols to read.
14632
14633 2008-06-23  Craig Silverstein  <csilvers@google.com>
14634
14635         * version.cc (version_string): Bump to 1.7
14636
14637 2008-06-18  Craig Silverstein  <csilvers@google.com>
14638
14639         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14640         constant 0xFFFF to type Valtype.
14641         (Powerpc_relocate_functions::rel16_ha): Likewise.
14642
14643 2008-06-17  Ian Lance Taylor  <iant@google.com>
14644
14645         * output.h (Output_section::Input_section): Initialize p2align_ to
14646         zero for Output_section_data constructors.
14647         (Output_section::Input_section::addralign): If not an input
14648         section, return the alignment of the Output_section_data.
14649         * testsuite/copy_test.cc: New file.
14650         * testsuite/copy_test_1.cc: New file.
14651         * testsuite/copy_test_2.cc: New file.
14652         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14653         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14654         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14655         (copy_test_1_pic.o, copy_test_1.so): New targets.
14656         (copy_test_2_pic.o, copy_test_2.so): New targets.
14657         * testsuite/Makefile.in: Rebuild.
14658
14659         * script-sections.cc (Script_sections::place_orphan): Initialize
14660         local variable exact.
14661
14662 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14663
14664         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14665
14666 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14667             David S. Miller  <davem@davemloft.net>
14668
14669         * powerpc.cc: New file.
14670         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14671         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14672         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14673         * Makefile.in: Rebuild.
14674
14675 2008-06-09  Ian Lance Taylor  <iant@google.com>
14676
14677         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14678         <exception>.
14679         (throwing, orig_terminate): New static variables.
14680         (terminate_handler): New static function.
14681         (t2): Set terminate handler.
14682
14683 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14684
14685         PR 6584
14686         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14687         alignment.
14688
14689 2008-05-30  Cary Coutant  <ccoutant@google.com>
14690
14691         * archive.cc (Archive::include_all_members) Correct to step
14692         over symbol table and extended name table in thin archives.
14693
14694 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14695
14696         PR 6407
14697         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14698         calculation.
14699
14700 2008-05-28  Caleb Howe  <cshowe@google.com>
14701
14702         * reduced_debug_output.cc: New file.
14703         * reduced_debug_output.h: New file.
14704         * options.h (class General_options): Add --strip-debug-non-line.
14705         * options.cc (General_options::finalize): Add strip_debug_non_line
14706         to the strip heirarchy.
14707         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14708         fields.
14709         * layout.cc: Include "reduced_debug_output.h".
14710         (Layout::Layout): Initialize new fields.
14711         (line_only_debug_sections): New static array.
14712         (is_lines_only_debug_sections): New static inline function.
14713         (Layout::include_section): Handle --strip-debug-non-line.
14714         (Layout::make_output_section): If --strip-debug-non-line, build
14715         new output sections for .debug_abbrev and .debug_info.
14716         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14717         gold.  Warn about possible overflow.
14718         (read_signed_LEB_128): Likewise.
14719         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14720         (read_signed_LEB_128): Declare.
14721         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14722         (HFILES): Add reduced_debug_output.h.
14723         * Makefile.in: Rebuild.
14724
14725 2008-05-21  Ian Lance Taylor  <iant@google.com>
14726
14727         * mapfile.cc: New file.
14728         * mapfile.h: New file.
14729         * options.h (class General_options): Add -M/--print-map and -Map.
14730         * options.cc (General_options::finalize): Make -M equivalent to
14731         -Map -.
14732         * main.cc: Include <cstdio> and "mapfile.h".
14733         (main): Open mapfile if requested.
14734         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14735         constructor.  Change caller.
14736         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14737         (queue_middle_tasks): Likewise.
14738         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14739         declarations.
14740         * archive.cc: Include "mapfile.h".
14741         (Archive::add_symbols): Add mapfile parameter.  Change all
14742         callers.  Pass mapfile, symbol, and reason to include_member.
14743         (Archive::include_all_members): Add mapfile parameter.  Change all
14744         callers.
14745         (Archive::include_member): Add mapfile, sym, and why parameters.
14746         Change all callers.  Report inclusion to map file.
14747         * archive.h: Include "fileread.h".
14748         (class Archive): Update declarations.
14749         (Archive::file): New const method.
14750         (class Add_archive_symbols): Add mapfile_ field.  Update
14751         constructor.  Change all callers.
14752         * readsyms.h (class Read_symbols): Likewise.
14753         (class Finish_group): Likewise.
14754         (class Read_script): Likewise.
14755         * common.cc: Include "mapfile.h".
14756         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14757         all callers.
14758         (Symbol_table::do_allocate_commons): Likewise.
14759         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14760         symbol allocation to mapfile.
14761         * common.h (class Allocate_commons_task): Add mapfile_ field.
14762         Update constructor.  Change all callers.
14763         * symtab.h (class Symbol_table): Update declarations.
14764         * layout.cc: Include "mapfile.h".
14765         (Layout_task_runner::run): Print information to mapfile.
14766         (Layout::create_gold_note): Change Output_data_fixed_space to
14767         Output_data_zero_fill.
14768         (Layout::create_build_id): Likewise.
14769         (Layout::print_to_mapfile): New function.
14770         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14771         constructor.  Change caller.
14772         (class Layout): Declare print_to_mapfile.
14773         * output.cc (Output_section::Input_section::print_to_mapfile): New
14774         function.
14775         (Output_section::add_input_section): If producing a map, always
14776         add to input_sections_ list.
14777         (Output_section::do_print_to_mapfile): New function.
14778         (Output_segment::print_sections_to_mapfile): New function.
14779         (Output_segment::print_section_list_to_mapfile): New function.
14780         * output.h: Include "mapfile.h".
14781         (Output_data::print_to_mapfile): New function.
14782         (Output_data::do_print_to_mapfile): New virtual function.
14783         (Output_segment_headers::do_print_to_mapfile): New function.
14784         (Output_file_header::do_print_to_mapfile): New function.
14785         (Output_data_const::do_print_to_mapfile): New function.
14786         (class Output_data_const_buffer): Add map_name_ field.  Update
14787         constructor.  Change all callers.  Add do_print_to_mapfile
14788         function.
14789         (class Output_data_fixed_space): Likewise.
14790         (class Output_data_space): Likewise.
14791         (class Output_data_zero_fill): New class.
14792         (Output_data_strtab::do_print_to_mapfile): New function.
14793         (Output_data_reloc_base::do_print_to_mapfile): New function.
14794         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14795         (Output_data_group::do_print_to_mapfile): New function.
14796         (Output_data_got::do_print_to_mapfile): New function.
14797         (Output_data_dynamic::do_print_to_mapfile): New function.
14798         (Output_symtab_xindex::do_print_to_mapfile): New function.
14799         (class Output_section): Declare do_print_to_mapflie.  Declare
14800         print_to_mapfile in Input_section.
14801         (class Output_segment): Declare new functions.
14802         * object.h (Sized_relobj::symbol_count): New function.
14803         * script-sections.cc
14804         (Output_section_element_dot_assignment::set_section_addresses):
14805         Change Output_data_fixed_space to Output_data_zero_fill.
14806         (Output_data_expression::do_print_to_mapfile): New function.
14807         * script.cc (read_input_script): Add mapfile parameter.  Change
14808         all callers.
14809         * script.h (read_input_script): Update declaration.
14810         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14811         (Eh_frame::do_print_to_mapfile): New function.
14812         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14813         (Output_merge_string::do_print_to_mapfile): New function.
14814         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14815         function.
14816         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14817         function.
14818         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14819         function.
14820         * Makefile.am (CCFILES): Add mapfile.cc.
14821         (HFILES): Add mapfile.h.
14822         * Makefile.in: Rebuild.
14823
14824 2008-05-19  Ian Lance Taylor  <iant@google.com>
14825
14826         * options.h (class General_options): Add -z relro.
14827         * layout.cc (Layout::Layout): Initialize relro_segment_.
14828         (Layout::add_output_section_data): Return the output section.
14829         (Layout::make_output_section): Rcognize relro sections and mark
14830         them appropriately.
14831         (Layout::attach_allocated_section_to_segment): Put relro sections
14832         in a PT_GNU_RELRO segment.
14833         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14834         section as relro.
14835         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14836         PT_TLS segments.
14837         (Layout::linkonce_mapping): Map d.rel.ro.local to
14838         .data.rel.ro.local.
14839         (Layout::output_section_name): Us .data.rel.ro.local for any
14840         section which begins with that.
14841         * layout.h (class Layout): Update add_output_section_data
14842         declaration.  Add relro_segment_ field.
14843         * output.cc (Output_section::Output_section): Initialize is_relro_
14844         and is_relro_local_ fields.
14845         (Output_segment::add_output_section): Group relro sections.
14846         (Output_segment::is_first_section_relro): New function.
14847         (Output_segment::maximum_alignment): If there is a relro section,
14848         align the segment to the common page size.
14849         (Output_segment::set_section_addresses): Track whether we are
14850         looking at relro sections.  If the last section is a relro
14851         section, align to the common page size.
14852         (Output_segment::set_section_list_addresses): Add in_relro
14853         parameter.  Change all callers.  Align to the page size when
14854         moving from relro to non-relro section.
14855         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14856         segment.
14857         * output.h (class Output_section): Add is_relro_ and
14858         is_relro_local_ fields.
14859         (Output_section::is_relro): New function.
14860         (Output_section::set_is_relro): New function.
14861         (Output_section::is_relro_local): New function.
14862         (Output_section::set_is_relro_local): New function.
14863         (class Output_segment): Update declarations.
14864         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14865         * sparc.cc (Target_sparc::got_section): Likewise.
14866         * x86_64.cc (Target_x86_64::got_section): Likewise.
14867         * testsuite/relro_test_main.cc: New file.
14868         * testsuite/relro_test.cc: New file.
14869         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14870         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14871         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14872         (relro_test.so, relro_test_pic.o): New targets.
14873         * testsuite/Makefile.in: Rebuild.
14874
14875 2008-05-16  Ian Lance Taylor  <iant@google.com>
14876
14877         * output.cc (Output_segment::add_output_section): Remove front
14878         parameter.
14879         * output.h (class Output_segment): Remove
14880         add_initial_output_section and overloaded add_output_section.
14881         Update declaration of remaining add_output_section.
14882         * layout.cc (Layout::create_interp): Call add_output_section
14883         rather than add_initial_output_section.
14884         (Layout::finish_dynamic_section): Likewise.
14885
14886         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14887         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14888         know the dynamic type.
14889         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14890         field.  Initialize it in constructor.
14891         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14892         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14893         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14894         reloc.
14895
14896         * output.cc (Output_reloc::get_address): Change return type to
14897         Elf_Addr.
14898         * output.h (class Output_reloc): Update get_address declaration.
14899         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14900         for section addresses.
14901
14902 2008-05-09  Ian Lance Taylor  <iant@google.com>
14903
14904         PR 6493
14905         * gold.cc (gold_nomem): Use return value of write.
14906
14907 2008-05-08  Ian Lance Taylor  <iant@google.com>
14908
14909         * symtab.c (Symbol::init_base_output_data): Add version
14910         parameter.  Change all callers.
14911         (Symbol::init_base_output_segment): Likewise.
14912         (Symbol::init_base_constant): Likewise.
14913         (Symbol::init_base_undefined): Likewise.
14914         (Sized_symbol::init_output_data): Likewise.
14915         (Sized_symbol::init_output_segment): Likewise.
14916         (Sized_symbol::init_constant): Likewise.
14917         (Sized_symbol::init_undefined): Likewise.
14918         (Symbol_table::do_define_in_output_data): If the new symbol has a
14919         version, mark it as the default.
14920         (Symbol_table::do_define_in_output_segment): Likewise.
14921         (Symbol_table::do_define_as_constant): Likewise.
14922         * symtab.h (class Symbol): Update declarations.
14923         (class Sized_symbol): Likewise.
14924         * resolve.cc (Symbol::override_version): New function.
14925         (Symbol::override_base): Call override_version.
14926         (Symbol::override_base_with_special): Likewise.
14927         * testsuite/ver_script_8.script: New file.
14928         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14929         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14930         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14931         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14932
14933 2008-05-06  Ian Lance Taylor  <iant@google.com>
14934
14935         PR 6049
14936         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14937         functions.
14938         (class General_options): Remove existing --undefined, and add
14939         --no-undefined instead.  Add new --undefined as synonym for -u.
14940         * archive.cc (Archive::add_symbols): Check whether symbol was
14941         named with -u.
14942         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14943         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14944         all uses.  Add IS_UNDEFINED.  Update declarations to split
14945         different versions of init_base.  Declare init_base_undefined.
14946         (Symbol::is_defined): Handle IS_UNDEFINED.
14947         (Symbol::is_undefined): Likewise.
14948         (Symbol::is_weak_undefined): Call is_undefined.
14949         (Symbol::is_absolute): Handle IS_CONSTANT.
14950         (class Sized_symbol): Update declarations to split different
14951         versions of init.  Declare init_undefined.
14952         (class Symbol_table): Declare new functions.
14953         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14954         Change all callers.
14955         (Symbol::init_base_output_data): Likewise.
14956         (Symbol::init_base_output_segment): Likewise.
14957         (Symbol::init_base_constant): Likewise.
14958         (Symbol::init_base_undefined): New function.
14959         (Sized_symbol::init_object): Rename from init.  Change all
14960         callers.
14961         (Sized_symbol::init_output_data): Likewise.
14962         (Sized_symbol::init_output_segment): Likewise.
14963         (Sized_symbol::init_constant): Likewise.
14964         (Sized_symbol::init_undefined): New function.
14965         (Symbol_table::add_undefined_symbols_from_command_line): New
14966         function.
14967         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14968         function.
14969         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14970         (Symbol::output_section): Likewise.
14971         (Symbol::set_output_section): Likewise.
14972         (Symbol_table::sized_finalize_symbol): Likewise.
14973         (Symbol_table::sized_write_globals): Likewise.
14974         * resolve.cc (Symbol_table::should_override): Likewise.
14975         (Symbol::override_base_with_special): Likewise.
14976
14977         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14978         symbol, change it to have default visibility.
14979         * testsuite/protected_1.cc: New file.
14980         * testsuite/protected_2.cc: New file.
14981         * testsuite/protected_3.cc: New file.
14982         * testsuite/protected_main_1.cc: New file.
14983         * testsuite/protected_main_2.cc: New file.
14984         * testsuite/protected_main_3.cc: New file.
14985         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14986         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14987         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14988         (protected_1.so): New target.
14989         (protected_1_pic.o, protected_2_pic.o): New targets.
14990         (protected_3_pic.o): New target.
14991         (check_PROGRAMS): Add protected_2.
14992         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14993         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14994         * testsuite/Makefile.in: Rebuild.
14995
14996         * options.h (DEFINE_var): Add set_user_set_##varname__.
14997         (DEFINE_bool_alias): New macro.
14998         (class General_options): Define -Bstatic using DEFINE_bool_alias
14999         rather than DEFINE_special.  Add --undefined as an alias for -z
15000         defs.
15001         * options.cc (General_options::parse_Bstatic): Remove.
15002
15003         * options.h (class General_options): Add --fatal-warnings.
15004         * main.cc (main): Implement --fatal-warnings.
15005         * errors.h (Errors::warning_count): New function.
15006
15007         * options.h (class General_options): Add -Bsymbolic-functions.
15008         * symtab.h (Symbol::is_preemptible): Check for
15009         -Bsymbolic-functions.
15010
15011 2008-05-05  Ian Lance Taylor  <iant@google.com>
15012
15013         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15014         as noVARNAME rather than no-VARNAME.
15015         (class General_options): Add option -z combreloc.
15016         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15017         get_address.
15018         (Output_reloc::sort_before) [SHT_REL]: New function.
15019         (Output_reloc::sort_before) [SHT_RELA]: New function.
15020         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15021         Sort_relocs_comparison.
15022         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15023         parameter.  Change all callers.
15024         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15025         sort_relocs parameter.  Change all callers.
15026         * output.cc (Output_reloc::get_address): New function, broken out
15027         of write_rel.
15028         (Output_reloc::write_rel): Call it.
15029         (Output_reloc::compare): New function.
15030         (Output_data_reloc_base::do_write): Optionally sort relocs.
15031
15032         * configure.ac: If targ_extra_obj is set, link it in.
15033         * configure.tgt: Initialize all variables.
15034         (x86_64*): Set targ_extra_obj and targ_extra_size.
15035         * configure: Rebuild.
15036
15037         * object.cc (Sized_relobj::include_section_group): Adjust section
15038         indexes read from group data.  Build vector to pass to
15039         layout_group.
15040         * layout.cc (Layout::layout_group): Add flags and shndxes
15041         parameters.  Remove contents parameter.  Change caller.  Update
15042         explicit instantiations.
15043         * layout.h (class Layout): Update layout_group declaration.
15044         * output.cc (Output_data_group::Output_data_group): Add flags and
15045         input_shndxes parameters.  Remove contents parameter.  Change
15046         caller.
15047         (Output_data_group::do_write): Change input_sections_ to
15048         input_shndxes_.
15049         * output.h (class Output_data_group): Update constructor
15050         declaration.  Rename input_sections_ to input_shndxes_.
15051         * testsuite/many_sections_test.cc: Add template.
15052
15053 2008-04-30  Cary Coutant  <ccoutant@google.com>
15054
15055         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15056
15057         * layout.cc (Layout::include_section): Refactored check for debug
15058         info section.
15059         (Layout::add_comdat): Add new parameters.  Change type
15060         of signature parameter.  Add object and shndx to signatures table.
15061         (Layout::find_kept_object): New function.
15062         * layout.h: Include <cstring>.
15063         (Layout::is_debug_info_section): New function.
15064         (Layout::add_comdat): Add new parameters.
15065         (Layout::find_kept_object): New function.
15066         (Layout::Kept_section): New struct.
15067         (Layout::Signatures): Change type of map range.
15068         * object.cc (Relobj::output_section_address): New function.
15069         (Sized_relobj::include_section_group): Add new parameters.  Change
15070         calls to Layout::add_comdat.  Change to build table of kept comdat
15071         groups and table mapping discarded sections to kept sections.
15072         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15073         (Sized_relobj::do_layout): Change calls to include_section_group and
15074         include_linkonce_section.
15075         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15076         value to zero when section is discarded.
15077         (Sized_relobj::map_to_kept_section): New function.
15078         * object.h (Relobj::output_section_address): New function.
15079         (Relobj::Comdat_group): New type.
15080         (Relobj::find_comdat_group): New function.
15081         (Relobj::Comdat_group_table): New type.
15082         (Relobj::Kept_comdat_section): New type.
15083         (Relobj::Kept_comdat_section_table): New type.
15084         (Relobj::add_comdat_group): New function.
15085         (Relobj::set_kept_comdat_section): New function.
15086         (Relobj::get_kept_comdat_section): New function.
15087         (Relobj::comdat_groups_): New field.
15088         (Relobj::kept_comdat_sections_): New field.
15089         (Symbol_value::input_value): Update comment.
15090         (Sized_relobj::map_to_kept_section) New function.
15091         (Sized_relobj::include_linkonce_section): Add new parameter.
15092         * target-reloc.h (Comdat_behavior): New type.
15093         (get_comdat_behavior): New function.
15094         (relocate_section): Add code to map a discarded section to the
15095         corresponding kept section when applying a relocation.
15096
15097 2008-04-30  Craig Silverstein  <csilvers@google.com>
15098
15099         * dwarf_reader.cc (next_generation_count): New static var.
15100         (Addr2line_cache_entry): New struct.
15101         (addr2line_cache): New static var.
15102         (Dwarf_line_info::one_addr2line): Added caching.
15103         (Dwarf_line_info::clear_addr2line_cache): New function.
15104         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15105         cache-size parameter.
15106         (Dwarf_line_info::one_addr2line_cache): New function.
15107         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15108         new cache-size argument to one_addr2line(), and clear cache.
15109
15110 2008-04-28  Cary Coutant  <ccoutant@google.com>
15111
15112         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15113         R_386_PC8 relocations.
15114
15115 2008-04-23  Ian Lance Taylor  <iant@google.com>
15116
15117         * object.cc (Sized_relobj::include_section_group): Check for
15118         invalid section group.
15119
15120         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15121         header size.
15122
15123         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15124         than read for file header.
15125         * archive.cc (Archive::include_member): Likewise.
15126
15127 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15128
15129         * aclocal.m4: Regenerate.
15130         * configure: Regenerate.
15131
15132 2008-04-19  Ian Lance Taylor  <iant@google.com>
15133
15134         * version.cc (version_string): Bump to 1.6.
15135
15136         * testsuite/Makefile.am (many_sections_r_test): New target.
15137         (many_sections_r_test_SOURCES): Remove.
15138         (many_sections_r_test_DEPENDENCIES): Remove.
15139         (many_sections_r_test_LDFLAGS): Remove.
15140         (many_sections_r_test_LDADD): Remove.
15141
15142         * object.cc (Sized_relobj::do_add_symbols): Always pass
15143         local_symbol_count_ to add_from_relobj.
15144
15145         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15146         every thousand variables.
15147         * testsuite/Makefile.in: Rebuild.
15148
15149         * object.cc (Xindex::initialize_symtab_xindex): New function.
15150         (Xindex::read_symtab_xindex): New function.
15151         (Xindex::sym_xindex_to_shndx): New function.
15152         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15153         available.
15154         (Sized_relobj::do_initialize_xindex): New function.
15155         (Sized_relobj::do_read_symbols): Adjust section links.
15156         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15157         parameter.  Change all callers.
15158         (Sized_relobj::include_section_group): Adjust section links and
15159         symbol section indexes.
15160         (Sized_relobj::do_layout): Adjust section links.
15161         (Sized_relobj::do_count_local_symbols): Adjust section links and
15162         symbol section indexes.
15163         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15164         ordinary and special symbols.
15165         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15166         dynsym_xindex parameters.  Change all callers.  Adjust section
15167         links.  Use SHN_XINDEX when needed.
15168         (Sized_relobj::get_symbol_location_info): Adjust section links.
15169         Don't get fooled by special symbols.
15170         * object.h (class Xindex): Define.
15171         (class Object): Add xindex_ parameter.  Declare virtual functoin
15172         do_initialize_xindex.
15173         (Object::adjust_sym_shndx): New function.
15174         (Object::set_xindex): New protected function.
15175         (class Symbol_value): Add is_ordinary_shndx_ field.
15176         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15177         (Symbol_value::value): Assert ordinary section.
15178         (Symbol_value::initialize_input_to_output_map): Likewise.
15179         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15180         Change all callers.
15181         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15182         all callers.
15183         (class Sized_relobj): Update declarations.
15184         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15185         parameter.  Change all callers.
15186         (Sized_relobj::adjust_shndx): New function.
15187         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15188         field.
15189         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15190         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15191         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15192         (Sized_dynobj::read_dynsym_section): Adjust section links.
15193         (Sized_dynobj::read_dynamic): Likewise.
15194         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15195         section links.
15196         (Sized_dynobj::do_initialize_xindex): New function.
15197         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15198         do_initialize_xindex.
15199         (Sized_dynobj::adjust_shndx): New function.
15200         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15201         dynsym_xindex_ fields.
15202         (Layout::finalize): Add a call to set_section_indexes before
15203         creating the symtab sections.
15204         (Layout::set_section_indexes): Don't do anything if the section
15205         already has a section index.
15206         (Layout::create_symtab_sections): Add shnum parameter.  Change
15207         caller.  Create .symtab_shndx section if needed.
15208         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15209         caller.
15210         (Layout::allocated_output_section_count): New function.
15211         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15212         needed.
15213         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15214         fields.  Update declarations.
15215         (Layout::symtab_xindex): New function.
15216         (Layout::dynsym_xindex): New function.
15217         (class Write_symbols_task): Add layout_ field.
15218         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15219         Change caller.
15220         * output.cc (Output_section_headers::Output_section_headers): Add
15221         shstrtab_section parameter.  Change all callers.
15222         (Output_section_headers::do_sized_write): Store overflow values
15223         for section count and section string table section index in
15224         section header zero.
15225         (Output_file_header::do_sized_write): Check for overflow of
15226         section count and section string table section index.
15227         (Output_symtab_xindex::do_write): New function.
15228         (Output_symtab_xindex::endian_do_write): New function.
15229         * output.h (class Output_section_headers): Add shstrtab_section_.
15230         Update declarations.
15231         (class Output_symtab_xindex): Define.
15232         (Output_section::has_out_shndx): New function.
15233         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15234         field.
15235         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15236         Change all callers.
15237         (Sized_symbol::init): Likewise.
15238         (Symbol::output_section): Check for ordinary symbol.
15239         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15240         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15241         callers.
15242         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15243         Change all callers.  Simplify handling of symbols from sections
15244         not included in the link.
15245         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15246         distinction.
15247         (Weak_alias_sorter::operator()): Assert that symbols are
15248         ordinary.
15249         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15250         distinction.
15251         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15252         parameters.  Change all callers.
15253         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15254         symbol distinction.  Use SHN_XINDEX when needed.
15255         (Symbol_table::write_section_symbol): Add symtab_xindex
15256         parameter.  Change all callers.
15257         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15258         SHN_XINDEX when needed.
15259         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15260         declarations.
15261         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15262         (Symbol::is_defined): Check is_ordinary.
15263         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15264         (Symbol::is_absolute, Symbol::is_common): Likewise.
15265         (class Sized_symbol): Update declarations.
15266         (class Symbol_table): Update declarations.
15267         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15268         parameters.  Change all callers.
15269         (Sized_symbol::override): Likewise.
15270         (Symbol_table::override): Likewise.
15271         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15272         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15273         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15274         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15275         to be in an ordinary section.
15276         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15277         object and is_ordinary parameters.  Change all callers.
15278         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15279         Change all callers.  Don't add undefined or non-ordinary symbols
15280         to reloc_map_.
15281         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15282         Change all callers.
15283         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15284         declarations.
15285         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15286         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15287         (Sized_relobj::relocate_sections): Likewise.
15288         * target-reloc.h (scan_relocs): Adjust section symbol index.
15289         (scan_relocatable_relocs): Likewise.
15290         * i386.cc (Scan::local): Check for ordinary symbols.
15291         * sparc.cc (Scan::local): Likewise.
15292         * x86_64.cc (Scan::local): Likewise.
15293         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15294         to symbol_section_and_value.
15295         * testsuite/many_sections_test.cc: New file.
15296         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15297         (check_PROGRAMS): Add many_sections_test.
15298         (many_sections_test_SOURCES): Define.
15299         (many_sections_test_DEPENDENCIES): Define.
15300         (many_sections_test_LDFLAGS): Define.
15301         (BUILT_SOURCES): Add many_sections_define.h.
15302         (many_sections_define.h): New target.
15303         (BUILT_SOURCES): Add many_sections_check.h.
15304         (many_sections_check.h): New target.
15305         (check_PROGRAMS): Add many_sections_r_test.
15306         (many_sections_r_test_SOURCES): Define.
15307         (many_sections_r_test_DEPENDENCIES): Define.
15308         (many_sections_r_test_LDFLAGS): Define.
15309         (many_sections_r_test_LDADD): Define.
15310         (many_sections_r_test.o): New target.
15311         * testsuite/Makefile.in: Rebuild.
15312
15313 2008-04-17  Cary Coutant  <ccoutant@google.com>
15314
15315         * errors.cc (Errors::info): New function.
15316         (gold_info): New function.
15317         * errors.h (Errors::info): New function.
15318         * gold.h (gold_info): New function.
15319         * object.cc (Input_objects::add_object): Print trace output.
15320         * options.cc (options::parse_set): New function.
15321         (General_options::parse_wrap): Deleted.
15322         (General_options::General_options): Deleted initializer.
15323         * options.h (options::String_set): New typedef.
15324         (options::parse_set): New function.
15325         (DEFINE_set): New macro.
15326         (General_options::wrap): Changed to use DEFINE_set. Changed
15327         callers of any_wrap_symbols and is_wrap_symbol.
15328         (General_options::trace, General_options::trace_symbol):
15329         New options.
15330         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15331         (General_options::wrap_symbols_): Deleted.
15332         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15333
15334 2008-04-17  David S. Miller  <davem@davemloft.net>
15335
15336         * options.cc (General_options::parse_V): New function.
15337         * options.h: Add entries for -V and -Qy.
15338
15339 2008-04-17  Ian Lance Taylor  <iant@google.com>
15340
15341         * common.cc (Symbol_table::allocate_commons): Remove options
15342         parameter.  Change caller.
15343         (Symbol_table::do_allocate_commons): Remove options parameter.
15344         Change caller.  Just call do_allocate_commons_list twice.
15345         (Symbol_table::do_allocate_commons_list): New function, broken out
15346         of do_allocate_commons.
15347         * common.h (class Allocate_commons_task): Remove options_ field.
15348         Update constructor.
15349         * symtab.cc (Symbol_table::Symbol_table): Initialize
15350         tls_commons_.
15351         (Symbol_table::add_from_object): Put TLS common symbols on
15352         tls_commons_ list.
15353         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15354         which are IN_OUTPUT_DATA.
15355         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15356         allocate_commons and do_allocate_commons declarations.  Declare
15357         do_allocate_commons_list.
15358         * gold.cc (queue_middle_tasks): Update creation of
15359         Allocate_commons_task to not pass options.
15360         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15361         (TLS_TEST_C_FLAGS): New variable.
15362         (tls_test_c_pic.o): New target.
15363         (tls_test_shared.so): Link in tls_test_c_pic.o.
15364         (tls_test_c_pic_ie.o): New target.
15365         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15366         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15367         (tls_test_c.o): New target.
15368         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15369         (tls_pic_test_LDADD): Likewise.
15370         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15371         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15372         (tls_test_c_gnu2.o): New target.
15373         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15374         tls_test_c_gnu2.o.
15375         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15376         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15377         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15378         * testsuite/tls_test.cc: Include "config.h".
15379         (t_last): Call t11_last.
15380         * testsuite/tls_test.h (t11, t11_last): Declare.
15381         * testsuite/tls_test_c.c: New file.
15382         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15383         * configure.ac: Check for OpenMP support.
15384         * configure, config.in, Makefile.in: Rebuild.
15385         * testsuite/Makefile.in: Rebuild.
15386
15387 2008-04-16  Cary Coutant  <ccoutant@google.com>
15388
15389         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15390         (Target_i386::tls_base_symbol_defined_): New field.
15391         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15392         (Target_i386::Scan::global): Likewise.
15393         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15394         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15395         (Target_x86_64::tls_base_symbol_defined_): New field.
15396         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15397         (Target_x86_64::Scan::global): Likewise.
15398
15399 2008-04-16  Cary Coutant  <ccoutant@google.com>
15400
15401         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15402         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15403         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15404         building shared libraries.
15405         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15406         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15407         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15408         * testsuite/Makefile.in: Rebuild.
15409         * testsuite/weak_undef.h: New file.
15410         * testsuite/weak_undef_file1.cc: Add extra test cases.
15411         * testsuite/weak_undef_file2.cc: Likewise.
15412         * testsuite/weak_undef_test.cc: Likewise.
15413
15414 2008-04-16  David S. Miller  <davem@davemloft.net>
15415
15416         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15417         Add issued_non_pic_error_ field.  Declare check_non_pic.
15418         (Target_sparc::Scan::check_non_pic): New function.
15419         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15420         (Target_sparc::Scan::global): Likewise.
15421
15422         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15423         * configure: Rebuild.
15424
15425         * options.h (DEFINE_enable): New macro.
15426         (new_dtags): New enable option.
15427         (initfirst, interpose, loadfltr, nodefaultlib,
15428         nodelete, nodlopen, nodump): New -z options.
15429         * layout.cc (Layout:finish_dynamic_section): If new
15430         dtags enabled, emit DT_RUNPATH.  Also, emit a
15431         DT_FLAGS_1 containing any specified -z flags.
15432
15433 2008-04-16  Ian Lance Taylor  <iant@google.com>
15434
15435         * copy-relocs.cc: New file.
15436         * copy-relocs.h: New file.
15437         * reloc.cc: Remove Copy_relocs code.
15438         * reloc.h: Likewise.
15439         * reloc-types.h (struct Reloc_types) [both versions]: Add
15440         get_reloc_addend_noerror.
15441         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15442         variants of add_global which take an addend which must be zero.
15443         * i386.cc: Include "copy-relocs.h".
15444         (class Target_i386): Change type of copy_relocs_ to variable,
15445         update initializer.
15446         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15447         Change all callers.
15448         (Target_i386::do_finalize_sections): Change handling of
15449         copy_relocs_.
15450         * sparc.cc: Include "copy-relocs.h".
15451         (class Target_sparc): Change type of copy_relocs_ to variable,
15452         update initializer.
15453         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15454         Change all callers.
15455         (Target_sparc::do_finalize_sections): Change handling of
15456         copy_relocs_.
15457         * x86_64.cc: Include "copy-relocs.h".
15458         (class Target_x86_64): Change type of copy_relocs_ to variable,
15459         update initializer.
15460         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15461         class.  Change all callers.
15462         (Target_x86_64::do_finalize_sections): Change handling of
15463         copy_relocs_.
15464         * Makefile.am (CCFILES): Add copy-relocs.cc.
15465         (HFILES): Add copy-relocs.h.
15466
15467         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15468
15469         * testsuite/script_test_4.sh: Permit leading zeroes.
15470
15471 2008-04-15  Ian Lance Taylor  <iant@google.com>
15472
15473         * script-sections.cc (Script_sections::create_segments): Use
15474         header_size_adjustment even when there is enough room for the
15475         headers.
15476         * testsuite/script_test_4.sh: New file.
15477         * testsuite/script_test_4.t: New file.
15478         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15479         (check_DATA): Add script_test_4.stdout.
15480         (MOSTLYCLEANFILES): Likewise.
15481         (script_test_4): New target.
15482         (script_test_4.stdout): New target.
15483         * testsuite/Makefile.in: Rebuild.
15484
15485         * sparc.cc: Add definitions for Output_data_plt_sparc class
15486         constants.
15487
15488 2008-04-14  David S. Miller  <davem@davemloft.net>
15489
15490         * sparc.cc: New file.
15491         * Makefile.am (TARGETSOURCES): Add sparc.cc
15492         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15493         * configure.tgt: Document targ_extra_size and
15494         targ_extra_big_endian.  Add entries for sparc-* and
15495         sparc64-*.
15496         * configure.ac: Handle targ_extra_size and
15497         targ_extra_big_endian.
15498         * Makefile.in: Rebuild.
15499         * configure: Likewise.
15500         * po/POTFILES.in: Likewise.
15501         * po/gold.pot: Likewise.
15502
15503 2008-04-14  Ian Lance Taylor  <iant@google.com>
15504
15505         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15506         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15507         in the name/type/flags to section mapping.  Don't call
15508         allocate_output_section.
15509         (Layout::choose_output_section): Change parameter from adjust_name
15510         to is_input_section.  Don't permit input sections after sections
15511         are attached to segments.  Don't call allocate_output_section.
15512         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15513         not write_enable_output_section.
15514         (Layout::make_output_section): Don't push to
15515         unattached_section_list_ nor call attach_to_segment.  Call
15516         attach_section_to_segment if sections are attached.
15517         (Layout::attach_sections_to_segments): New function.
15518         (Layout::attach_section_to_segment): New function.
15519         (Layout::attach_allocated_section_to_segment): Rename from
15520         attach_to_segment.  Remove flags parameter.
15521         (Layout::allocate_output_section): Remove function.
15522         (Layout::write_enable_output_section): Remove function.
15523         * layout.h (class Layout): Update for above changes.  Add new
15524         field sections_are_attached_.
15525         * output.h (Output_section::update_flags_for_input_section): New
15526         function.
15527         * output.cc (Output_section::add_input_section): Call
15528         update_flags_for_input_section.
15529         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15530
15531 2008-04-11  Cary Coutant  <ccoutant@google.com>
15532
15533         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15534         thought unnecessary.
15535         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15536
15537 2008-04-11  Ian Lance Taylor  <iant@google.com>
15538
15539         * output.h (class Output_section_data): Remove inline definition
15540         of set_addralign.
15541         * output.cc (Output_section_data::set_addralign): New function.
15542
15543 2008-04-11  Cary Coutant  <ccoutant@google.com>
15544
15545         Add support for TLS descriptors for i386 and x86_64.
15546         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15547         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15548         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15549         GOT_TYPE_TLS_DESC.
15550         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15551         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15552         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15553         relocations.
15554         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15555         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15556         Fix problem with initial-exec relocations.
15557         (Target_i386::Relocate::relocate_tls): Likewise.
15558         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15559         relaxation.
15560         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15561         support for section-plus-offset dynamic table entries.
15562         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15563         (Output_data_dynamic::Dynamic_entry): Add support for
15564         section-plus-offset dynamic table entries.
15565         (Output_data_dynamic::Classification): Likewise.
15566         (Output_data_dynamic::classification_): Renamed offset_.
15567         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15568         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15569         (Target_x86_64::make_plt_section): New function.
15570         (Target_x86_64::reserve_tlsdesc_entries): New function.
15571         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15572         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15573         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15574         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15575         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15576         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15577         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15578         add extra PLT entry for TLS descriptors.
15579         (Output_data_plt_x86_64::got_): New field.
15580         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15581         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15582         fields.
15583         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15584         descriptors.
15585         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15586         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15587         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15588         R_386_TLS_DESC_CALL relocations.
15589         (Target_x86_64::Scan::global): Likewise.
15590         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15591         for TLS descriptors.
15592         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15593         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15594         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15595         GD-to-IE relaxation.
15596         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15597         and TLS_DESCRIPTORS.
15598         * Makefile.in: Rebuild.
15599         * configure: Rebuild.
15600         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15601         (tls_test_shared2.so): New target.
15602         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15603         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15604         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15605         (tls_shared_gd_to_ie_test_LDADD): New variable.
15606         (tls_shared_gnu2_gd_to_ie_test): New target.
15607         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15608         New targets.
15609         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15610         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15611         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15612         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15613         (tls_shared_gnu2_test): New target.
15614         (tls_test_gnu2_shared.so): New target.
15615         (tls_shared_gnu2_test_SOURCES): New variable.
15616         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15617         (tls_shared_gnu2_test_LDFLAGS): New variable.
15618         (tls_shared_gnu2_test_LDADD): New variable.
15619         * testsuite/Makefile.in: Rebuild.
15620         * testsuite/Makefile.
15621
15622 2008-04-11  Ian Lance Taylor  <iant@google.com>
15623
15624         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15625         justsyms.t.
15626         * testsuite/Makefile.in: Rebuild.
15627
15628         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15629         long.
15630         * testsuite/script_test_2.cc (main): Adjust test.
15631
15632 2008-04-11  David S. Miller  <davem@davemloft.net>
15633             Ian Lance Taylor  <iant@google.com>
15634
15635         * options.h (General_options): Add entries for '-Y' and
15636         '-relax'.
15637         * options.cc (General_options:finalize): If -Y was used, add those
15638         entries to the library path instead of the default "/lib" and
15639         "/usr/lib".
15640
15641 2008-04-11  David S. Miller  <davem@davemloft.net>
15642
15643         * testsuite/justsyms.t: Start at 0x100.
15644         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15645         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15646         long.
15647         * testsuite/script_test_2.cc: Adjust string and section length
15648         checks.
15649
15650 2008-04-09  Ian Lance Taylor  <iant@google.com>
15651
15652         PR gold/5996
15653         * script-sections.cc (Sections_element::allocate_to_segment): Add
15654         orphan parameter.
15655         (Output_section_definition::allocate_to_segment): Likewise.
15656         (Orphan_output_section::allocate_to_segment): Likewise.
15657         (Script_sections::attach_sections_using_phdrs_clause): Don't
15658         propagate non-PT_LOAD segments to orphan sections.
15659         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15660         readelf rather than objdump.
15661         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15662         .interp section and PT_INTERP segment are the same size.
15663         * testsuite/Makefile.in: Rebuild.
15664
15665         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15666         aliases for symbols defined in the same object.
15667         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15668         (weak_alias_test_SOURCES): New variable.
15669         (weak_alias_test_DEPENDENCIES): New variable.
15670         (weak_alias_test_LDFLAGS): New variable.
15671         (weak_alias_test_LDADD): New variable.
15672         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15673         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15674         (weak_alias_test_3.o): New target.
15675         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15676         * testsuite/weak_alias_test_main.cc: New file.
15677         * testsuite/weak_alias_test_1.cc: New file.
15678         * testsuite/weak_alias_test_2.cc: New file.
15679         * testsuite/weak_alias_test_3.cc: New file.
15680
15681 2008-04-08  Ian Lance Taylor  <iant@google.com>
15682
15683         * options.h (class General_options): Add --noinhibit-exec option.
15684         * main.cc (main): Check --noinhibit-exec.
15685
15686         * options.h (class General_options): Define --wrap as a special
15687         option.  Add wrap_symbols_ field.
15688         (General_options::any_wrap_symbols): New function.
15689         (General_options::is_wrap_symbol): New function.
15690         * options.cc (General_options::parse_wrap): New function.
15691         (General_options::General_options): Initialize wrap_symbols_.
15692         * symtab.cc (Symbol_table::wrap_symbol): New function.
15693         (Symbol_table::add_from_object): Handle --wrap.
15694         * symtab.h (class Symbol_table): Declare wrap_symbol.
15695         * target.h (Target::wrap_char): New function.
15696         (Target::Target_info): Add wrap_char field.
15697         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15698         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15699         * testsuite/testfile.cc (Target_test::test_target_info):
15700         Likewise.
15701
15702         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15703         there is one.
15704
15705         * layout.h (class Layout): Add added_eh_frame_data_ field.
15706         * layout.cc (Layout::Layout): Initialize new field.
15707         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15708         output section until we find a section we merged successfully.
15709         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15710         that the size be non-zero.
15711
15712         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15713         qualifier.
15714
15715 2008-04-08  Craig Silverstein  <csilvers@google.com>
15716
15717         * configure.ac: Export new conditional variable HAVE_ZLIB.
15718         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15719         on HAVE_ZLIB.
15720         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15721         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15722
15723 2008-04-07  Ian Lance Taylor  <iant@google.com>
15724
15725         * version.cc (version_string): Set to "1.5".
15726
15727         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15728         Add issued_non_pic_error_ field.  Declare check_non_pic.
15729         (Target_x86_64::Scan::check_non_pic): New function.
15730         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15731         (Target_x86_64::Scan::global): Likewise.
15732
15733         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15734         addend parameter.  Change caller.  Handle merge sections.
15735         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15736         Address to Addend.  Don't add in the result of
15737         local_section_offset, pass down the addend and use the returned
15738         value.
15739         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15740         Update declarations of local_section_offset and symbol_value.
15741         * testsuite/two_file_test_1.cc (t18): New function.
15742         * testsuite/two_file_test_2.cc (f18): New function.
15743         * testsuite/two_file_test_main.cc (main): Call t18.
15744         * testsuite/two_file_test.h (t18, f18): Declare.
15745
15746         * configure.ac: Don't test for objdump, c++filt, or readelf.
15747         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15748         conditionals.
15749         (TEST_READELF): New variable.
15750         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15751         (check_PROGRAMS): Add two_file_strip_test.
15752         (two_file_strip_test): New target.
15753         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15754         (two_file_same_shared_strip_test_SOURCES): New variable.
15755         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15756         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15757         (two_file_same_shared_strip_test_LDADD): New variable.
15758         (two_file_shared_strip.so): New target.
15759         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15760         (ver_test_5.syms, ver_test_7.syms): Likewise.
15761         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15762         (strip_test_3.stdout): Use TEST_OBJDUMP.
15763         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15764
15765 2008-04-04  Cary Coutant  <ccoutant@google.com>
15766
15767         * symtab.h (Symbol::is_weak_undefined): New function.
15768         (Symbol::is_strong_undefined): New function.
15769         (Symbol::is_absolute): New function.
15770         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15771         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15772         absolute symbols.
15773         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15774         (weak_undef_test): New target.
15775         * testsuite/Makefile.in: Rebuild.
15776         * testsuite/weak_undef_file1.cc: New file.
15777         * testsuite/weak_undef_file2.cc: New file.
15778         * testsuite/weak_undef_test.cc: New file.
15779
15780 2008-04-03  Craig Silverstein  <csilvers@google.com>
15781
15782         * compressed_output.h (class Output_compressed_section): Use
15783         unsigned buffer.
15784         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15785         add zlib header.
15786         (zlib_compressed_suffix): Removed.
15787         (Output_compressed_section::set_final_data_size): Use unsigned
15788         buffers.
15789         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15790         Fix linker invocation.
15791         (flagstest_o_specialfile_and_compress_debug_sections):
15792         Likewise.
15793         * testsuite/Makefile.in: Regenerated.
15794
15795 2008-04-02  David S. Miller  <davem@davemloft.net>
15796
15797         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15798         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15799
15800 2008-04-02  Craig Silverstein  <csilvers@google.com>
15801
15802         * TODO: New file.
15803
15804 2008-04-02  Ian Lance Taylor  <iant@google.com>
15805
15806         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15807         parameters.  Update for new key type to views_.  Change all
15808         callers.
15809         (File_read::read): Adjust for byteshift in returned view.
15810         (File_read::add_view): New function, broken out of
15811         find_and_make_view.
15812         (File_read::make_view): New function, broken out of
15813         find_and_make_view.
15814         (File_read::find_or_make_view): Add offset and aligned
15815         parameters.  Rewrite accordingly.  Change all callers.
15816         (File_read::get_view): Add offset and aligned parameters.  Adjust
15817         for byteshift in return value.
15818         (File_read::get_lasting_view): Likewise.
15819         * fileread.h (class File_read): Update declarations.
15820         (class File_read::View): Add byteshift_ field.  Add byteshift to
15821         constructor.  Add byteshift method.
15822         * archive.h (Archive::clear_uncached_views): New function.
15823         (Archive::get_view): Add aligned parameter.  Change all callers.
15824         * object.h (Object::get_view): Add aligned parameter.  Change all
15825         callers.
15826         (Object::get_lasting_view): Likewise.
15827
15828         * fileread.cc (File_read::release): Don't call clear_views if
15829         there are multiple objects.
15830         * fileread.h (File_read::clear_uncached_views): New function.
15831         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15832         on the archive.
15833
15834 2008-03-31  Cary Coutant  <ccoutant@google.com>
15835
15836         Add thin archive support.
15837         * archive.cc (Archive::armagt): New const.
15838         (Archive::setup): Remove task parameter and calls to unlock.
15839         (Archive::unlock_nested_archives): New function.
15840         (Archive::read_header): Add nested_off parameter. Change
15841         all callers.
15842         (Archive::interpret_header): Likewise.
15843         (Archive::include_all_members): Change to handle thin
15844         archives.
15845         (Archive::include_member): Likewise.
15846         * archive.h (Archive::Archive): Add new parameters and
15847         initializers.
15848         (Archive::armagt): New const.
15849         (Archive::setup): Remove task parameter.
15850         (Archive::unlock_nested_archives): New function.
15851         (Archive::read_header): Add nested_off parameter.
15852         (Archive::interpret_header): Likewise.
15853         (Archive::Nested_archive_table): New typedef.
15854         (Archive::is_thin_archive_): New field.
15855         (Archive::nested_archives_): New field.
15856         (Archive::options_): New field.
15857         (Archive::dirpath_): New field.
15858         (Archive::task_): New field.
15859         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15860         for thin archives.  Pass additional parameters to
15861         Archive::Archive.  Unlock the archive file after calling
15862         Archive::setup.
15863
15864 2008-03-29  Ian Lance Taylor  <iant@google.com>
15865
15866         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15867         version symbol to be local.
15868         * testsuite/ver_test_4.sh: New file.
15869         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15870         (check_DATA): Add ver_test_4.syms.
15871         (ver_test_4.syms): New target.
15872         * testsuite/Makefile.in: Rebuild.
15873
15874         * output.cc
15875         (Output_section::Input_section_sort_entry::has_priority): New
15876         function.
15877         (Output_section::Input_section_sort_entry::match_file_name): New
15878         function.
15879         (Output_section::Input_section_sort_entry::match_section_name):
15880         Remove.
15881         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15882         Remove.
15883         (Output_section::Input_section_sort_entry::match_section_file):
15884         Remove.
15885         (Output_section::Input_section_sort_compare::operator()): Rewrite
15886         using new Input_section_sort_entry functions.  Sort crtbegin and
15887         crtend first.  Sort sections with no priority before sections with
15888         a priority.
15889         * testsuite/initpri1.c (d3): Check j != 4.
15890         (cd5): New constructor/destructor function.
15891         (main): Check j != 2.
15892
15893         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15894         new symbol when resolving, don't call set_is_default.
15895         * testsuite/ver_test_7.cc: New file.
15896         * testsuite/ver_test_7.sh: New file.
15897         * testsuite/Makefile.am (ver_test_7.so): New target.
15898         (ver_test_7.o): New target.
15899         (check_SCRIPTS): Add ver_test_7.sh.
15900         (check_DATA): Add ver_test_7.syms.
15901         (ver_test_7.syms): New target.
15902
15903 2008-03-28  Ian Lance Taylor  <iant@google.com>
15904
15905         * layout.cc (Layout::layout): If we see an input section with a
15906         name that needs sorting, set the must_sort flag for the output
15907         section.
15908         (Layout::make_output_section): If the name of the output section
15909         indicates that it might require sorting, set the may_sort flag.
15910         * output.h (Output_section::may_sort_attached_input_sections): New
15911         function.
15912         (Output_section::set_may_sort_attached_input_sections): New
15913         function.
15914         (Output_section::must_sort_attached_input_sections): New
15915         function.
15916         (Output_section::set_must_sort_attached_input_sections): New
15917         function.
15918         (class Output_section): Declare Input_section_sort_entry.  Define
15919         Input_section_sort_compare.  Declare
15920         sort_attached_input_sections.  Add new fields:
15921         may_sort_attached_input_sections_,
15922         must_sort_attached_input_sections_,
15923         attached_input_sections_are_sorted_.
15924         * output.cc (Output_section::Output_section): Initialize new
15925         fields.
15926         (Output_section::add_input_section): Add an entry to
15927         input_sections_ if may_sort or must_sort are true.
15928         (Output_section::set_final_data_size): Call
15929         sort_attached_input_sections if necessary.
15930         (Output_section::Input_section_sort_entry): Define new class.
15931         (Output_section::Input_section_sort_compare::operator()): New
15932         function.
15933         (Output_section::sort_attached_input_sections): New function.
15934         * configure.ac: Check whether the compiler supports constructor
15935         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15936         * testsuite/initpri1.c: New file.
15937         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15938         CONSTRUCTOR_PRIORITY.
15939         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15940         (initpri1_LDFLAGS): New variable.
15941         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15942
15943 2008-03-27  Ian Lance Taylor  <iant@google.com>
15944
15945         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15946         * testsuite/common_test_1.c: New file.
15947         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15948         (common_test_1_SOURCES): New variable.
15949         (common_test_1_DEPENDENCIES): New variable.
15950         (common_test_1_LDFLAGS): New variable.
15951
15952         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15953         and commons_ correctly when NAME/VERSION does not override
15954         NAME/NULL.
15955         * testsuite/ver_test_6.c: New file.
15956         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15957         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15958         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15959
15960 2008-03-26  Ian Lance Taylor  <iant@google.com>
15961
15962         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15963         of an undefined symbol from a version script.
15964         * testsuite/Makefile.am (ver_test_5.so): New target.
15965         (ver_test_5.o): New target.
15966         (check_SCRIPTS): Add ver_test_5.sh.
15967         (check_DATA): Add ver_test_5.syms.
15968         (ver_test_5.syms): New target.
15969         * testsuite/ver_test_5.cc: New file.
15970         * testsuite/ver_test_5.script: New file.
15971         * testsuite/ver_test_5.sh: New file.
15972         * Makefile.in, testsuite/Makefile.in: Rebuild.
15973
15974         PR gold/5986
15975         Fix problems building gold with gcc 4.3.0.
15976         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15977         (gold_error_at_location, gold_warning_at_location): Use it.
15978         * configure.ac: Check whether we can compile and use a template
15979         function with a printf attribute.
15980         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15981         when jumping over bytes.
15982         * object.cc: Instantiate Object::read_section_data.
15983         * debug.h: Include <cstring>
15984         * dwarf_reader.cc: Include <algorithm>
15985         * main.cc: Include <cstring>.
15986         * options.cc: Include <cstring>.
15987         * output.cc: Include <cstring>.
15988         * script.cc: Include <cstring>.
15989         * script.h: Include <string>.
15990         * symtab.cc: Include <cstring> and <algorithm>.
15991         * target-select.cc: Include <cstring>.
15992         * version.cc: Include <string>.
15993         * testsuite/testmain.cc: Include <cstdlib>.
15994         * configure, config.in: Rebuild.
15995
15996 2008-03-25  Ian Lance Taylor  <iant@google.com>
15997
15998         * options.cc: Include "../bfd/bfdver.h".
15999         (options::help): Print bug reporting address.
16000
16001         * version.cc (print_version): Adjust output for current value of
16002         BFD_VERSION_STRING.
16003
16004         * NEWS: New file.
16005
16006         * options.cc (options::help): Print list of supported targets.
16007         * target-select.h: Include <vector>.
16008         (class Target_selector): Make machine_, size_, and is_big_endian_
16009         fields const.  Add bfd_name_ and instantiated_target_ fields.
16010         (Target_selector::Target_selector): Add bfd_name parameter.
16011         (Target_selector::recognize): Make non-virtual, call
16012         do_recognize.
16013         (Target_selector::recognize_by_name): Make non-virtual, call
16014         do_recognize_by_name.
16015         (Target_selector::supported_names): New function.
16016         (Target_selector::bfd_name): New function.
16017         (Target_selector::do_instantiate_target): New pure virtual
16018         function.
16019         (Target_selector::do_recognize): New virtual function.
16020         (Target_selector::do_recognize_by_name): New virtual function.
16021         (Target_selector::instantiate_target): New private function.
16022         (supported_target_names): Declare.
16023         * target-select.cc (Target_selector::Target_selector): Update for
16024         new parameter and fields.
16025         (select_target_by_name): Check that the name matches before
16026         calling recognize_by_name.
16027         (supported_target_names): New function.
16028         * i386.cc (class Target_selector_i386): Update Target_selector
16029         constructor call.  Remove recognize and recognize_by_name.  Add
16030         do_instantiate_target.
16031         * x86_64.cc (class Target_selector_x86_64): Likewise.
16032         * testsuite/testfile.cc (class Target_selector_test): Update for
16033         changes to Target_selector.
16034
16035         * README: Rewrite, with some notes on unsupported features.
16036
16037 2008-03-24  Cary Coutant  <ccoutant@google.com>
16038
16039         * i386.cc (Target_i386::Got_type): New enum declaration.
16040         (Target_i386::Scan::local): Updated callers of Output_data_got
16041         member functions.
16042         (Target_i386::Scan::global): Likewise.
16043         (Target_i386::Relocate::relocate): Likewise.
16044         (Target_i386::Relocate::relocate_tls): Likewise.
16045         * object.h (Got_offset_list): New class.
16046         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16047         (Sized_relobj::local_got_offset): Likewise.
16048         (Sized_relobj::set_local_got_offset): Likewise.
16049         (Sized_relobj::local_has_tls_got_offset): Removed.
16050         (Sized_relobj::local_tls_got_offset): Removed.
16051         (Sized_relobj::set_local_tls_got_offset): Removed.
16052         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16053         * output.cc (Output_data_got::add_global): Added got_type parameter.
16054         (Output_data_got::add_global_with_rel): Likewise.
16055         (Output_data_got::add_global_with_rela): Likewise.
16056         (Output_data_got::add_global_pair_with_rel): New function.
16057         (Output_data_got::add_global_pair_with_rela): New function.
16058         (Output_data_got::add_local): Added got_type parameter.
16059         (Output_data_got::add_local_with_rel): Likewise.
16060         (Output_data_got::add_local_with_rela): Likewise.
16061         (Output_data_got::add_local_pair_with_rel): New function.
16062         (Output_data_got::add_local_pair_with_rela): New function.
16063         (Output_data_got::add_global_tls): Removed.
16064         (Output_data_got::add_global_tls_with_rel): Removed.
16065         (Output_data_got::add_global_tls_with_rela): Removed.
16066         (Output_data_got::add_local_tls): Removed.
16067         (Output_data_got::add_local_tls_with_rel): Removed.
16068         (Output_data_got::add_local_tls_with_rela): Removed.
16069         * output.h (Output_data_got::add_global): Added got_type parameter.
16070         (Output_data_got::add_global_with_rel): Likewise.
16071         (Output_data_got::add_global_with_rela): Likewise.
16072         (Output_data_got::add_global_pair_with_rel): New function.
16073         (Output_data_got::add_global_pair_with_rela): New function.
16074         (Output_data_got::add_local): Added got_type parameter.
16075         (Output_data_got::add_local_with_rel): Likewise.
16076         (Output_data_got::add_local_with_rela): Likewise.
16077         (Output_data_got::add_local_pair_with_rel): New function.
16078         (Output_data_got::add_local_pair_with_rela): New function.
16079         (Output_data_got::add_global_tls): Removed.
16080         (Output_data_got::add_global_tls_with_rel): Removed.
16081         (Output_data_got::add_global_tls_with_rela): Removed.
16082         (Output_data_got::add_local_tls): Removed.
16083         (Output_data_got::add_local_tls_with_rel): Removed.
16084         (Output_data_got::add_local_tls_with_rela): Removed.
16085         * resolve.cc (Symbol::override_base_with_special): Removed
16086         reference to has_got_offset_ field.
16087         * symtab.cc (Symbol::init_fields): Replaced initialization
16088         of got_offset_ with got_offsets_.  Removed initialization
16089         of has_got_offset_
16090         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16091         (Symbol::got_offset): Likewise.
16092         (Symbol::set_got_offset): Likewise.
16093         (Symbol::has_tls_got_offset): Removed.
16094         (Symbol::tls_got_offset): Removed.
16095         (Symbol::set_tls_got_offset): Removed.
16096         (Symbol::got_offset_): Removed.
16097         (Symbol::tls_mod_got_offset_): Removed.
16098         (Symbol::tls_pair_got_offset_): Removed.
16099         (Symbol::got_offsets_): New field.
16100         (Symbol::has_got_offset): Removed.
16101         (Symbol::has_tls_mod_got_offset): Removed.
16102         (Symbol::has_tls_pair_got_offset): Removed.
16103         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16104         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16105         member functions.
16106         (Target_x86_64::Scan::global): Likewise.
16107         (Target_x86_64::Relocate::relocate): Likewise.
16108         (Target_x86_64::Relocate::relocate_tls): Likewise.
16109
16110 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16111
16112         * yyscript.y: Fix spelling error in comment.
16113
16114 2008-03-24  Ian Lance Taylor  <iant@google.com>
16115
16116         * options.h (class General_options): Define build_id option.
16117         * layout.h (class Layout): Declare write_build_id, create_note,
16118         create_build_id.  Add build_id_note_ member.
16119         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16120         "libiberty.h", "md5.h", "sha1.h".
16121         (Layout::Layout): Initialize eh_frame_data_,
16122         eh_frame_hdr_section_, and build_id_note_.
16123         (Layout::finalize): Call create_build_id.
16124         (Layout::create_note): New function, broken out of
16125         Layout::create_gold_note.
16126         (Layout::create_gold_note): Call create_note.
16127         (Layout::create_build_id): New function.
16128         (Layout::write_build_id): New function.
16129         (Close_task_runner::run): Call write_build_id.
16130
16131         * x86_64.cc: Correct license to GPLv3.
16132
16133 2008-03-23  Ian Lance Taylor  <iant@google.com>
16134
16135         * options.cc: Include "demangle.h".
16136         (parse_optional_string): New function.
16137         (parse_long_option): Handle takes_optional_argument.
16138         (parse_short_option): Update dash_z initializer.  Handle
16139         takes_optional_argument.
16140         (General_options::General_options): Initialize do_demangle_.
16141         (General_options::finalize): Set do_demangle_.  Handle demangling
16142         style.
16143         * options.h (parse_optional_string): Declare.
16144         (struct One_option): Add optional_arg field.  Update constructor.
16145         Update call constructor calls.  Add takes_optional_argument
16146         function.
16147         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16148         (DEFINE_optional_string): Define.
16149         (General_options::demangle): Change from DEFINE_bool to
16150         DEFINE_optional_string.
16151         (General_options::no_demangle): New function.
16152         (General_options::do_demangle): New function.
16153         (General_options::set_do_demangle): New function.
16154         (General_options::execstack_status_): Move definition to end of
16155         class definition.
16156         (General_options::static_): Likewise.
16157         (General_options::do_demangle_): New field.
16158         * object.cc (big_endian>::get_symbol_location_info): Call
16159         Options::do_demangle, not Options::demangle.
16160         * symtab.cc (demangle): Likewise.
16161
16162 2008-03-22  Ian Lance Taylor  <iant@google.com>
16163
16164         * gold.h: Include <cstddef> and <sys/types.h>
16165         * options.h: Include <cstring>.
16166
16167 2008-03-21  Ian Lance Taylor  <iant@google.com>
16168
16169         * Added source code to GNU binutils.
16170 \f
16171 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16172
16173 Copying and distribution of this file, with or without modification,
16174 are permitted in any medium without royalty provided the copyright
16175 notice and this notice are preserved.
16176
16177 Local Variables:
16178 mode: change-log
16179 left-margin: 8
16180 fill-column: 74
16181 version-control: never
16182 End: