daily update
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-10-28  Alan Modra  <amodra@gmail.com>
2
3         Apply trunk patches
4         2014-10-22  Alan Modra  <amodra@gmail.com>
5         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
6         thread_starter.
7
8 2014-09-30  Cary Coutant  <ccoutant@google.com>
9
10         PR gold/17432
11         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
12
13 2014-09-30  Kito Cheng  <kito@0xlab.org>
14
15         PR gold/13597
16         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
17         hash table before sysv-style hash table.
18
19 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
20
21         * options.h (--pic-executable): Add negative to alias to -no-pie.
22
23 2014-09-26  Cary Coutant  <ccoutant@google.com>
24
25         PR gold/16773
26         * object.cc (Sized_relobj_file): Compute value of section symbols
27         for TLS sections the same as TLS symbols.
28
29 2014-09-25  Cary Coutant  <ccoutant@google.com>
30
31         PR gold/17432
32         * resolve.cc (Symbol_table::resolve): Override common placeholder
33         symbols, but adjust sizes.
34         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
35         symbols to common lists.
36
37 2014-09-24  Alan Modra  <amodra@gmail.com>
38
39         * po/POTFILES.in: Regenerate.
40
41 2014-09-23  Taiju Tsuiki  <tzik@google.com>
42             Cary Coutant  <ccoutant@google.com>
43
44         PR gold/14860
45         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
46         on input_sections_blocker.
47         * layout.cc (Write_sections_task::locks): Unblock
48         input_sections_blocker_.
49         * layout.h (Write_sections_task::Write_sections_task): Add
50         input_sections_blocker.
51         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
52         to DEPENDENCIES.
53         * testsuite/Makefile.in: Regenerate.
54
55 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
56
57         * testsuite/Makefile.am (plugin_test_10): New test.
58         * testsuite/Makefile.in: Regenerate
59         * testsuite/plugin_common_test_2.c (c1): Align to 8.
60         * testsuite/plugin_test_10.sh: New file.
61
62 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
63
64         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
65         * resolve.cc (Symbol_table::resolve): Don't override common symbols
66         during the replacement phase.
67
68 2014-09-17  Han Shen  <shenhan@google.com>
69             Jing Yu  <jingyu@google.com>
70
71         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
72         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
73         * aarch64.cc (Target_aarch64): Add data members
74         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
75         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
76         constructor.
77         (Target_aarch64::do_reloc_symbol_index): New method.
78         (Target_aarch64::do_reloc_addend): New method.
79         (Target_aarch64::add_tlsdesc_info): New method.
80         (Target_aarch64::do_dynsym_value): New method.
81         (Target_aarch64::do_make_data_plt): Add new parameters: got,
82         got_irelative. Pass them to Output_data_plt_aarch64_standard.
83         (Target_aarch64::make_data_plt): Add new parameters: got,
84         got_irelative. Pass them to do_make_data_plt.
85         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
86         (Target_aarch64::Relocate:tls_gd_to_le): New method.
87         (Target_aarch64::Relocate:tls_ie_to_le): New method.
88         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
89         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
90         (Target_aarch64::got_tlsdesc_section): New method.
91         (Target_aarch64::make_local_ifunc_plt_entry): New method.
92         (Target_aarch64::define_tls_base_symbol): New method.
93         (Target_aarch64::reserve_tlsdesc_entries): New method.
94         (Target_aarch64::got_mod_index_entry): New method.
95         (Target_aarch64::rela_tlsdesc_section): New method.
96         (Target_aarch64::rela_irelative_section): New method.
97         (Target_aarch64::Tlsdesc_info): New struct.
98         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
99         relocations and tlsdesc relocations.
100         (Target_aarch64::optimize_tls_reloc): Implement method.
101         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
102         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
103         in constructor.
104         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
105         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
106         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
107         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
108         (Output_data_plt_aarch64::rela_tlsdesc): New method.
109         (Output_data_plt_aarch64::rela_irelative): New method.
110         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
111         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
112         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
113         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
114         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
115         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
116         (Output_data_plt_aarch64_standard): New member variables:
117         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
118         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
119         New parameter: got, got_irelative.
120         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
121         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
122         (Output_data_plt_aarch64::do_write): Replace got_address with
123         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
124         (AArch64_relocate_functions::update_movnz): New method.
125         (AArch64_relocate_functions): Correct format.
126         (AArch64_relocate_functions::movnz): New method.
127         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
128         before the switch. Add new cases to switch.
129         Check ie_to_le relaxation on tlsie relocations. Add code handling
130         tlsgd tlsdesc cases.
131         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
132         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
133         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
134         Call reloc_name_in_error_message to print unsupported reloc.
135         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
136         make_data_plt.
137         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
138         relocs. Fill in some more dynamic tags.
139         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
140         Skip call tls_get_addr when tlsgd is relaxed.
141         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
142         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
143         tlsdesc->ie relaxation.
144
145 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
146
147         * mips.cc (Target_mips_nacl): New class.
148         (Target_selector_mips_nacl): New class.
149         (target_selector_mips32): Rename from target_selector_mips32be and use
150         Target_selector_mips_nacl instead of Target_selector_mips.
151         (target_selector_mips32el): Rename from target_selector_mips32 and use
152         Target_selector_mips_nacl instead of Target_selector_mips.
153         (target_selector_mips64): Rename from target_selector_mips64be and use
154         Target_selector_mips_nacl instead of Target_selector_mips.
155         (target_selector_mips64el): Rename from target_selector_mips64 and use
156         Target_selector_mips_nacl instead of Target_selector_mips.
157         (Target_mips::mips_info): Add const attribute.
158
159 2014-09-02  Cary Coutant  <ccoutant@google.com>
160
161         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
162         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
163         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
164         (Sized_incr_dynobj::do_section_name): Likewise.
165         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
166         (Sized_incr_dynobj::do_section_name): Likewise.
167         * object.h (Object::section_name): Likewise.
168         (Object::do_section_name): Likewise.
169         (Sized_relobj_file::do_section_name): Likewise.
170         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
171         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
172
173 2014-09-02  Cary Coutant  <ccoutant@google.com>
174
175         PR gold/17005
176         * ehframe.cc (Fde::write): Add output_offset parameter.
177         (Cie::write): Likewise.
178         (Eh_frame::set_final_data_size): Account for offset within output
179         section.
180         (Eh_frame::do_sized_write): Likewise.
181         * ehframe.h (Fde::write): Add output_offset parameter.
182         (Cie::write): Likewise.
183         * output.cc (Output_section::Input_section_sort_entry): Remove
184         section_has_name_; add output_section_name parameter. Use
185         output section name for non-input sections.
186         (Output_section::Input_section_sort_entry::section_has_name): Remove.
187         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
188         (Output_section::Input_section_sort_compare): Remove logic for
189         sections without names.
190         (Output_section::Input_section_sort_init_fini_compare): Likewise.
191         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
192         Likewise.
193         (Output_section::Input_section_sort_section_name_compare): Likewise.
194
195 2014-08-29 Han Shen <shenhan@google.com>
196            Jing Yu <jingyu@google.com>
197
198         * aarch64-reloc-property.cc
199         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
200         reference reloc property in the table.
201         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
202         3 other entries.
203         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
204         2 new overloaded methods.
205         (Output_data_got_aarch64::do_write): Add code to write out
206         static relocs.
207         (class Output_data_got_aarch64::Static_reloc): New class to wrap
208         static relocs.
209         (Output_data_got_aarch64::static_relocs): New vector to
210         hold static relocs.
211         (Target_aarch64::TCB_SIZE): New const static memeber.
212         (Target_aarch64::tcb_size): New method.
213         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
214         (Target_aarch64::Relocate::relocate_tls): New method.
215         (Target_aarch64::Scan::local): Add code handling new reloc types.
216         (Target_aarch64::Scan::global): Add code handling new reloc types.
217
218 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
219
220         * options.h (-no-pie): Add option.
221
222 2014-08-08  Jing Yu  <jingyu@google.com>
223             Han Shen  <shenhan@google.com>
224
225         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
226         (DEFFILES): add aarch64-reloc.def.
227         (TARGETSOURCES): Add aarch64-reloc-property.cc.
228         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
229         * Makefile.in: Regenerate.
230         * aarch64-reloc-property.cc: New file.
231         * aarch64-reloc-property.h: New file.
232         * aarch64-reloc.def: New file.
233         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
234         with tab to make the format consistent.
235         (Output_data_got_aarch64::symbol_table_): New method.
236         (Target_aarch64::do_plt_address_for_global): New method.
237         (Target_aarch64::do_plt_address_for_local): New method.
238         (Target_aarch64::do_select_as_default_target): New method.
239         (Target_aarch64::do_make_data_plt): New method.
240         (Target_aarch64::make_data_plt): New method.
241         (Output_data_plt_aarch64::has_irelative_section): New method.
242         (Output_data_plt_aarch64::address_for_global): New method.
243         (Output_data_plt_aarch64::address_for_local): New method.
244         (Output_data_plt_aarch64::irelative_rel_): New parameter.
245         (Output_data_plt_aarch64::add_entry): Implement contents.
246         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
247         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
248         the got_pov entry to plt0.
249         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
250         Implement contents.
251         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
252         (AArch64_howto): New struct.
253         (aarch64_howto[]): New static const array.
254         (AArch64_relocate_functions): New class.
255         (Target_aarch64::Scan::get_reference_flags): Remove method.
256         (Target_aarch64::Scan::local): Implement to support a few relocations.
257         (Target_aarch64::Scan::global): Implement to support a few relocations.
258         (Target_aarch64::make_plt_section): Implement contents.
259         (Target_aarch64::make_plt_entry): Implement contents.
260         (Target_aarch64::do_finalize_sections): Implement contents.
261         (Target_aarch64::Relocate::relocate): Implement a few relocations.
262         (Target_aarch64::relocate_section): Implement contents.
263
264 2014-08-06  Alan Modra  <amodra@gmail.com>
265
266         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
267
268 2014-08-06  Alan Modra  <amodra@gmail.com>
269
270         PR 13227
271         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
272
273 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
274
275         * object.cc (Relobj::is_section_name_included): Add
276         ".rodata.nptl_version" to not garbage collect this section.
277
278 2014-07-08  Cary Coutant  <ccoutant@google.com>
279
280         * expression.cc (struct Expression::Expression_eval_info): Add
281         new fields type_pointer, vis_pointer, and nonvis_pointer.
282         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
283         nonvis_pointer parameters. Adjust all calls.
284         (Symbol_expression::value): Update type, visibility, and nonvis bits
285         in caller.
286         * script.cc (Symbol_assignment::sized_finalize): Update type,
287         visibility, and remaining st_other bits for new symbol.
288         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
289         vis_pointer, and nonvis_pointer parameters.
290         * symtab.h (Symbol::set_type): New method.
291
292         * testsuite/Makefile.am (defsym_test): New test.
293         * testsuite/Makefile.in: Regenerate.
294         * testsuite/defsym_test.c: New file.
295         * testsuite/defsym_test.sh: New file.
296
297 2014-07-08  Cary Coutant  <ccoutant@google.com>
298
299         PR gold/15639
300         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
301         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
302         (Sized_dynobj::base_read_symbols): ...new method.
303         * object.h (Sized_relobj_file::base_read_symbols): New method.
304         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
305         (Sized_relobj_file::base_read_symbols): ...new method.
306         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
307         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
308         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
309
310 2014-07-04  Alan Modra  <amodra@gmail.com>
311
312         * po/POTFILES.in: Regenerate.
313
314 2014-07-02  Jing Yu  <jingyu@google.com>
315
316         * aarch64.cc: New file
317         * Makefile.am (TARGETSOURCES): Add aarch64.cc
318         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
319         * Makefile.in: Regenerate.
320         * configure.tgt: Add entries for aarch64*.
321         * configure.ac:  Likewise.
322         * configure: Likewise.
323
324 2014-06-27  Alan Modra  <amodra@gmail.com>
325
326         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
327
328 2014-06-24  Cary Coutant  <ccoutant@google.com>
329
330         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
331         sections.
332         (Dwo_file::sized_read_unit_index): Likewise.
333
334 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
335
336         * mips.cc: New file.
337         * Makefile.am (TARGETSOURCES): Add mips.cc
338         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
339         * configure.tgt: Add entries for mips*.
340         * configure.ac: Likewise.
341         * Makefile.in: Regenerate.
342         * configure: Likewise.
343
344 2014-06-09  Cary Coutant  <ccoutant@google.com>
345
346         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
347         unit_length is within section bounds.
348
349 2014-06-09  Cary Coutant  <ccoutant@google.com>
350
351         PR gold/16980
352         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
353         map.
354
355 2014-06-07  Alan Modra  <amodra@gmail.com>
356
357         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
358
359 2014-06-06  Cary Coutant  <ccoutant@google.com>
360
361         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
362         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
363         (Dwarf_pubnames_table::read_header): Likewise.
364         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
365         .debug_gnu_pubtypes.
366
367 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
368
369         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
370         * Makefile.in, configure: Regenerate.
371
372 2014-06-03  Alan Modra  <amodra@gmail.com>
373
374         * powerpc.cc (addis_12_2): Define.
375         (Stub_table::do_write): Support fusion on ELFv2 stubs.
376
377 2014-06-03  Alan Modra  <amodra@gmail.com>
378
379         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
380         st_other output.
381
382 2014-06-02  Alan Modra  <amodra@gmail.com>
383
384         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
385         Only ignore relocs on ELFv1.
386         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
387
388 2014-05-30  Cary Coutant  <ccoutant@google.com>
389
390         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
391         * testsuite/Makefile.in: Regenerate.
392         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
393
394 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
395
396         PR gold/16945
397         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
398         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
399
400 2014-05-15  Alan Modra  <amodra@gmail.com>
401
402         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
403         Compare FDE contents with DW_CFA_nop rather than 0.
404
405 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
406
407         * symtab.h (may_need_copy_reloc): Remove check for position independent
408         code.
409         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
410         position independence before pc absolute may_need_copy_reloc call.
411         Add check for executable output befor pc relative may_need_copy_reloc
412         call.
413         * i386.cc: Ditto.
414         * arm.cc: Ditto.
415         * sparc.cc: Ditto.
416         * tilegx.cc: Ditto.
417         * powerpc.cc: Add check for no position independence before
418         may_need_copy_reloc calls.
419         * testsuite/pie_copyrelocs_test.cc: New file.
420         * testsuite/pie_copyrelocs_shared_test.cc: New file.
421         * Makefile.am (pie_copyrelocs_test): New test.
422         * Makefile.in: Regenerate.
423
424 2014-05-08  Martin Liška  <mliska@suse.cz>
425
426         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
427
428 2014-05-06  Cary Coutant  <ccoutant@google.com>
429
430         PR gold/16900
431         * i386.cc (Output_data_got_plt_i386): New class.
432         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
433         parameter. Change all callers.
434         (Output_data_plt_i386::layout_): Remove.
435         (Output_data_plt_i386::got_plt_): Change type.
436         (Target_i386::got_plt_): Change type. Change all references.
437         (Target_i386::got_section): Create instance of new class.
438         (Output_data_got_plt_i386::do_write): New function.
439         * x86_64.cc (Output_data_got_plt_x86_64): New class.
440         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
441         parameter. Change all callers.
442         (Output_data_plt_x86_64::layout_): Remove.
443         (Output_data_plt_x86_64::got_plt_): Change type.
444         (Target_x86_64::got_plt_): Change type. Change all references.
445         (Target_x86_64::got_section): Create instance of new class.
446         (Output_data_got_plt_x86_64::do_write): New function.
447         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
448         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
449         class.
450
451 2014-05-05  Cary Coutant  <ccoutant@google.com>
452
453         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
454         if we have pubnames/pubtypes.
455
456 2014-05-02  Cary Coutant  <ccoutant@google.com>
457
458         * defstd.cc (in_segment): Define __ehdr_start here...
459         * layout.cc (Layout::finalize): ...Instead of here.  Set the
460         output segment when known.
461         * resolve.cc (Symbol::override_base_with_special): Remember
462         the original binding.
463         * symtab.cc (Symbol::set_output_segment): New function.
464         (Symbol::set_undefined): New function.
465         * symtab.h (Symbol::is_weak_undefined): Check original undef
466         binding.
467         (Symbol::is_strong_undefined): New function.
468         (Symbol::set_output_segment): New function.
469         (Symbol::set_undefined): New function.
470         * target-reloc.h (is_strong_undefined): Remove.
471         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
472         Check for hidden undefs.
473         (relocate_section): Call Symbol::is_strong_undefined.
474
475         * testsuite/Makefile.am (ehdr_start_test_1)
476         (ehdr_start_test_2, ehdr_start_test_3)
477         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
478         * testsuite/Makefile.in: Regenerate.
479         * testsuite/ehdr_start_def.cc: New source file.
480         * testsuite/ehdr_start_test.cc: New source file.
481         * testsuite/ehdr_start_test.t: New linker script.
482         * testsuite/ehdr_start_test_4.sh: New shell script.
483
484 2014-04-23  Cary Coutant  <ccoutant@google.com>
485
486         PR gold/16870
487         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
488
489 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
490
491         * layout.cc (Layout::include_section): Allow a target to decide
492         whether to include a section.
493         * target.h (Target::should_include_section): New function.
494         (Target::do_should_include_section): New function.
495
496 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
497
498         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
499         inline into ...
500         (Copy_relocs::emit): ... here.
501         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
502         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
503         (Copy_reloc_entry::entries_): Change from private to protected.
504
505 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
506
507         * icf.cc (get_section_contents): Replace copies of reloc
508         vectors with const references.
509
510 2014-04-02  Cary Coutant  <ccoutant@google.com>
511
512         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
513         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
514         * configure: Regenerate.
515         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
516         -fno-use-linker-plugin.
517         (LINK1, CXXLINK1): Add it to the link command.
518         * testsuite/Makefile.in: Regenerate.
519
520 2014-03-12  Alan Modra  <amodra@gmail.com>
521
522         * Makefile.in: Regenerate.
523
524 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
525
526         * symtab.h (Symbol::set_nonvis): New function.
527
528 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
529
530         * symtab.cc (Sized_symbol<32>::init_output_data):
531         Instantiate the template.
532         (Sized_symbol<64>::init_output_data): Likewise.
533
534 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
535
536         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
537         adjust dynamic symbol value.
538         * target.h (Target::adjust_dyn_symbol): New function.
539         (Target::do_adjust_dyn_symbol): New function.
540
541 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
542
543         * output.cc (Output_data_dynamic::Dynamic_entry::write):
544         Get the value of DYNAMIC_CUSTOM dynamic entry.
545         * output.h (Output_data_dynamic::add_custom): New function.
546         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
547         dynamic entry.
548         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
549         * target.h (Target::dynamic_tag_custom_value): New function.
550         (Target::do_dynamic_tag_custom_value): New function.
551
552 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
553
554         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
555         dynsym indexes.
556         * target.h (Target::has_custom_set_dynsym_indexes): New function.
557         (Target::do_has_custom_set_dynsym_indexes): New function.
558         (Target::set_dynsym_indexes): New function.
559         (Target::do_set_dynsym_indexes): New function.
560
561 2014-03-07  Alan Modra  <amodra@gmail.com>
562
563         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
564         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
565         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
566         (Powerpc_relocate_functions::has_overflow_bitfield,
567         overflowed): Use the above.
568         (Target_powerpc::Relocate::relocate): Correct overflow checking
569         for a number of relocations.  Modify overflow test for 16-bit
570         fields in instructions to signed/unsigned according to whether
571         the field takes a signed or unsigned value.
572
573 2014-03-05  Alan Modra  <amodra@gmail.com>
574
575         Update copyright years.
576
577 2014-03-05  Alan Modra  <amodra@gmail.com>
578
579         * powerpc.cc (Target_powerpc::Scan::local, global): Support
580         R_PPC64_ADDR64_LOCAL.
581         (Target_powerpc::Relocate::relocate): Likewise.
582
583 2014-03-03  Alan Modra  <amodra@gmail.com>
584
585         * dwp.cc (print_version): Update copyright year to current.
586
587 2014-02-10  Alan Modra  <amodra@gmail.com>
588
589         * po/gold.pot: Regenerate.
590
591 2014-02-06  Cary Coutant  <ccoutant@google.com>
592
593         Fix problem where -u is ignored when a weak undef is seen.
594
595         * archive.cc (Library_base::should_include_member): Reorder
596         code to check for -u option if a weak undef has already been seen.
597         * testsuite/Makefile.am (weak_undef_test_2): New test case.
598         * testsuite/Makefile.in: Regenerate.
599         * testsuite/weak_undef_file3.cc: New file.
600         * testsuite/weak_undef_file4.cc: New file.
601         * testsuite/weak_undef_test_2.cc: New file.
602
603 2014-02-05  Cary Coutant  <ccoutant@google.com>
604
605         Fix issues with gold undefined symbol diagnostics.
606
607         PR binutils/15435
608         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
609         check to here.
610         * target-reloc.h (is_strong_undefined): New function.
611         (relocate_section): Move undef vtable symbol check from here.
612         Check for is_strong_undefined.
613
614 2014-02-05  Cary Coutant  <ccoutant@google.com>
615
616         Fix problems with the --dynamic-list option.
617
618         PR gold/13577
619         * options.cc (General_options::parse_dynamic_list):
620         Set have_dynamic_list_.
621         (General_options::General_options): Initialize have_dynamic_list_.
622         (General_options::finalize): Turn off -Bsymbolic and
623         -Bsymbolic-functions if --dynamic-list provided.
624         * options.h (General_options::have_dynamic_list): New function.
625         (General_options::have_dynamic_list_): New data member.
626         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
627         correctly.
628
629         PR gold/16530
630         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
631         in --dynamic-list, mark it.
632
633         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
634         (dynamic_list_2): New test case.
635         * testsuite/Makefile.in: Regenerate.
636         * testsuite/dynamic_list_2.cc: New file.
637         * testsuite/dynamic_list_2.t: New file.
638         * testsuite/dynamic_list_lib1.cc: New file.
639         * testsuite/dynamic_list_lib2.cc: New file.
640         * testsuite/gc_dynamic_list_test.c: New file.
641         * testsuite/gc_dynamic_list_test.sh: New file.
642         * testsuite/gc_dynamic_list_test.t: New file.
643
644 2014-01-28  Cary Coutant  <ccoutant@google.com>
645
646         Add .gdb_index version 7 support.
647
648         * gold/dwarf_reader.cc: include <utility> (for make_pair).
649         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
650         debug sections.
651         (Dwarf_ranges_table::read_ranges_table): Likewise.
652         (Dwarf_pubnames_table::read_section): Check for GNU-style
653         sections, and for compressed debug sections.
654         (Dwarf_pubnames_table::read_header): Compute end address of table.
655         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
656         for end of list by offset, not by offset == 0.
657         (Dwarf_info_reader::do_read_string_table): Check for compressed
658         debug sections.
659         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
660         Initialize new data members.
661         (Dwarf_pubnames_table::next_name): return flag_byte.
662         (Dwarf_pubnames_table::end_of_table_): New data member.
663         (Dwarf_pubnames_table::is_gnu_style_): New data member.
664         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
665         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
666         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
667         read skeleton type unit DIEs.
668         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
669         (Gdb_index::do_write): Write flag_byte.
670         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
671         (Gdb_index::Cu_vector): Store flags along with cu indexes.
672         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
673         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
674
675 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
676
677         * version.cc (print_version): Update copyright year to 2014.
678
679 2013-12-19  Dimitry Andric  <dimitry@andric.com>
680
681         * stringpool.cc (Stringpool_template::reserve): Add
682         HAVE_UNORDERED_MAP case.
683         * stringpool.cc (Stringpool_template::print_stats): Likewise.
684
685 2013-12-18  Cary Coutant  <ccoutant@google.com>
686
687         * configure.ac: Check for <unordered_set> and <unordered_map>.
688         * config.in: Regenerate.
689         * configure: Regenerate.
690         * system.h: Use <unordered_set> and <unordered_map> if available.
691
692 2013-12-10  Roland McGrath  <mcgrathr@google.com>
693
694         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
695         with $(INSTALL_PROGRAM_ENV).
696         * Makefile.in: Regenerate.
697
698 2013-11-22  Cary Coutant  <ccoutant@google.com>
699
700         * configure.ac: Add check for which library is needed for
701         dlopen.
702         * configure: Regenerate.
703
704 2013-11-22  Cary Coutant  <ccoutant@google.com>
705
706         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
707         assembler.
708         * testsuite/Makefile.in: Regenerate.
709
710 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
711
712         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
713         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
714         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
715         (Target_x86_64<size>::Scan::local): Likewise.
716         (Target_x86_64<size>::Scan::global): Likewise.
717         (Target_x86_64<size>::Relocate::relocate): Likewise.
718         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
719         Likewise.
720         (Target_x86_64<size>::Scan::check_non_pic(): Handle
721         R_X86_64_PC32_BND.
722
723         * testsuite/Makefile.am (check_PROGRAMS): Add
724         exception_x86_64_bnd_test.
725         (exception_x86_64_bnd_test_SOURCES): New macro.
726         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
727         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
728         (exception_x86_64_bnd_test_LDADD): Likewise.
729         (exception_x86_64_bnd_1.o): New rule.
730         (exception_x86_64_bnd_2.o): Likewise.
731         * testsuite/Makefile.in: Regenerated.
732
733 2013-11-15  Alan Modra  <amodra@gmail.com>
734
735         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
736         accessor.
737         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
738         Only call ppc64_local_entry_offset for 64-bit.  Restrict
739         symval_for_branch lookup to ELFv1.
740         (Stub_table::add_plt_call_entry): Use unsigned int off.
741         (Output_data_glink::Address, invalid_address): New.
742         (Output_data_glink::add_eh_frame): Move out of line.  Add
743         support for ELFv2.
744         (Output_data_glink::add_global_entry, find_global_entry,
745         global_entry_address): New functions.
746         (Output_data_glink::global_entry_stubs_, end_branch_table_,
747         ge_size): New variables.
748         (Output_data_glink::set_final_data_size): Add global entry
749         stub sizing.
750         (Output_data_glink::do_write): Write global entry stubs.
751         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
752         parameter.  Return true for ELFv2.  Adjust callers.
753         (Target_powerpc::Scan::local, global): Restrict opd lookup to
754         ELFv1.  Similarly for ifunc and dynamic relocation processing
755         specific to ELFv1.  Recognize that symbols are defined on
756         their plt entries for ELFv2.
757         (Target_powerpc::symval_for_branch): Assert if called for
758         ELFv2 or ppc32.
759         (Target_powerpc::Relocate::relocate): Use global entry plt
760         stub for symbol value if such exists on ELFv2.
761         (Target_powerpc::Relocate::relocate): Don't call
762         symval_for_branch when ELFv2.  Do adjust for local entry
763         offset when ELFv2.
764         (Target_powerpc::do_dynsym_value): Set symbols to global entry
765         plt stub for ELFv2.
766         (Target_powerpc::do_plt_address_for_global): Similarly.
767
768 2013-11-14  Cary Coutant  <ccoutant@google.com>
769
770         Revert patch -- this did not fix the problem, and there is
771         no race there.
772
773         2013-11-14  Cary Coutant  <ccoutant@google.com>
774
775             PR gold/14860
776             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
777             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
778             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
779             updating fde_offsets_.
780             (Eh_frame_hdr::lock_): New data member.
781
782 2013-11-14  Cary Coutant  <ccoutant@google.com>
783
784         * dwp.cc (Dwo_file_entry): New type.
785         (File_list): Use Dwo_file_entry.
786         (Dwo_file::verify): New function.
787         (Dwo_file::verify_dwo_list): New function.
788         (Dwo_file::sized_verify_dwo_list): New function.
789         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
790         list.
791         (Dwp_options): New enum type.
792         (dwp_options): Add --verify-only.
793         (usage): Likewise.
794         (main): Likewise.
795         * dwp.h (gold_info): Add declaration.
796
797 2013-11-14  Cary Coutant  <ccoutant@google.com>
798
799         PR gold/14860
800         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
801         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
802         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
803         updating fde_offsets_.
804         (Eh_frame_hdr::lock_): New data member.
805
806 2013-11-06  Cary Coutant  <ccoutant@google.com>
807
808         PR gold/15758
809         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
810         before reloc sections.
811
812 2013-11-04  Alan Modra  <amodra@gmail.com>
813
814         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
815         (Symbol::needs_dynamic_reloc): Test new flag.
816         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
817         (Target_powerpc::Scan::get_reference_flags): Add target param.
818         Return FUNC_DESC_ABI for 64-bit ELFv1.
819         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
820         call.
821         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
822         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
823
824 2013-10-31  Cary Coutant  <ccoutant@google.com>
825
826         Restore support for dwp v2 DWARF package file format.
827
828         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
829         tu_length parameter.  Adjust all callers.
830         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
831         * dwp.cc: Include dwarf.h.
832         (Section_bounds): New struct type.
833         (Unit_set): New struct type.
834         (Dwo_file::Dwo_file): Initialize new data member.
835         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
836         Combine and rename to...
837         (Dwo_file::read_unit_index): ...this.
838         (Dwo_file::sized_read_compunit_index)
839         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
840         (Dwo_file::sized_read_unit_index): ...this.
841         (Dwo_file::copy_section): Remove section_name, is_str_offsets
842         parameters; add section_id parameter.
843         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
844         (Dwo_file::add_unit_set): ...this.
845         (Dwo_file::shndx_map_): Remove.
846         (Dwo_file::sect_offsets_): New data member.
847         (Dwp_output_file::Dwp_output_file): Initialize new data members.
848         (Dwp_output_file::add_section): Rename to...
849         (Dwp_output_file::add_contribution): ...this.
850         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
851         (Dwp_output_file::add_tu_set): Likewise.
852         (Dwp_output_file::Contribution): New type.
853         (Dwp_output_file::Section::contributions): New data member.
854         (Dwp_output_file::Cu_or_tu_set): Remove.
855         (Dwp_output_file::Section::Section): New ctor.
856         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
857         (Dwp_output_file::Dwp_index::Section_table): New type.
858         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
859         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
860         parameter.
861         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
862         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
863         (Dwp_output_file::Dwp_index::section_table): New member function.
864         (Dwp_output_file::Dwp_index::section_table_end): New member function.
865         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
866         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
867         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
868         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
869         (Dwp_output_file::Dwp_index::section_table_): New data member.
870         (Dwp_output_file::Dwp_index::section_mask_): New data member.
871         (Dwp_output_file::add_output_section): New member function.
872         (Dwp_output_file::write_new_section): New member function.
873         (Dwp_output_file::write_contributions): New member function.
874         (Dwp_output_file::section_id_map_): New data member.
875         (class Dwo_id_info_reader): Remove.
876         (class Unit_reader): New class.
877         (get_dwarf_section_name): New function.
878         (Dwo_file::read_executable): Adjust initializations of class data.
879         (Dwo_file::read): Add support for v2 package file format.
880         (Dwo_file::read_unit_index): Likewise.
881         (Dwo_file::sized_read_unit_index): Likewise.
882         (Dwo_file::copy_section): Likewise.
883         (Dwo_file::add_unit_set): Likewise.
884         (Dwp_output_file::add_output_section): Likewise.
885         (Dwp_output_file::add_contribution): Likewise.
886         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
887         for empty slot.
888         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
889         file format.
890         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
891         slot.
892         (Dwp_output_file::initialize): Remove unused function.
893         (Dwp_output_file::finalize): Add support for v2 package file format.
894         (Dwp_output_file::write_index): Likewise.
895         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
896         function prototype.
897
898 2013-10-31  Cary Coutant  <ccoutant@google.com>
899
900         * configure.ac: Fix check for -fmerge-constants.
901         * configure.ac: Regenerate.
902
903 2013-10-30  Roland McGrath  <mcgrathr@google.com>
904
905         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
906         Correct 9-byte nop sequence to match what the assembler generates.
907
908 2013-10-30  Alan Modra  <amodra@gmail.com>
909
910         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
911         ppc64_local_entry_offset, ppc64_local_entry_offset,
912         do_read_symbols): New functions.
913         (Powerpc_relobj::e_flags_, st_other_): New vars.
914         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
915         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
916         (Powerpc_relobj::e_flags_): New var.
917         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
918         and adjust for ELFv2.
919         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
920         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
921         (Powerpc_dynobj::do_find_special_sections): Likewise.
922         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
923         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
924         to ELFv2 local entry.
925         (Target_powerpc::do_relax): No thread safe barriers needed for
926         ELFv2.
927         (Output_data_plt_powerpc::initial_plt_entry_size_,
928         plt_entry_size): Delete.  Replace all uses with
929         first_plt_entry_offset() and plt_entry_size().
930         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
931         reserved_size parm.  Update callers.
932         (Output_data_plt_powerpc::entry_count): Update.
933         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
934         and use Target_powerpc::first_plt_entry_offset().
935         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
936         rename to plt_entry_size.
937         (Output_data_plt_powerpc::add_ifunc_entry,
938         add_local_ifunc_entry): Adjust reloc for ELFv2.
939         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
940         (glink_eh_frame_fde_64v2): New.
941         (Stub_table::plt_call_size): Support ELFv2 sizing.
942         (Output_data_glink::add_eh_frame): Use the new FDE.
943         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
944         (Stub_table::do_write): Write ELFv2 stubs and glink.
945         (Target_powerpc::Relocate::relocate): Replaces nop after call
946         with ld 2,24(1) and adjust local offset destination for ELFv2.
947
948 2013-10-30  Alan Modra  <amodra@gmail.com>
949
950         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
951         (Target_powerpc::Scan::global, local): Likewise.
952         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
953         on all ppc64 @h and @ha relocs.
954
955 2013-10-14  Alan Modra  <amodra@gmail.com>
956
957         * output.h (Output_data_got::add_constant): Tidy.
958         (Output_data_got::add_constant_pair): New function.
959         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
960         methods used so as to first call reserve_ent().
961
962 2013-10-11  Roland McGrath  <mcgrathr@google.com>
963
964         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
965         add_got_entry and add_got_entry_pair.
966
967         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
968         (HAVE_PUBNAMES): Likewise.
969         * configure: Regenerate.
970
971         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
972         * testsuite/Makefile.in: Regenerate.
973
974         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
975         Remove const from declaration.
976         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
977         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
978         * output.h (Output_file_header): Remove const from member target_
979         and corresponding constructor argument.
980         * output.cc (Output_file_header::Output_file_header): Update prototype.
981         (Output_file_header::do_sized_write): Use this->target_ in place
982         of parameters()->target().
983
984         * testsuite/undef_symbol.cc (Foo::get_a): New method.
985
986         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
987         * configure: Regenerate.
988         * Makefile.in: Regenerate.
989         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
990         * testsuite/merge_string_literals_2.c: Likewise.
991         * testsuite/Makefile.am
992         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
993         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
994         literal -fmerge-constants.
995         * testsuite/Makefile.in: Regenerate.
996
997         * i386.cc (Target_i386): Remove unused member dynbss_.
998         * arm.cc (Target_arm): Likewise.
999         * powerpc.cc (Target_powerpc): Likewise.
1000         * sparc.cc (Target_sparc): Likewise.
1001         * tilegx.cc (Target_tilegx): Likewise.
1002         * x86_64.cc (Target_x86_64): Likewise.
1003         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1004         type_signature_, type_offset_.
1005         * plugin.h (Plugin_hook): Remove unused member layout_.
1006         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1007         mapfile_.
1008         (Read_member): Remove unused members input_objects_, symtab_,
1009         mapfile_, layout_.
1010         (Check_library): Remove unused member symtab_.
1011         * archive.h (Lib_group): Remove unused member lib_.
1012         * archive.cc (Lib_group::Lib_group): Update initializer.
1013         * incremental.h (Incremental_binary): Remove unused member target_.
1014         (Incremental_script_entry): Removed unused member script_.
1015         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1016         * icf.h (Icf): Remove unused member num_tracked_relocs.
1017
1018         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1019         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1020         its only use.
1021         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1022
1023         * archive.h: Use struct rather than class for forward declaration
1024         of Read_symbols_data.
1025
1026 2013-10-07  Cary Coutant  <ccoutant@google.com>
1027
1028         PR gold/16010
1029         * testsuite/Makefile.am (icf_test): Fix dependencies.
1030         (icf_safe_test): Likewise.
1031         (icf_safe_so_test): Likewise.
1032         (large_symbol_alignment): Add empty _LDADD rule.
1033         * testsuite/Makefile.in: Regenerate.
1034
1035 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1036
1037         PR gold/15927
1038         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1039         relocation for R_X86_64_32 on x32.
1040
1041 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1042
1043         * output.cc (Output_segment::set_section_addresses): Take new
1044         Target* argument.  If target->isolate_execinstr() and the segment
1045         is executable and starts at a target->abi_pagesize() boundary,
1046         pad its end out to a target->abi_pagesize() boundary with code fill.
1047         * output.h (Output_segment::set_section_addresses): Update decl.
1048         * layout.h (Layout::check_output_data_for_reset_values): Take new
1049         argument RELAX_OUTPUTS.
1050         (Layout): New member relax_output_list_.
1051         (Layout::add_relax_output): New method.
1052         * layout.cc (Layout::Layout): Update constructor.
1053         (Layout::reset_relax_output): New method.
1054         (Layout::clean_up_after_relaxation): Call it.
1055         (Layout::prepare_for_relaxation): Update caller.
1056         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1057         Call reset_relax_output before re-processing segments for
1058         isolate_execinstr case.
1059         (Layout::write_data): Handle relax_output_list_.
1060         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1061         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1062
1063 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1064
1065         PR binutils/15834
1066         * object.h: Fix typos.
1067
1068 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1069
1070         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1071         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1072
1073 2013-08-07  Cary Coutant  <ccoutant@google.com>
1074
1075         Revert support for v2 DWP files:
1076
1077         2013-03-01  Cary Coutant  <ccoutant@google.com>
1078
1079             Add dwp support for v2 DWARF package file format.
1080             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1081             tu_length parameter.  Adjust all callers.
1082             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1083             * dwp.cc: Include dwarf.h.
1084             (Section_bounds): New struct type.
1085             (Unit_set): New struct type.
1086             (Dwo_file::Dwo_file): Initialize new data member.
1087             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1088             Combine and rename to...
1089             (Dwo_file::read_unit_index): ...this.
1090             (Dwo_file::sized_read_compunit_index)
1091             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1092             (Dwo_file::sized_read_unit_index): ...this.
1093             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1094             parameters; add section_id parameter.
1095             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1096             (Dwo_file::add_unit_set): ...this.
1097             (Dwo_file::shndx_map_): Remove.
1098             (Dwo_file::sect_offsets_): New data member.
1099             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1100             (Dwp_output_file::add_section): Rename to...
1101             (Dwp_output_file::add_contribution): ...this.
1102             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1103             (Dwp_output_file::add_tu_set): Likewise.
1104             (Dwp_output_file::Contribution): New type.
1105             (Dwp_output_file::Section::contributions): New data member.
1106             (Dwp_output_file::Cu_or_tu_set): Remove.
1107             (Dwp_output_file::Section::Section): New ctor.
1108             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1109             (Dwp_output_file::Dwp_index::Section_table): New type.
1110             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1111             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1112             parameter.
1113             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1114             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1115             (Dwp_output_file::Dwp_index::section_table): New member function.
1116             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1117             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1118             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1119             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1120             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1121             (Dwp_output_file::Dwp_index::section_table_): New data member.
1122             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1123             (Dwp_output_file::add_output_section): New member function.
1124             (Dwp_output_file::write_new_section): New member function.
1125             (Dwp_output_file::write_contributions): New member function.
1126             (Dwp_output_file::section_id_map_): New data member.
1127             (class Dwo_id_info_reader): Remove.
1128             (class Unit_reader): New class.
1129             (get_dwarf_section_name): New function.
1130             (Dwo_file::read_executable): Adjust initializations of class data.
1131             (Dwo_file::read): Add support for v2 package file format.
1132             (Dwo_file::read_unit_index): Likewise.
1133             (Dwo_file::sized_read_unit_index): Likewise.
1134             (Dwo_file::copy_section): Likewise.
1135             (Dwo_file::add_unit_set): Likewise.
1136             (Dwp_output_file::add_output_section): Likewise.
1137             (Dwp_output_file::add_contribution): Likewise.
1138             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1139             for empty slot.
1140             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1141             file format.
1142             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1143             slot.
1144             (Dwp_output_file::initialize): Remove unused function.
1145             (Dwp_output_file::finalize): Add support for v2 package file format.
1146             (Dwp_output_file::write_index): Likewise.
1147             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1148             function prototype.
1149
1150 2013-07-31  Cary Coutant  <ccoutant@google.com>
1151
1152         * object.cc (Sized_relobj::do_output_section_address): New function.
1153         (Sized_relobj): Instantiate explicitly.
1154         * object.h (Object::output_section_address): New function.
1155         (Object::do_output_section_address): New function.
1156         (Sized_relobj::do_output_section_address): New function.
1157         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1158
1159 2013-07-30  Cary Coutant  <ccoutant@google.com>
1160             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1161
1162         * parameters.cc (Parameters::entry): Return target-specific entry
1163         symbol name.
1164         * target.h (Target::entry_symbol_name): New function.
1165         (Target_info::entry_symbol_name): New data member.
1166
1167         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1168         * i386.cc (Target_i386::i386_info): Likewise.
1169         (Target_i386_nacl::i386_nacl_info): Likewise.
1170         * sparc.cc (Target_sparc::sparc_info): Likewise.
1171         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1172         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1173         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1174         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1175
1176 2013-07-22  Sterling Augustine  <saugustine@google.com>
1177
1178         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1179         Convert parameter shndx to local variable. Add parameters symtab
1180         and symtab_size.  Scan over section names.  Find relocation
1181         section corresponding to current section.  Create and initialize
1182         reloc_mapper_ and reloc_type_.
1183         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1184         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1185         cu_offset_.
1186         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1187         Initialize new fields unit_length_ and cu_offset_.
1188         (Dwarf_pubnames_table::read_section): Update prototype.
1189         (Dwarf_pubnames_table::cu_offset): New member function.
1190         (Dwarf_pubnames_table::subsection_size): Likewise.
1191         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1192         New fields.
1193         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1194         member functions public.
1195         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1196         Update comment.  Rework logic.  Move repeated parts to...
1197         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1198         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1199         pubtypes_table_, and stmt_list_offset.
1200         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1201         Gdb_index::find_pubtype_offset,
1202         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1203         (Gdb_index::pubnames_read): Update prototype and rework logic.
1204         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1205         Forward declare.
1206         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1207         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1208         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1209         Gdb_index::map_pubtable_to_dies):
1210         Declare functions.
1211         (Gdb_index::pubnames_read): Update declaration.
1212         (Gdb_index::Pubname_offset_map): New type.
1213         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1214         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1215         Gdb_index::stmt_list_offset): Declare.
1216         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1217         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1218         Gdb_index::pubtypes_offset_): Remove.
1219
1220 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1221
1222         * options.h (General_options): Add -Trodata-segment option.
1223         * parameters.cc (Parameters::check_rodata_segment): New function.
1224         (Parameters::set_target_once): Call it.
1225         * parameters.h (Parameters): Declare it (private member function).
1226         * layout.cc (load_seg_unusable_for_headers): New function, broken
1227         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1228         then validate rodata segment rather than text segment.
1229         (relaxation_loop_body): Call that.
1230         (is_text_segment): New function.  Don't admit a non-executable
1231         segment if TARGET->isolate_execinstr().
1232         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1233
1234 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1235
1236         PR gold/15070
1237         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1238         * nacl.h (Sniff_file::View::View): Request aligned view.
1239
1240 2013-07-11  Cary Coutant  <ccoutant@google.com>
1241
1242         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1243         correct BRLT entry size.
1244
1245 2013-07-03  Alan Modra  <amodra@gmail.com>
1246
1247         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1248         comment.
1249
1250 2013-07-01  Cary Coutant  <ccoutant@google.com>
1251
1252         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1253         reloc_type_.
1254         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1255         (Dwarf_ranges_table::lookup_reloc): New function.
1256         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1257         reloc_type_.
1258         (Dwarf_ranges_table::lookup_reloc): New function.
1259         (Dwarf_ranges_table::reloc_type_): New data member.
1260
1261 2013-06-27  Jing Yu  <jingyu@google.com>
1262
1263         PR gold/15662
1264         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1265         function.
1266         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1267         (Target_powerpc::do_relax): Call the above.
1268
1269 2013-06-27  Cary Coutant  <ccoutant@google.com>
1270
1271         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1272         on garbage collected .opd section.
1273
1274 2013-06-27  Alan Modra  <amodra@gmail.com>
1275
1276         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1277         is non-zero.
1278         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1279         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1280
1281 2013-06-14  Cary Coutant  <ccoutant@google.com>
1282
1283         * resolve.cc (Symbol::override_base): Don't override st_type
1284         from plugin placeholder symbols.
1285         (Symbol_table::resolve): Likewise.
1286         (Symbol_table::should_override): Don't complain about TLS mismatch
1287         if the TO symbol is a plugin placeholder.
1288         * testsuite/Makefile.am (plugin_test_tls): New test.
1289         * testsuite/Makefile.in: Regenerate.
1290         * testsuite/plugin_test_tls.sh: New test script.
1291         * testsuite/two_file_test_2_tls.cc: New test source.
1292         * testsuite/two_file_test_tls.cc: New test source.
1293
1294 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1295
1296         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1297         the maximum segment alignment is larger than the page size.
1298         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1299         correctly aligns the symbols with large alignemnt.
1300         * testsuite/Makefile.in: Regenerate.
1301         * testsuite/large_symbol_alignment.cc: New file.
1302
1303 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1304             Sriraman Tallam  <tmsriram@google.com>
1305
1306         * options.h (sort_section): New option.
1307         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1308         Rename from Input_section_sort_section_name_special_ordering_compare.
1309         (Input_section_sort_section_name_compare): New struct.
1310         * output.cc (Output_section::Input_section_sort_section_name_compare::
1311         operator()): New function.
1312         (Output_section::sort_attached_input_sections): Use new sort function
1313         for .text if --sort-section=name is specified.
1314         * layout.cc (Layout::make_output_section):
1315         Add sorting by name when --sort-section=name is specified.
1316         * testsuite/Makefile.am (text_section_grouping): Test option
1317         --sort-section=name.
1318         * testsuite/Makefile.in: Regenerate.
1319         * testsuite/section_sorting_name.cc: New file.
1320         * testsuite/section_sorting_name.sh: New file.
1321
1322 2013-05-21  Cary Coutant  <ccoutant@google.com>
1323
1324         * symtab.h (Symbol::is_cxx_vtable): New function.
1325         * target-reloc.h (relocate_section): Check for vtable symbol.
1326         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1327         * testsuite/Makefile.in: Regenerate.
1328         * testsuite/missing_key_func.cc: New test source.
1329         * testsuite/missing_key_func.sh: New test script.
1330
1331 2013-05-21  Cary Coutant  <ccoutant@google.com>
1332
1333         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1334         type of enclosing symbol.
1335         (Relocate_info::location): Check symbol type when describing symbol.
1336         * object.h (Symbol_location_info): Remove unused line_number;
1337         add enclosing_symbol_type.
1338         * testsuite/debug_msg.sh: Adjust expected output.
1339
1340 2013-05-13  Cary Coutant  <ccoutant@google.com>
1341
1342         * configure.ac: Export DEFAULT_TARGET.
1343         * configure: Regenerate.
1344         * Makefile.in: Regenerate.
1345         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1346         * testsuite/Makefile.in: Regenerate.
1347         * testsuite/debug_msg.sh: Delete duplicate tests.
1348         Don't check undef_int error message match for powerpc where the
1349         source file and line number aren't available.
1350
1351 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1352
1353         * options.h (General_options): Add --rosegment-gap option.
1354         * options.cc (finalize): --rosegment-gap implies --rosegment.
1355         * layout.cc (set_segment_offsets): Let user option override
1356         target->rosegment_gap().
1357
1358 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1359
1360         * options.h (General_options): Remove leading space from help
1361         messages for -nostdlib and --rosegment.
1362
1363 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1364
1365         PR ld/15365
1366         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1367
1368 2013-05-03  Alan Modra  <amodra@gmail.com>
1369
1370         * merge.cc (Output_merge_string::do_add_input_section): Correct
1371         scan for number of strings.  Rename vars to avoid shadowing.
1372         Include missing terminator in input_size_.
1373
1374 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1375
1376         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1377         Restore empty string handling.
1378
1379 2013-05-01  Cary Coutant  <ccoutant@google.com>
1380
1381         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1382         uninitialized warning.
1383
1384 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1385
1386         * output.cc (Output_section::add_merge_input_section): Allow
1387         to merge sections if the alignment is more than character size.
1388         * merge.h (Output_merge_string::Output_merge_string): Remove
1389         assert.
1390         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1391         only not-null strings. Check the alignment of strings.
1392         * stringpool.h
1393         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1394         alignment as the argument.
1395         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1396         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1397         Align non-zero length strings according to the addralign_.
1398         (Stringpool_template<Stringpool_char>::set_string_offsets):
1399         Updating offsets according to the given alignment.
1400         * testsuite/Makefile.am (text_section_grouping): Test if string
1401         literals are getting merged.
1402         * testsuite/Makefile.in: Regenerate.
1403         * testsuite/merge_string_literals_1.c: New file.
1404         * testsuite/merge_string_literals_2.c: Ditto.
1405         * testsuite/merge_string_literals.sh: Ditto.
1406
1407 2013-04-26  Ian Lance Taylor  <iant@google.com>
1408
1409         * target-reloc.h (relocate_section): If the reloc offset is out of
1410         range, pass VIEW as NULL to relocate.relocate.
1411         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1412         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1413         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1414         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1415         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1416         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1417
1418 2013-04-26  Geoff Pike  <gpike@chromium.org>
1419
1420         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1421         * layout.cc (Hash_task): New class.
1422         (Layout::queue_build_id_tasks): New function.
1423         (Layout::write_build_id): Handle single-thread portion of build ID
1424         computation.  (In some cases, all of it is single-threaded.)  Replace
1425         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1426         functionality in fewer lines of code.
1427         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1428         * options.h (General_options): make "--build-id" default to tree
1429         rather than sha1.  Add two new options related to --build-id=tree:
1430         --build-id-chunk-size-for-treehash and
1431         --build-id-min-file-size-for-treehash.
1432         * Makefile.am: add testing of --build-id=tree and related new options
1433         (these tests will be invoked by "make check").
1434         * Makefile.in: Regenerate.
1435
1436 2013-04-25  Alan Modra  <amodra@gmail.com>
1437
1438         * configure.tgt: Add powerpcle and powerpc64le.
1439
1440 2013-04-22  Alan Modra  <amodra@gmail.com>
1441
1442         PR gold/15355
1443         * layout.cc (Layout::segment_precedes): Allow more than one
1444         segment with the same type and flags.
1445
1446 2013-04-15  Cary Coutant  <ccoutant@google.com>
1447
1448         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1449         allocate space in file for BSS sections.
1450
1451 2013-04-15  Cary Coutant  <ccoutant@google.com>
1452
1453         * script-sections.cc (Orphan_output_section): Reset address
1454         to zero after each orphaned section for relocatable links.
1455
1456 2013-04-15  Cary Coutant  <ccoutant@google.com>
1457
1458         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1459         section starting address for relocatable link.
1460         * testsuite/Makefile.am (script_test_11): New test.
1461         * testsuite/Makefile.in: Regenerate.
1462         * testsuite/script_test_11.c: New source file.
1463         * testsuite/script_test_11.t: New linker script.
1464
1465 2013-04-13  Alan Modra  <amodra@gmail.com>
1466
1467         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1468         owner when sections are not adjacent and exceed group size.
1469         (Target_powerpc::group_sections): Handle corner case.
1470         (Target_powerpc::Branch_info::make_stub): Handle case where
1471         stub table doesn't exist due to branches in non-exec sections.
1472         (Target_powerpc::Relocate::relocate): Likewise.
1473
1474 2013-04-11  Alan Modra  <amodra@gmail.com>
1475
1476         PR gold/15354
1477         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1478         .branch_lt to match bfd ld.  Adjust comments throughout file.
1479
1480 2013-04-04  Ian Lance Taylor  <iant@google.com>
1481
1482         GCC PR c++/56840
1483         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1484         sections before checking whether they are included in the link.
1485
1486 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1487
1488         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1489         object before calling the plugin claim_file handler.  Pass the elf
1490         object of the archive to the plugin. Delete the elf object if the
1491         plugin claims the file.
1492
1493 2013-03-21  Alan Modra  <amodra@gmail.com>
1494
1495         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1496         segment when omagic.
1497
1498 2013-03-21  Alan Modra  <amodra@gmail.com>
1499
1500         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1501         comparison warning.
1502         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1503         uninitialized" warning.
1504
1505 2013-03-20  Alan Modra  <amodra@gmail.com>
1506
1507         * symtab.h (Symbol::clear_version): New function.
1508         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1509         is_needed by weak references.  Clear version for symbols defined
1510         in as-needed objects that are not needed.
1511
1512 2013-03-15  Alan Modra  <amodra@gmail.com>
1513
1514         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1515         static and public.  Add report_err param.  Return false for data refs.
1516         (Target_powerpc::rela_dyn_section): New overloaded function.
1517         (Target_powerpc::plt_, iplt_): Elucidate.
1518         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1519         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1520         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1521         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1522         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1523         push_branch and make_plt_entry for ifunc syms when
1524         reloc_needs_plt_for_ifunc.
1525         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1526         for ifunc unless reloc_needs_plt_for_ifunc.
1527
1528 2013-03-15  Alan Modra  <amodra@gmail.com>
1529
1530         * gc.h (gc_process_relocs): Don't look through function descriptors.
1531         * icf.cc (get_section_contents): Do so here instead.
1532
1533 2013-03-13  Alan Modra  <amodra@gmail.com>
1534
1535         * powerpc.cc (is_branch_reloc): Forward declare.
1536         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1537         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1538         false for 64-bit, true for 32-bit non-branch relocs.
1539         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1540         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1541         nm output.
1542         (icf_safe_test): Generate linker map file as well as nm output.
1543         (icf_safe_so_test): Likewise.
1544         * testsuite/Makefile.in: Regenerate.
1545         * testsuite/icf_test.sh: Parse linker map file to determine
1546         section folding.
1547         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1548         * testsuite/icf_safe_so_test.sh: Likewise.
1549         (X86_32_or_ARM_specific_safe_fold): Merge into..
1550         (arch_specific_safe_fold): ..this.
1551         (X86_64_specific_safe_fold): Delete unused function.
1552
1553 2013-03-12  Alan Modra  <amodra@gmail.com>
1554
1555         * gc.h (gc_process_relocs): Look through function descriptors
1556         to determine shndx, symvalue and addend used by ICF.  Tidy
1557         variable duplication.
1558
1559 2013-03-11  Alan Modra  <amodra@gmail.com>
1560
1561         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1562         * layout.cc (Layout_task_runner::run): ..to here.
1563         * symtab.h (struct Symbol_location): Extract from..
1564         (class Symbol_table): ..here.
1565         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1566         * target.h (class Target): Add function_location and
1567         do_function_location functions.
1568         (class Sized_target): Add do_function_location.
1569         * object.h (class Sized_relobj_file): Move find_shdr..
1570         (class Object): ..to here.
1571         * object.cc: Likewise.  Update to suit.  Instantiate.
1572         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1573         * powerpc.cc (class Powerpc_dynobj): New.
1574         (Target_powerpc::do_function_location): New function.
1575         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1576         (Powerpc_dynobj::do_read_symbols): New function.
1577         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1578
1579 2013-03-08  Ian Lance Taylor  <iant@google.com>
1580
1581         * options.cc (General_options::string_to_object_format): Accept
1582         "default".
1583
1584 2013-03-08  Alan Modra  <amodra@gmail.com>
1585
1586         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1587         pointer to Post_fde.
1588         (struct Post_fde): Move definition to here..
1589         * ehframe.cc (struct Post_fde): ..from here.
1590         (Cie::write): Don't alloc Post_fde.
1591         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1592
1593 2013-03-07  Alan Modra  <amodra@gmail.com>
1594
1595         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1596         relocation referencing .LC0.
1597         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1598
1599 2013-03-07  Alan Modra  <amodra@gmail.com>
1600
1601         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1602         always_inline.  Add assembly for powerpc to avoid GOT.
1603
1604 2013-03-07  Alan Modra  <amodra@gmail.com>
1605
1606         * testsuite/script_test_10.sh: Don't test .bss section
1607         header number.
1608
1609 2013-03-06  Alan Modra  <amodra@gmail.com>
1610
1611         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1612         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1613         all callers.  Handle folded sections.
1614         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1615         to Powerpc_relobj.
1616         (Global_symbol_visitor_opd::operator()): Likewise.
1617
1618 2013-03-04  Alan Modra  <amodra@gmail.com>
1619
1620         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1621         * testsuite/Makefile.in: Regenerate.
1622
1623 2013-03-01  Cary Coutant  <ccoutant@google.com>
1624
1625         Add dwp support for v2 DWARF package file format.
1626         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1627         tu_length parameter.  Adjust all callers.
1628         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1629         * dwp.cc: Include dwarf.h.
1630         (Section_bounds): New struct type.
1631         (Unit_set): New struct type.
1632         (Dwo_file::Dwo_file): Initialize new data member.
1633         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1634         Combine and rename to...
1635         (Dwo_file::read_unit_index): ...this.
1636         (Dwo_file::sized_read_compunit_index)
1637         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1638         (Dwo_file::sized_read_unit_index): ...this.
1639         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1640         parameters; add section_id parameter.
1641         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1642         (Dwo_file::add_unit_set): ...this.
1643         (Dwo_file::shndx_map_): Remove.
1644         (Dwo_file::sect_offsets_): New data member.
1645         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1646         (Dwp_output_file::add_section): Rename to...
1647         (Dwp_output_file::add_contribution): ...this.
1648         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1649         (Dwp_output_file::add_tu_set): Likewise.
1650         (Dwp_output_file::Contribution): New type.
1651         (Dwp_output_file::Section::contributions): New data member.
1652         (Dwp_output_file::Cu_or_tu_set): Remove.
1653         (Dwp_output_file::Section::Section): New ctor.
1654         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1655         (Dwp_output_file::Dwp_index::Section_table): New type.
1656         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1657         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1658         parameter.
1659         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1660         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1661         (Dwp_output_file::Dwp_index::section_table): New member function.
1662         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1663         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1664         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1665         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1666         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1667         (Dwp_output_file::Dwp_index::section_table_): New data member.
1668         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1669         (Dwp_output_file::add_output_section): New member function.
1670         (Dwp_output_file::write_new_section): New member function.
1671         (Dwp_output_file::write_contributions): New member function.
1672         (Dwp_output_file::section_id_map_): New data member.
1673         (class Dwo_id_info_reader): Remove.
1674         (class Unit_reader): New class.
1675         (get_dwarf_section_name): New function.
1676         (Dwo_file::read_executable): Adjust initializations of class data.
1677         (Dwo_file::read): Add support for v2 package file format.
1678         (Dwo_file::read_unit_index): Likewise.
1679         (Dwo_file::sized_read_unit_index): Likewise.
1680         (Dwo_file::copy_section): Likewise.
1681         (Dwo_file::add_unit_set): Likewise.
1682         (Dwp_output_file::add_output_section): Likewise.
1683         (Dwp_output_file::add_contribution): Likewise.
1684         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1685         for empty slot.
1686         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1687         file format.
1688         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1689         slot.
1690         (Dwp_output_file::initialize): Remove unused function.
1691         (Dwp_output_file::finalize): Add support for v2 package file format.
1692         (Dwp_output_file::write_index): Likewise.
1693         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1694         function prototype.
1695
1696 2013-03-01  Cary Coutant  <ccoutant@google.com>
1697
1698         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1699         function into class definition in header file.
1700         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1701         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1702         New function.
1703         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1704
1705 2013-02-28  Alan Modra  <amodra@gmail.com>
1706
1707         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1708         * target.cc (Target::do_plt_fde_location): New function.
1709         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1710         accessor function, and constructor param.
1711         (struct Post_fde, Post_fdes): Declare.
1712         (Cie::write): Add post_fdes param.
1713         * ehframe.cc (Fde::write): Use plt_fde_location.
1714         (struct Post_fde): Define.
1715         (Cie::write): Stash FDEs added post merge mapping.
1716         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1717         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1718         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1719         other FDEs.
1720         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1721         (Target_powerpc::has_glink): New function.
1722         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1723         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1724         glink_eh_frame_fde_32, default_fde): New data.
1725         (Stub_table::eh_frame_added_): New var.
1726         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1727         Make const.
1728         (Stub_table::add_eh_frame): New function.
1729         (Output_data_glink::add_eh_frame): New function.
1730         (Target_powerpc::make_glink_section): Call add_eh_frame.
1731
1732 2013-02-15  Ian Lance Taylor  <iant@google.com>
1733
1734         * options.h (DEFINE_uint64_alias): Define.
1735         (class General_options): Add -Ttext-segment as an alias for
1736         -Ttext.
1737
1738 2013-02-15  Alan Modra  <amodra@gmail.com>
1739
1740         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1741         (Stub_table::do_write): ..here, two places.
1742         (Stub_table::plt_call_size): Use it here too.
1743
1744 2013-02-11  Ian Lance Taylor  <iant@google.com>
1745
1746         * descriptors.cc (Descriptors::close_all): New function.
1747         * descriptors.h (class Descriptors): Declare close_all.
1748         (close_all_descriptors): New inline function.
1749         * plugin.cc: Include "descriptors.h".
1750         (Plugin_manager::cleanup): Call close_all_descriptors.
1751
1752 2013-02-06  Alan Modra  <amodra@gmail.com>
1753
1754         * README: Update coding style link.
1755
1756 2013-01-28  Cary Coutant  <ccoutant@google.com>
1757
1758         * dwp.cc (File_list): New typedef.
1759         (Dwo_name_info_reader): New class.
1760         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1761         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1762         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1763         (Dwo_file::read_executable): New function.
1764         (Dwo_file::read): Move common setup code to ...
1765         (Dwo_file::make_object): ... here.
1766         (dwp_options): Add --exec/-e.
1767         (usage): Likewise.
1768         (main): Likewise.
1769
1770 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1771
1772         * layout.cc (Layout::layout): Check for option text_reorder.
1773         (Layout::make_output_section): Ditto.
1774         * options.h (text_reorder): New option.
1775         * output.cc (Input_section_sort_compare): Remove special ordering
1776         of section names.
1777         (Output_section::
1778          Input_section_sort_section_name_special_ordering_compare::
1779          operator()): New function.
1780         (Output_section::sort_attached_input_sections): Use new sort function
1781         for .text.
1782         * output.h (Input_section_sort_section_name_special_ordering_compare):
1783         New struct.
1784         * testsuite/Makefile.am (text_section_grouping): Test option
1785         --no-text-reorder
1786         * testsuite/Makefile.in: Regenerate.
1787         * testsuite/text_section_grouping.sh: Check order of functions without
1788         default text reordering.
1789
1790 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1791
1792         * options.h (General_options): Change default to true for new_dtags.
1793
1794 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1795
1796         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1797         when enable_new_dtags is false.  Only add DT_RUNPATH when
1798         enable_new_dtags is true.
1799
1800 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1801
1802         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1803         used in declaration and definition consistent.
1804         (Target_powerpc::symval_for_branch): Ditto.
1805
1806 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1807
1808         * testsuite/plugin_final_layout.cc: Fix comment.
1809
1810 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1811
1812         * layout.cc (Layout::layout): Do not do default sorting for
1813         text sections when section ordering is specified.
1814         (make_output_section): Ditto.
1815         * testsuite/plugin_final_layout.cc: Name the function sections
1816         to catch reordering issues.
1817
1818 2013-01-15  Alan Modra  <amodra@gmail.com>
1819
1820         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1821         plt-thread-safe.
1822
1823 2013-01-15  Alan Modra  <amodra@gmail.com>
1824
1825         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1826         * testsuite/Makefile.in: Regenerate.
1827
1828 2013-01-14  Alan Modra  <amodra@gmail.com>
1829
1830         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1831         * testsuite/Makefile.in: Regenerate.
1832
1833 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1834
1835         PR bfd/14430
1836         Fix mingw gold build with plugins enabled
1837         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1838         * configure.ac: Export DLOPEN_LIBS and add headers check.
1839         * plugin.cc: Handle non-dlfcn case.
1840         * Makefile.in: Regenerate.
1841         * config.in: Regenerate.
1842         * configure: Regenerate.
1843         * testsuite/Makefile.in: Regenerate.
1844
1845 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1846
1847         * output.h (sort_attached_input_sections): Change to be public.
1848         * script-sections.cc
1849         (Output_section_definition::set_section_addresses): Sort
1850         attached input sections according to section order before linker
1851         script assigns section addresses.
1852         (Orphan_output_section::set_section_addresses): Sort
1853         attached input sections according to section order before linker
1854         script assigns section addresses.
1855         * Makefile.am (final_layout.sh): Use a simple linker script to
1856         check if section ordering still works.
1857         * Makefile.in: Regenerate.
1858
1859 2013-01-09  Ben Cheng  <bccheng@google.com>
1860
1861         * arm.cc (Target_arm::attributes_accept_div): New function.
1862         (Target_arm::attributes_forbid_div): New function.
1863         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1864         attribute using the same new functions as what bfd/elf32_arm.c
1865         does.
1866
1867 2013-01-07  Cary Coutant  <ccoutant@google.com>
1868
1869         PR gold/14993
1870         * output.cc (Output_section::add_input_section): For incremental
1871         updates, don't track input sections that are allocated from patch
1872         space.
1873
1874 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1875             Ian Lance Taylor  <iant@google.com>
1876
1877         PR gold/14897
1878         * configure.ac (--enable-ld): Removed.
1879         (install_as_default): Set to yes only for --enable-gold=default
1880         or --disable-ld.
1881         * configure: Regenerated.
1882
1883 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1884
1885         * options.h (General_options): Add -fuse-ld= for GCC linker
1886         option compatibility.
1887
1888 2013-01-04  Cary Coutant  <ccoutant@google.com>
1889
1890         * configure.ac: Fix typo restoring CXXFLAGS.
1891         * configure: Regenerate.
1892
1893 2013-01-04  Cary Coutant  <ccoutant@google.com>
1894
1895         * testsuite/Makefile.am (CXXLINK_S): New macro.
1896         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1897         * testsuite/Makefile.in: Regenerate.
1898
1899 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1900
1901         * version.cc (print_version): Update copyright year to 2013.
1902
1903 2012-12-20  Ian Lance Taylor  <iant@google.com>
1904
1905         * layout.cc (Layout::special_ordering_of_input_section): New
1906         function.
1907         (Layout::layout): If input section requires special ordering, must
1908         sort input sections.
1909         (Layout::make_output_section): May sort .text input sections.
1910         (Layout::is_section_name_prefix_grouped): Remove.
1911         * layout.h (class Layout): Declare
1912         special_ordering_of_input_section.  Don't declare
1913         is_section_name_prefix_grouped.
1914         * output.cc (Output_section::add_input_section): Revert last
1915         change.
1916         (Output_section::Input_section_sort::match_file_name): Don't crash
1917         if called on output section data.
1918         (Output_section::Input_section_sort_compare): Sort based on
1919         special ordering.
1920         (Output_section::Input_section_sort_section_order_index_compare):
1921         Revert last patch.
1922         (Output_section::sort_attached_input_sections): Likewise.
1923
1924 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1925
1926         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1927         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1928         * output.cc (Output_section::add_input_section): Check if section
1929         name contains special prefix.  Keep input sections to sort such
1930         sections.
1931         (Output_section::Input_section_sort_section_order_index_compare
1932          ::operator()): Group sections according to prefixes.
1933         (Output_section::sort_attached_input_sections): Add condition to
1934         Input_section_entry constructor call.
1935         * testsuite/Makefile.am (text_section_grouping): New test.
1936         * testsuite/Makefile.in: Regenerate.
1937         * testsuite/text_section_grouping.cc: New file.
1938         * testsuite/text_section_grouping.sh: New file.
1939
1940 2012-12-17  Nick Clifton  <nickc@redhat.com>
1941
1942         * Makefile.am: Add copyright notice.
1943         * NEWS: Likewise.
1944         * README: Likewise.
1945         * configure.ac: Likewise.
1946         * ftruncate.c: Likewise.
1947         * Makefile.in: Regenerate.
1948
1949 2012-12-14  Cary Coutant  <ccoutant@google.com>
1950
1951         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1952         --no-as-needed flag.
1953         (exception_separate_shared_12_test): Likewise.
1954         (incremental_copy_test): Likewise.
1955         * testsuite/Makefile.in: Regenerate.
1956
1957 2012-12-14  Cary Coutant  <ccoutant@google.com>
1958
1959         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1960         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1961
1962 2012-12-12  Alan Modra  <amodra@gmail.com>
1963
1964         * powerpc.cc (class Track_tls): New.
1965         (class Relocate, class Scan): Inherit Track_tls.
1966         (Target_powerpc::Scan::local, global): Track tls optimization
1967         and avoid creating plt entry for __tls_get_addr if all uses
1968         are optimized away.
1969         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1970
1971 2012-12-12  Alan Modra  <amodra@gmail.com>
1972
1973         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1974         Replace no_toc_optimize with toc_optimize.
1975         * output.h (Output_section::input_sections): Provide non-const variant.
1976         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1977         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1978         accessors.
1979         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1980         (class Sort_toc_sections): New.
1981         (Target_powerpc::do_finalize_sections): Sort toc sections.
1982         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1983
1984 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1985
1986         * testsuite/binary_unittest.cc (read_all): New function.
1987         (Sized_binary_test): Use it instead of ::read.
1988         * fileread.cc (do_read): Don't assume pread always reads the whole
1989         amount in a single call.
1990
1991 2012-12-10  Alan Modra  <amodra@gmail.com>
1992
1993         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1994         Set EM_PPC64 or EM_PPC here.
1995         (Target_selector_powerpc::do_recognize): Delete.
1996
1997 2012-12-10  Alan Modra  <amodra@gmail.com>
1998
1999         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2000         stub_table_.
2001         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2002
2003 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2004
2005         * testsuite/binary_unittest.cc (Sized_binary_test):
2006         Use open_descriptor rather than ::open.
2007
2008 2012-12-07  Alan Modra  <amodra@gmail.com>
2009
2010         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2011         typedef and invalid_address constant.
2012         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2013         instantiate constants.
2014
2015 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2016
2017         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2018         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2019         * aclocal.m4: Regenerate.
2020         * configure: Regenerate.
2021         * Makefile.in: Regenerate.
2022         * testsuite/Makefile.in: Regenerate.
2023
2024 2012-12-07  Alan Modra  <amodra@gmail.com>
2025
2026         * options.h (General_options): Add no_toc_optimize.
2027         * powerpc.cc (ok_lo_toc_insn): New function.
2028         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2029
2030 2012-12-06  Alan Modra  <amodra@gmail.com>
2031
2032         * options.h (General_options): Add plt_align, plt_static_chain,
2033         plt_thread_safe.  Update stub_group_size help text.
2034         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2035         for new plt_thread_safe_ var.
2036         (use_plt_offset): Correct comments.
2037         (Target_powerpc::do_relax): Look for thread creation symbols to
2038         determine default plt_thread_safe value.  Clear plt call stubs
2039         as well as branch stubs each iteration.
2040         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2041         insn constants.
2042         (l, hi, ha, write_insn): Move earlier.
2043         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2044         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2045         plt stubs too.
2046         (Stub_table::update_size): Adjust.
2047         (Stub_table::prev_size, set_prev_size): Delete.
2048         (Stub_table::stub_align): Let --plt-align affect result.
2049         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2050         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2051         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2052         (Stub_table::do_write): Support more stub variants.
2053
2054 2012-12-04  Alan Modra  <amodra@gmail.com>
2055
2056         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2057         (Target_powerpc::do_define_standard_symbols): New function.
2058
2059 2012-12-03  Alan Modra  <amodra@gmail.com>
2060
2061         * output.h: Formatting, whitespace.
2062
2063 2012-12-03  Alan Modra  <amodra@gmail.com>
2064
2065         * layout.h (Layout::get_executable_sections): Declare.
2066         * layout.cc (Layout::get_executable_sections): New function.
2067         * arm.cc (Target_arm::group_sections): Use it.
2068         (Arm_output_section::group_sections): Delete now redundant test.
2069         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2070         param to handle relative relocs.
2071         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2072         (Output_data_reloc::add_absolute): Adjust.
2073         (Output_data_reloc::add_relative): New function.
2074         (Output_data::reset_data_size): New function.
2075         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2076         (Output_section::set_addralign): New function.
2077         (Output_section::checkpoint_set_addralign): New function.
2078         (Output_section::clear_section_offsets_need_adjustment): New function.
2079         (Output_section::input_sections): Make public.
2080         * powerpc.cc (class Output_data_brlt_powerpc): New.
2081         (class Stub_table, class Stub_control): New.
2082         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2083         stub_table_, set_stub_table, stub_table): New vectors and accessor
2084         functions.
2085         (Target_powerpc::do_may_relax, do_relax, push_branch,
2086         new_stub_table, stub_tables, brlt_section, group_sections,
2087         add_branch_lookup_table, find_branch_lookup_table,
2088         write_branch_lookup_table, make_brlt_section): New functions.
2089         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2090         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2091         branch_info_): New vars.
2092         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2093         make call stubs here.
2094         (Output_data_glink): Remove all call stub handling from this class.
2095         (Target_powerpc::Scan::local, global): Save interesting branch
2096         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2097         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2098         functions on final link.
2099         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2100         Handle long branch destinations too.
2101         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2102         do_plt_address_for_local): Adjust lookup of plt call stubs.
2103
2104 2012-11-30  Alan Modra  <amodra@gmail.com>
2105
2106         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2107         relocs against protected symbols when building 32-bit shared libs.
2108
2109 2012-11-30  Alan Modra  <amodra@gmail.com>
2110
2111         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2112         param.  Call got_section() to make .got.  Update all callers
2113         and their callers and so on.
2114
2115 2012-11-30  Alan Modra  <amodra@gmail.com>
2116
2117         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2118         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2119         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2120         value if it already exists.
2121
2122 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2123
2124         PR gold/14858
2125         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2126
2127 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2128
2129         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2130         than bfc instruction for data sandboxing.
2131
2132 2012-11-08  Alan Modra  <amodra@gmail.com>
2133
2134         * po/POTFILES.in: Regenerate.
2135
2136 2012-11-05  Alan Modra  <amodra@gmail.com>
2137
2138         * configure.ac: Apply 2012-09-10 change to config.in here.
2139         * configure: Regenerate.
2140
2141 2012-11-05  Alan Modra  <amodra@gmail.com>
2142
2143         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2144         (struct Opd_ent): Use "Address" rather than "Offset".
2145         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2146         (Target_powerpc::got_section): Make public.
2147         (Target_powerpc::scan_relocs): Move code setting symbols..
2148         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2149         Create _SDA_BASE_ only when referenced.
2150
2151 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2152
2153         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2154         from last change.
2155
2156 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2157
2158         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2159         for offset_in_output_section parameter.
2160         (Sized_target::relocate_special_relocatable): Likewise.
2161         * arm.cc (Target_arm::relocate_relocs): Likewise.
2162         (Target_arm::relocate_special_relocatable): Likewise.
2163         * i386.cc (Target_i386::relocate_relocs): Likewise.
2164         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2165         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2166         * target-reloc.h (relocate_relocs): Likewise.
2167         * testsuite/testfile.cc (Target_test): Likewise.
2168         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2169         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2170
2171         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2172         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2173
2174         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2175         parameter, which is unused in the [!F_SETFD] case.
2176
2177         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2178         SYMNDX to off_t before comparing it to this->data_size().
2179         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2180         * incremental.cc (Output_section_incremental_inputs::do_write):
2181         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2182
2183         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2184
2185 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2186
2187         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2188         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2189         in EABI_VER5.
2190
2191 2012-10-29  Cary Coutant  <ccoutant@google.com>
2192
2193         * dwp.cc (usage): Add file and exit status parameters;
2194         add --help and --version options.
2195         (print_version): New function.
2196         (main): Add --help and --version options.
2197
2198 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2199
2200         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2201         final_layout_sequence.txt.
2202         * testsuite/Makefile.in: Regenerated.
2203
2204 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2205
2206         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2207         COMPILE generated by automake.
2208         (LINK1): Likewise.
2209         (CXXCOMPILE1): Likewise.
2210         (CXXLINK1): Likewise.
2211         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2212         (LINK): Likewise.
2213         (CXXCOMPILE): Likewise.
2214         (CXXLINK): Likewise.
2215         * testsuite/Makefile.in: Regenerated.
2216
2217 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2218
2219         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2220         on bad fwrite return.
2221
2222 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2223
2224         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2225         on val.
2226
2227 2012-10-23  Cary Coutant  <ccoutant@google.com>
2228
2229         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2230         * testsuite/Makefile.in: Regenerate.
2231         * testsuite/dwp_test.h: New source file.
2232         * testsuite/dwp_test_1.cc: New source file.
2233         * testsuite/dwp_test_1.s: New source file.
2234         * testsuite/dwp_test_1.sh: New source file.
2235         * testsuite/dwp_test_1b.cc: New source file.
2236         * testsuite/dwp_test_1b.s: New source file.
2237         * testsuite/dwp_test_2.cc: New source file.
2238         * testsuite/dwp_test_2.s: New source file.
2239         * testsuite/dwp_test_2.sh: New source file.
2240         * testsuite/dwp_test_main.cc: New source file.
2241         * testsuite/dwp_test_main.s: New source file.
2242
2243 2012-10-23  Cary Coutant  <ccoutant@google.com>
2244
2245         * dwp.h: New header file.
2246         * dwp.cc: New source file.
2247         * gold.h: Move shared declarations to system.h.
2248         * system.h: New header file.
2249         * Makefile.am: Add dwp.
2250         * Makefile.in: Regenerate.
2251
2252 2012-10-23  Cary Coutant  <ccoutant@google.com>
2253
2254         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2255         Dwarf_info_reader::read_from_pointer.
2256         (Dwarf_pubnames_table::read_header): Likewise.
2257         (Dwarf_pubnames_table::next_name): Likewise.
2258         (Dwarf_die::read_attributes): Likewise.
2259         (Dwarf_die::skip_attributes): Likewise.
2260         (Dwarf_info_reader::read_from_pointer): New function template.
2261         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2262         (Dwarf_pubnames_table): Likewise.
2263         (Dwarf_info_reader::read_from_pointer): New function template.
2264         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2265         Dwarf_pubnames_table ctor.
2266
2267 2012-10-23  Cary Coutant  <ccoutant@google.com>
2268
2269         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2270         abbrev_shndx.
2271         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2272         abbrev_shndx_.
2273         (Dwarf_info_reader::set_abbrev_shndx): New method.
2274         (Dwarf_info_reader::abbrev_shndx_): New data member.
2275
2276 2012-10-23  Cary Coutant  <ccoutant@google.com>
2277
2278         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2279         from object, not parameters.
2280         (Dwarf_info_reader::parse): Likewise.
2281         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2282         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2283         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2284         methods.
2285
2286 2012-10-23  Cary Coutant  <ccoutant@google.com>
2287
2288         * fileread.cc (Input_file::Input_file): New constructor.
2289         * fileread.h (class Input_file): Add new constructor.
2290
2291 2012-10-18  Alan Modra  <amodra@gmail.com>
2292
2293         PR gold/14727
2294         * object.cc (Relobj::is_section_name_included): Also match
2295         .sdata personality section.
2296
2297 2012-10-18  Alan Modra  <amodra@gmail.com>
2298
2299         * target-reloc.h (class Default_comdat_behavior): New, package up..
2300         (get_comdat_behaviour): ..this.
2301         (relocate_section): Add Relocate_comdat_behavior template arg,
2302         adjust code to suit.
2303         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2304         (Target_arm::scan_reloc_section): Likewise.
2305         * i386.cc (Target_i386::relocate_section): Likewise.
2306         * sparc.cc (Target_sparc::relocate_section): Likewise.
2307         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2308         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2309         * powerpc.cc (class Relocate_comdat_behavior): New.
2310         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2311         gold::relocate_section with new template arg.
2312
2313 2012-10-18  Alan Modra  <amodra@gmail.com>
2314
2315         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2316         dynamic relocs for GOT_TPREL got entries, without symbol if
2317         resolving locally.
2318         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2319         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2320         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2321
2322 2012-10-17  Alan Modra  <amodra@gmail.com>
2323
2324         PR gold/14726
2325         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2326
2327 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2328
2329         * layout.cc (Layout::include_section): Keep sections marked
2330         SHF_EXCLUDE when doing relocatable links.
2331
2332 2012-10-16  Alan Modra  <amodra@gmail.com>
2333
2334         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2335         (Target_powerpc::do_finalize_sections): Call it.
2336         (Output_data_save_res): New class and supporting functions.
2337         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2338         normal symbols defined in object files.
2339
2340 2012-10-12  Alan Modra  <amodra@gmail.com>
2341
2342         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2343         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2344         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2345         section if scan_opd_relocs not yet called.
2346         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2347
2348 2012-10-12  Alan Modra  <amodra@gmail.com>
2349
2350         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2351         add_local_ifunc_entry): Revert last change.
2352         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2353
2354 2012-10-05  Alan Modra  <amodra@gmail.com>
2355
2356         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2357         do_plt_address_for_global): New functions.
2358         (Output_data_got_powerpc::do_write): Don't segfault when linking
2359         statically.
2360         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2361         add_local_ifunc_entry): Return true on adding entry..
2362         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2363         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2364         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2365         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2366         set up symbols here.
2367         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2368         syms here.  Do so even when no .iplt.  Don't segfault when linking
2369         statically.
2370         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2371         new variants without reloc param.
2372         (Glink_sym_ent::Glink_sym_ent): Likewise.
2373         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2374         reloc when refs will resolve to plt call stub.
2375         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2376         R_PPC_PLTREL24 to resolve locally.
2377         (Target_powerpc::Scan::global): Correct ifunc handling.
2378         (Target_powerpc::Relocate::relocate): Correct local sym glink
2379         lookup.  Don't destroy "value" when we have a plt call stub,
2380         and when checking plt call validity.
2381         (Target_powerpc::do_dynsym_value): Simplify.
2382
2383 2012-10-05  Alan Modra  <amodra@gmail.com>
2384
2385         * i386.cc (Output_data_plt_i386::address_for_global,
2386         address_for_local): Add plt offset to returned value.  Adjust uses.
2387         * sparc.cc (Output_data_plt_sparc::address_for_global,
2388         address_for_local): Likewise.
2389         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2390         address_for_local): Likewise.
2391         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2392         address_for_local): Likewise.
2393         * target.h (Target::plt_address_for_global, plt_address_for_local):
2394         Update comment.
2395         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2396         (Output_data_got::Got_entry::write): Nor here.
2397         * output.h: Comment fix.
2398
2399 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2400
2401         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2402         global_offset_table_ value for larget got.
2403         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2404
2405 2012-09-29  Alan Modra  <amodra@gmail.com>
2406
2407         * powerpc.cc (Target_powerpc::iplt_): New output section.
2408         (Target_powerpc::iplt_section, make_iplt_section,
2409         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2410         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2411         Target_powerpc::plt_entry_count): Count iplt entries too.
2412         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2413         reloc section in constructor.  New params.
2414         (Target_powerpc::make_plt_section): Create reloc section here instead.
2415         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2416         functions.
2417         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2418         (Output_data_glink::add_entry, find_entry): New functions to
2419         deal with local syms.
2420         (Glink_sym_ent): Add support for local syms.
2421         (Output_data_glink::do_write): Handle ifunc plt entries.
2422         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2423         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2424         (Target_powerpc::Relocate::relocate): Likewise.
2425         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2426
2427 2012-09-25  Alan Modra  <amodra@gmail.com>
2428
2429         * object.h (Sized_relobj_file::adjust_local_symbol,
2430         do_adjust_local_symbol): New functions.
2431         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2432         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2433         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2434         and irregular opd entry spacing.
2435         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2436         (Global_symbol_visitor_opd): New functor.
2437         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2438         on deleted opd entries.
2439
2440 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2441
2442         * tilegx.cc: New file.
2443         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2444         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2445         * configure.tgt: Add entries for tilegx*.
2446         * configure.ac: Likewise.
2447         * Makefile.in: Rebuild.
2448         * configure: Likewise.
2449         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2450         tilegx.
2451
2452 2012-09-13  Alan Modra  <amodra@gmail.com>
2453
2454         * target-reloc.h (scan_relocs): Call scan.local for relocs
2455         against symbols in discarded sections.  Pass is_discarded
2456         param.
2457         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2458         Add is_discarded param.
2459         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2460         is_discarded to flag opd entry as discarded.  Don't emit dyn
2461         relocs on such entries.
2462         (Target_powerpc::Scan::global): Similarly detect and handle
2463         such opd entries.
2464         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2465         opd_ent_.  Update all uses.
2466         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2467         (Target_powerpc::relocate_section): Zero out discarded opd
2468         entry relocs.
2469
2470 2012-09-12  Ian Lance Taylor  <iant@google.com>
2471
2472         PR gold/14570
2473         * output.cc: Rename Output_data_got template parameter from size
2474         to got_size for all functions.  Compile all variants of
2475         Output_data_got.
2476         (Output_data_got::Got_entry::write): Correct use of size for
2477         symbol value.  Use local_is_tls rather than casting to
2478         Sized_relobj_file.
2479         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2480         (class Sized_relobj_file): Add do_local_is_tls.
2481         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2482
2483 2012-09-11  Alan Modra  <amodra@gmail.com>
2484
2485         PR gold/14566
2486         * layout.cc (Layout::set_segment_offsets): When using
2487         common-page-size alignment, ensure we are on a new max-page-size
2488         page.
2489         * output.cc (Output_segment::set_section_addresses): Use
2490         abi_pagesize, not common_pagesize for relro boundary.
2491         (Output_segment::set_offset): Likewise.
2492
2493 2012-09-11  Alan Modra  <amodra@gmail.com>
2494
2495         * output.h (Output_data_got::add_global_tls, add_local_tls,
2496         add_local_tls_pair): New functions.
2497         (Output_data_got::add_local_pair_with_rel): Remove second
2498         reloc param.  Expand comment.
2499         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2500         use_plt_or_tls_offset_, similarly for constructor param.
2501         (Output_data_got::Got_entry::write): Add got_index param.
2502         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2503         add_local_tls_pair): New functions.
2504         (Output_data_got::Got_entry::write): Handle tls symbols
2505         with use_plt_or_tls_offset_ set specially.
2506         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2507         (Output_data_got::do_write): Replace iterator with index, pass
2508         index to entry write function.
2509         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2510         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2511         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2512         call.
2513         * i386.cc (Target_i386::Scan::local): Likewise.
2514         * sparc.cc (Target_sparc::Scan::local): Likewise.
2515         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2516         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2517         do_tls_offset_for_global): New functions.
2518         (Target_powerpc::Scan::local): Correct TLS relocations and got
2519         entry values.
2520         (Target_powerpc::Scan::global): Don't emit unnecessary
2521         dynamic relocations on TLS GOT entries.
2522
2523 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2524
2525         * config.in: Disable sanity check for kfreebsd.
2526
2527 2012-09-10  Sterling Augustine  <saugustine@google.com>
2528
2529         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2530         (Gdb_index::pubtypes_read): New parameter.
2531         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2532         to calls.
2533         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2534         pubtypes_object_.
2535
2536 2012-09-09  Alan Modra  <amodra@gmail.com>
2537
2538         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2539         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2540         * gc.h (gc_process_relocs): Call target gc_add_reference.
2541         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2542         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2543         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2544         unnecessary cast.
2545         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2546         to cater for when we don't need code offset.  Update use.
2547         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2548         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2549         set_opd_valid): New functions.
2550         (Target_powerpc::do_gc_add_reference): New function.
2551         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2552         stashed refs.
2553         (Target_powerpc::do_gc_mark_symbol): New function.
2554
2555 2012-09-06  Cary Coutant  <ccoutant@google.com>
2556
2557         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2558         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2559         (Dwarf_die::skip_attributes): Likewise.
2560         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2561         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2562         (main): Call it.
2563         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2564
2565 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2566
2567         * testsuite/script_test_3.t: Add .got.plt output section
2568         statement.
2569         * testsuite/script_test_4.t: Likewise.
2570
2571 2012-09-05  Alan Modra  <amodra@gmail.com>
2572
2573         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2574         update all uses and lose "enum" when using type.
2575
2576 2012-09-05  Alan Modra  <amodra@gmail.com>
2577
2578         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2579         * configure: Regenerate.
2580         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2581         (plugin_final_layout.stdout): Likewise.
2582         (memory_test): Set page sizes to 0x1000.
2583         * testsuite/Makefile.in: Regenerate.
2584         * testsuite/discard_locals_test.sh: Add FIXME comment.
2585         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2586         * testsuite/pr14265.t: Add .got output section statement.
2587         * testsuite/script_test_2.t: Likewise.
2588         * testsuite/script_test_3.t: Likewise.
2589         * testsuite/script_test_4.t: Likewise.
2590         * testsuite/script_test_5.t: Likewise.
2591         * testsuite/script_test_6.t: Likewise.
2592         * testsuite/script_test_7.t: Likewise.
2593         * testsuite/script_test_9.t: Likewise.
2594
2595 2012-09-05  Alan Modra  <amodra@gmail.com>
2596
2597         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2598         (Powerpc_relocate_functions::Status): New typedef.
2599         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2600         (Target_powerpc::Scan::local): Handle REL64.
2601         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2602         for REL32 and REL64.
2603         (Target_powerpc::symval_for_branch): New function, extracted from..
2604         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2605         checks.  Report overflow errors.
2606
2607 2012-09-05  Alan Modra  <amodra@gmail.com>
2608
2609         * object.h (Sized_relobj_file::emit_relocs): Delete.
2610         (Sized_relobj_file::emit_relocs_reltype): Delete.
2611         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2612         relocate_relocs for --emit-relocs.
2613         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2614         * output.h: Update comment.
2615         (Output_segment::first_section): New function.
2616         (Output_segment::first_section_load_address): Use first_section.
2617         * output.cc (Output_segment::first_section): New function extracted..
2618         (Output_segment::first_section_load_address): ..from here.  Delete.
2619         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2620         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2621         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2622         adjust call to target.h function.
2623         * i386.cc (Target_i386): Likewise.
2624         * sparc.cc (Target_sparc): Likewise.
2625         * x86_64.cc (Target_x86_64): Likewise.
2626         * powerpc.cc (Target_powerpc): Likewise.
2627         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2628         first tls section has section symbol for optimised local dynamic
2629         output relocs.
2630         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2631         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2632         optimised tls code.
2633         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2634         Rename to relocate_relocs.  Update error message.
2635
2636 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2637
2638         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2639         --just-symbols.
2640
2641 2012-08-31  Alan Modra  <amodra@gmail.com>
2642
2643         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2644         (Powerpc_relobj::toc_base_offset): New stub function.
2645         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2646         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2647         (Target_powerpc::Relocate::enum skip_tls): New.
2648         (Target_powerpc::call_tls_get_addr_): New var.
2649         (Target_powerpc::is_branch_reloc): Move to file scope.
2650         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2651         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2652         New functions.
2653         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2654         (powerpc_info): Correct common_pagesize for ppc64.
2655         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2656         (Powerpc_relocate_functions): Add overflow check enums and functions.
2657         Add non-shift version of rela, rela_ua.  Delete all rel public
2658         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2659         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2660         addr16_ha3, addr14 functions.
2661         (Output_data_got_powerpc::add_constant_pair): New function.
2662         (Output_data_got_powerpc::got_base_offset): Likewise.
2663         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2664         (instruction constants): Sort, add some more.
2665         (Output_data_glink::do_write): Add and use Address typedef.  Use
2666         object->toc_base_offset() stub for 64-bit.
2667         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2668         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2669         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2670         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2671         Always treat .opd relocs as against locally defined symbol.
2672         Correct condition for RELATIVE relocs.
2673         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2674         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2675         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2676         calculations.  Handle TLS relocs, and more.  Add overflow
2677         checking and adjust for Powerpc_relocate_functions changes.
2678         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2679         Reinstate --emit-relocs code with FIXME.
2680
2681 2012-08-30  Alan Modra  <amodra@gmail.com>
2682
2683         * layout.cc (Layout::set_segment_offsets): Set p_align to
2684         abi_pagesize, not common_pagesize.
2685         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2686         to determine whether file header can go in segment.
2687
2688 2012-08-30  Alan Modra  <amodra@gmail.com>
2689
2690         * output.h (Output_reloc::Output_reloc <output section>): Add
2691         is_relative param.  Adjust calls.
2692         (Output_reloc::add_output_section_relative): New functions.
2693         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2694         is_relative.
2695         (Output_reloc::symbol_value): Handle SECTION_CODE.
2696
2697 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2698
2699         * gold.cc (queue_middle_tasks): Call layout again when unique
2700         segments for sections is desired.
2701         * layout.cc (Layout::Layout): Initialize new members.
2702         (Layout::get_output_section_flags): New function.
2703         (Layout::choose_output_section): Call get_output_section_flags.
2704         (Layout::layout): Make output section for mapping to a unique segment.
2705         (Layout::insert_section_segment_map): New function.
2706         (Layout::attach_allocated_section_to_segment): Make unique segment for
2707         output sections marked so.
2708         (Layout::segment_precedes): Check for unique segments when sorting.
2709         * layout.h (Layout::Unique_segment_info): New struct.
2710         (Layout::Section_segment_map): New typedef.
2711         (Layout::insert_section_segment_map): New function.
2712         (Layout::get_output_section_flags): New function.
2713         (Layout::is_unique_segment_for_sections_specified): New function.
2714         (Layout::set_unique_segment_for_sections_specified): New function.
2715         (Layout::unique_segment_for_sections_specified_): New member.
2716         (Layout::section_segment_map_): New member.
2717         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2718         Rename is_gc_pass_one to is_pass_one.
2719         Rename is_gc_pass_two to is_pass_two.
2720         Rename is_gc_or_icf to is_two_pass.
2721         Check for which pass based on whether symbols data is present.
2722         Make it two pass when unique segments for sections is desired.
2723         * output.cc (Output_section::Output_section): Initialize new
2724         members.
2725         * output.h (Output_section::is_unique_segment): New function.
2726         (Output_section::set_is_unique_segment): New function.
2727         (Output_section::is_unique_segment_): New member.
2728         (Output_section::extra_segment_flags): New function.
2729         (Output_section::set_extra_segment_flags): New function.
2730         (Output_section::extra_segment_flags_): New member.
2731         (Output_section::segment_alignment): New function.
2732         (Output_section::set_segment_alignment): New function.
2733         (Output_section::segment_alignment_): New member.
2734         (Output_segment::Output_segment): Initialize is_unique_segment_.
2735         (Output_segment::is_unique_segment): New function.
2736         (Output_segment::set_is_unique_segment): New function.
2737         (Output_segment::is_unique_segment_): New member.
2738         * plugin.cc (allow_unique_segment_for_sections): New function.
2739         (unique_segment_for_sections): New function.
2740         (Plugin::load): Add new functions to transfer vector.
2741         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2742         * Makefile.in: Regenerate.
2743         * testsuite/plugin_final_layout.sh: Check if unique segment
2744         functionality works.
2745         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2746         are available.
2747         (allow_unique_segment_for_sections): New global.
2748         (unique_segment_for_sections): New global.
2749         (claim_file_hook): Call allow_unique_segment_for_sections.
2750         (all_symbols_read_hook): Call unique_segment_for_sections.
2751
2752 2012-08-22  Cary Coutant  <ccoutant@google.com>
2753
2754         * layout.cc (Layout::include_section): Don't assert on GROUP
2755         sections with --emit-relocs.
2756
2757 2012-08-21  Cary Coutant  <ccoutant@google.com>
2758
2759         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2760         if --export-dynamic-symbol names an undef symbol.
2761
2762 2012-08-18  Alan Modra  <amodra@gmail.com>
2763
2764         * powerpc.cc: Formatting and white space.
2765         (Powerpc_relobj): Rename got2_section_ to special_.
2766         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2767         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2768         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2769         (Target_powerpc): Add Address typedef and invalid_address.  Use
2770         throughout.
2771         (Target_powerpc::is_branch_reloc): New function.
2772         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2773         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2774         for dst_mask, value and addend.
2775         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2776         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2777         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2778         uint16_t for 24-bit offset.  Use get_output_section_offset and
2779         check return.
2780         (Target_powerpc::Scan::local): Handle more relocs.
2781         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2782         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2783         Plug in toc restoring insn after plt calls.  Translate branches
2784         to function descriptor symbols to corresponding entry point.
2785         (Target_powerpc::relocate_for_relocatable): Check return from
2786         get_output_section_offset.
2787         * symtab.h: Comment typo.
2788
2789 2012-08-14  Ian Lance Taylor  <iant@google.com>
2790
2791         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2792         unsupported_relocal_local to call unsupported_reloc_global.
2793
2794 2012-08-14  Nick Clifton  <nickc@redhat.com>
2795
2796         PR ld/14265
2797         * script-sections.cc (Sections_element::output_section_name): Add
2798         keep return parameter.
2799         (Output_section_element::match_name): Add keep return parameter.
2800         Return the value of the keep_ member.
2801         * script-sections.h (class Output_section): Update
2802         output_section_name prototype.
2803         * layout.cc (Layout::keep_input_section): New public member
2804         function.
2805         (Layout::choose_output_section): Pass keep parameter to
2806         output_section_name.
2807         * layout.h (class Layout): Add keep_input_section.
2808         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2809         sections.
2810         * testsuite/Makefile.am: Add a test.
2811         * testsuite/Makefile.in: Regenerate.
2812         * testsuite/pr14265.c: Source file for the test.
2813         * testsuite/pr14265.t: Linker script for the test.
2814         * testsuite/pr14265.sh: Shell script for the test.
2815
2816 2012-08-14  Alan Modra  <amodra@gmail.com>
2817
2818         * target.h (Target::output_section_name): New function.
2819         (Target::do_output_section_name): New function.
2820         * layout.cc (Layout::choose_output_section): Call the above.
2821         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2822
2823 2012-08-14  Alan Modra  <amodra@gmail.com>
2824
2825         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2826         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2827         for replace_constant call.
2828         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2829         (Output_data_glink::do_print_to_mapfile): New function.
2830         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2831         (Target_powerpc::Relocate::relocate): Likewise.
2832
2833 2012-08-14  Alan Modra  <amodra@gmail.com>
2834
2835         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2836         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2837         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2838         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2839         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2840         here.
2841         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2842         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2843         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2844         here.
2845         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2846         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2847
2848 2012-08-12  Alan Modra  <amodra@gmail.com>
2849
2850         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2851         (glink insn constants): Use uint32_t.
2852         (Output_data_glink::add_entry): Use insert, not [] operator.
2853
2854 2012-08-11  Alan Modra  <amodra@gmail.com>
2855
2856         * object.h (Sized_relobj_file::find_shdr): New function.
2857         (Sized_relobj_file::find_special_sections): New function.
2858         * object.cc (Sized_relobj_file::find_shdr): New function.
2859         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2860         (Sized_relobj_file::find_special_sections): New function, split out..
2861         (Sized_relobj_file::do_read_symbols): ..from here.
2862         * output.h (Output_data_got::replace_constant): New function.
2863         (Output_data_got::num_entries): New function.
2864         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2865         (Output_data_got::got_offset): Protected rather than private.
2866         (Output_data_got::replace_got_entry): New function.
2867         * output.cc (Output_data_got::replace_got_entry): New function.
2868         * powerpc.cc (class Powerpc_relobj): New.
2869         (class Powerpc_relocate_functions): Delete all psymval variants or
2870         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2871         Implement _ha functions using corresponding _hi function.
2872         (Powerpc_relobj::find_special_sections): New function.
2873         (Target_powerpc::do_make_elf_object): New function.
2874         (class Output_data_got_powerpc): New.
2875         (class Output_data_glink): New.
2876         (class Powerpc_scan_relocatable_reloc): New.
2877         Many more changes througout file.
2878
2879 2012-08-09  Nick Clifton  <nickc@redhat.com>
2880
2881         * po/vi.po: Updated Vietnamese translation.
2882
2883 2012-08-07  Ian Lance Taylor  <iant@google.com>
2884
2885         * layout.cc (Layout::add_target_dynamic_tags): If
2886         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2887         plt_rel.
2888
2889 2012-07-30  Nick Clifton  <nickc@redhat.com>
2890
2891         * po/gold.pot: Updated template.
2892         * po/es.po: Updated Spanish translation.
2893
2894 2012-07-18  Cary Coutant  <ccoutant@google.com>
2895
2896         PR gold/14344
2897         * configure.ac: Add check for -gpubnames support.
2898         * configure: Regenerate.
2899         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2900         support; force -gno-pubnames.
2901         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2902         support.
2903         (gdb_index_test_4): New test.
2904         * testsuite/Makefile.in: Regenerate.
2905         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2906         * testsuite/gdb_index_test_2.sh: Likewise.
2907         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2908         * testsuite/gdb_index_test_4.sh: New script.
2909         * testsuite/gdb_index_test_comm.sh: New script with common code;
2910         don't look for space after colon.
2911
2912 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2913
2914         * gold.cc (queue_middle_tasks): Update function order only after
2915         deferred objects due to plugins are processed.
2916
2917 2012-07-11  Ian Lance Taylor  <iant@google.com>
2918
2919         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2920         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2921         (Target_arm::scan_reloc_for_stub): Likewise.
2922         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2923         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2924         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2925         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2926         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2927
2928 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2929             Ian Lance Taylor  <iant@google.com>
2930
2931         PR gold/14309
2932         * configure.ac: Test whether std::tr1::hash<off_t> works.
2933         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2934         needed.
2935         * output.h (class Output_fill): Add virtual destructor.
2936         * configure, config.in: Rebuild.
2937
2938 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2939
2940         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2941
2942 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2943
2944         * plugin.cc (Plugin::load): Handle position independent executables.
2945
2946 2012-06-06  Cary Coutant  <ccoutant@google.com>
2947
2948         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2949         add .debug_macro.
2950         (lines_only_debug_sections): Likewise.
2951         (gdb_fast_lookup_sections): New static array.
2952         (is_gdb_debug_section): Rename formal parameter.
2953         (is_lines_only_debug_section): Likewise.
2954         (is_gdb_fast_lookup_section): New function.
2955         (Layout::include_section): Check for ".zdebug_" prefix; pass
2956         section name suffix to is_gdb_debug_section, et al.; check for
2957         fast-lookup sections when building .gdb_index.
2958         * options.h (--strip-debug-gdb): Update GDB version number.
2959
2960 2012-06-06  Cary Coutant  <ccoutant@google.com>
2961
2962         * configure.ac: Add check for fallocate.
2963         * configure: Regenerate.
2964         * config.in: Regenerate.
2965
2966         * options.h (class General_options): Add --mmap-output-file and
2967         --posix-fallocate options.
2968         * output.cc: (posix_fallocate): Remove; replace with...
2969         (gold_fallocate): New function.
2970         (Output_file::map_no_anonymous): Call gold_fallocate.
2971         (Output_file::map): Check --mmap-output-file option.
2972
2973 2012-06-05  Jing Yu  <jingyu@google.com>
2974
2975         * gold.h (textdomain): Add do {} to empty while(0).
2976         (bindtextdomain): Likewise.
2977
2978 2012-06-04  Cary Coutant  <ccoutant@google.com>
2979
2980         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2981         has_dynsym_index.
2982
2983 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2984
2985         * symtab.cc (Symbol_table::define_special_symbol):
2986         Initialize *poldsym to prevent uninitialized variable errors.
2987
2988 2012-05-23  Cary Coutant  <ccoutant@google.com>
2989
2990         * layout.cc (Layout::section_name_mapping): Add rules to handle
2991         exact match on .data.rel.ro.local or .data.rel.ro.
2992         (Layout::output_section_name): Check for exact matches.
2993
2994 2012-05-23  Cary Coutant  <ccoutant@google.com>
2995
2996         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2997         more carefully.
2998
2999 2012-05-22  Cary Coutant  <ccoutant@google.com>
3000
3001         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3002         object before exporting symbol.
3003
3004 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3005
3006         * testsuite/tls_test.cc: Include "config.h" first.
3007         * testsuite/tls_test_c.c: Likewise.
3008
3009 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3010             Nick Clifton  <nickc@redhat.com>
3011
3012         PR 14072
3013         * configure.in: Add check that sysdep.h has been included before
3014         any system header files.
3015         * configure: Regenerate.
3016         * config.in: Regenerate.
3017
3018 2012-05-14  Cary Coutant  <ccoutant@google.com>
3019
3020         * layout.cc (Layout::make_output_section): Mark .tdata section
3021         as RELRO.
3022         * testsuite/relro_test.cc: Add a TLS variable.
3023
3024 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3025
3026         PR gold/14091
3027         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3028         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3029         R_X86_64_64.
3030
3031 2012-05-08  Cary Coutant  <ccoutant@google.com>
3032
3033         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3034         (lines_only_debug_sections): Likewise.
3035
3036 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3037
3038         * nacl.cc: New file.
3039         * nacl.h: New file.
3040         * Makefile.am (CCFILES, HFILES): Add them.
3041         * Makefile.in: Regenerate.
3042         * i386.cc (Output_data_plt_i386_nacl): New class.
3043         (Output_data_plt_i386_nacl_exec): New class.
3044         (Output_data_plt_i386_nacl_dyn): New class.
3045         (Target_i386_nacl): New class.
3046         (Target_selector_i386_nacl): New class.
3047         (target_selector_i386): Use it instead of Target_selector_i386.
3048         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3049         (Target_x86_64_nacl): New class.
3050         (Target_selector_x86_64_nacl): New class.
3051         (target_selector_x86_64, target_selector_x32): Use it instead of
3052         Target_selector_x86_64.
3053         * arm.cc (Output_data_plt_arm_nacl): New class.
3054         (Target_arm_nacl): New class.
3055         (Target_selector_arm_nacl): New class.
3056         (target_selector_arm, target_selector_armbe): Use it instead of
3057         Target_selector_arm.
3058
3059         * target-select.cc (select_target): Take new Input_file* and off_t
3060         arguments, pass them on to recognize method of selector.
3061         * object.cc (make_elf_sized_object): Update caller.
3062         * parameters.cc (parameters_force_valid_target): Likewise.
3063         * incremental.cc (make_sized_incremental_binary): Likewise.
3064         * target-select.h: Update decl.
3065         (Target_selector::recognize): Take new Input_file* argument,
3066         pass it on to do_recognize.
3067         (Target_selector::do_recognize): Take new Input_file* argument.
3068         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3069         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3070         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3071         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3072
3073         * target.h (Target::Target_info): New members isolate_execinstr
3074         and rosegment_gap.
3075         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3076         * arm.cc (Target_arm::arm_info): Update initializer.
3077         * i386.cc (Target_i386::i386_info): Likewise.
3078         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3079         * sparc.cc (Target_sparc::sparc_info): Likewise.
3080         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3081         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3082         * layout.cc (Layout::attach_allocated_section_to_segment):
3083         Take new const Target* argument.  If target->isolate_execinstr(), act
3084         like --rosegment.
3085         (Layout::find_first_load_seg): Take new const Target* argument;
3086         if target->isolate_execinstr(), reject PF_X segments.
3087         (Layout::relaxation_loop_body): Update caller.
3088         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3089         reset file offset to zero when we hit LOAD_SEG, and then do a second
3090         loop over the segments before LOAD_SEG to reassign offsets after
3091         addresses have been determined.  Handle target->rosegment_gap().
3092         (Layout::attach_section_to_segment): Take new const Target* argument;
3093         pass it to attach_allocated_section_to_segment.
3094         (Layout::make_output_section): Update caller.
3095         (Layout::attach_sections_to_segments): Take new const Target* argument;
3096         pass it to attach_section_to_segment.
3097         * gold.cc (queue_middle_tasks): Update caller.
3098         * layout.h (Layout): Update method decls with new arguments.
3099
3100         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3101         Target_info pointer to use.
3102         (Target_arm::do_make_data_plt): New virtual method.
3103         (Target_arm::make_data_plt): New method that calls it.
3104         (Target_arm::make_plt_entry): Use it.
3105         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3106         for the section alignment.
3107         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3108         method.
3109         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3110         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3111         method.
3112         (Output_data_plt_arm::get_plt_entry_size): Call it.
3113         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3114         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3115         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3116         method.
3117         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3118         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3119         method instead of sizeof(plt_entry).
3120         (Output_data_plt_arm::add_entry): Likewise.
3121         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3122         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3123         than static method.
3124         (Target_arm::plt_entry_size): Likewise.
3125         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3126         Move to ...
3127         (Output_data_plt_arm_standard): ... here, new class.
3128         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3129         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3130         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3131
3132         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3133         Take additional argument for the PLT entry size.
3134         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3135         Use get_plt_entry_size method rather than plt_entry_size variable.
3136         (Output_data_plt_x86_64::reserve_slot): Likewise.
3137         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3138         (Output_data_plt_x86_64::add_entry): Likewise.
3139         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3140         (Output_data_plt_x86_64::address_for_global): Likewise.
3141         (Output_data_plt_x86_64::address_for_local): Likewise.
3142         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3143         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3144         Make method non-static.
3145         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3146         method.
3147         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3148         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3149         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3150         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3151         virtual method.
3152         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3153         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3154         virtual method.
3155         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3156         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3157         virtual method.
3158         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3159         (Output_data_plt_x86_64::plt_entry_size)
3160         (Output_data_plt_x86_64::first_plt_entry)
3161         (Output_data_plt_x86_64::plt_entry)
3162         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3163         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3164         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3165         (Output_data_plt_x86_64_standard): ... here, new class.
3166         (Target_x86_64::Target_x86_64): Take optional argument for the
3167         Target_info pointer to use.
3168         (Target_x86_64::do_make_data_plt): New virtual method.
3169         (Target_x86_64::make_data_plt): New method to call it.
3170         (Target_x86_64::init_got_plt_for_update): Use that.
3171         Call this->plt_->add_eh_frame method here.
3172         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3173         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3174         rather than static method.
3175         (Target_x86_64::plt_entry_size): Likewise.
3176         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3177         rather than plt_entry_size variable.  Move guts of PLT filling to...
3178         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3179         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3180         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3181
3182         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3183         additional argument for the section alignment.
3184         Don't do add_eh_frame_for_plt here.
3185         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3186         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3187         variable.
3188         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3189         method.
3190         (Output_data_plt_i386::get_plt_entry_size): Call it.
3191         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3192         (Output_data_plt_i386::add_eh_frame): New method to call it.
3193         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3194         method.
3195         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3196         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3197         method.
3198         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3199         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3200         method instead of plt_entry_size.
3201         (Output_data_plt_i386::plt_entry_size)
3202         (Output_data_plt_i386::plt_eh_frame_fde_size)
3203         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3204         (Output_data_plt_i386_standard): ... here, new class.
3205         (Output_data_plt_i386_exec): New class.
3206         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3207         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3208         (Output_data_plt_i386::exec_plt_entry): Move to ...
3209         (Output_data_plt_i386_exec::plt_entry): ... here.
3210         (Output_data_plt_i386_dyn): New class.
3211         (Output_data_plt_i386::first_plt_entry): Move to ...
3212         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3213         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3214         (Output_data_plt_i386_dyn::plt_entry): ... here.
3215         (Target_i386::Target_i386): Take optional argument for the Target_info
3216         pointer to use.
3217         (Target_i386::do_make_data_plt): New virtual method.
3218         (Target_i386::make_data_plt): New method to call it.
3219         (Target_i386::make_plt_section): Use that.
3220         Call this->plt_->add_eh_frame method here.
3221         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3222         rather than plt_entry_size variable.
3223         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3224         (Output_data_plt_i386::address_for_local): Likewise.
3225         (Output_data_plt_i386::do_write): Likewise.
3226         Move guts of PLT filling to...
3227         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3228         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3229         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3230         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3231
3232 2012-05-01  Cary Coutant  <ccoutant@google.com>
3233
3234         * dwarf_reader.cc (Dwarf_die::read_attributes)
3235         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3236         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3237         * reduced_debug_output.cc
3238         (Output_reduced_debug_info_section::get_die_end): Remove
3239         DW_FORM_GNU_ref_index.  Add default case.
3240
3241 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3242
3243         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3244         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3245         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3246         DW_AT_high_pc as offset from DW_AT_low_pc.
3247
3248         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3249         * testsuite/Makefile.in: Regenerate.
3250         * testsuite/gdb_index_test_3.c: New test source file.
3251         * testsuite/gdb_index_test_3.sh: New test source file.
3252
3253 2012-04-25  Ian Lance Taylor  <iant@google.com>
3254
3255         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3256         pointer.
3257         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3258         as a class, not a struct.
3259         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3260         (Target_arm::apply_cortex_a8_workaround): Likewise.
3261         * gc.h: Declare Reloc_types as a struct, not a class.
3262         * object.h: Declare Symbols_data as a struct.
3263         * reloc.h: Declare Read_relocs_data as a struct.
3264         * target.h: Declare Relocate_info as a struct.
3265
3266 2012-04-24  David S. Miller  <davem@davemloft.net>
3267
3268         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3269         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3270         and R_SPARC_WPLT30.
3271
3272 2012-04-24  Cary Coutant  <ccoutant@google.com>
3273
3274         * incremental-dump.cc (find_input_containing_global): Replace
3275         magic number with symbolic constant.
3276         (dump_incremental_inputs): Update version number.
3277         * incremental.cc (Output_section_incremental_inputs): Update version
3278         number; import symbolic constants from Incremental_inputs_reader.
3279         (Incremental_inputs::create_data_sections): Align relocations
3280         section correctly for 64-bit targets.
3281         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3282         constants; add padding.
3283         (Output_section_incremental_inputs::write_header): Add assert for
3284         header_size.
3285         (Output_section_incremental_inputs::write_input_files): Add assert
3286         for input_entry_size.
3287         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3288         add assert for object_info_size, input_section_entry_size,
3289         global_sym_entry_size.
3290         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3291         for data structure sizes; use them.
3292         (Incremental_input_entry_reader): Import symbolic constants from
3293         Incremental_inputs_reader; use them.
3294
3295 2012-04-23  David S. Miller  <davem@davemloft.net>
3296
3297         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3298         and elf_flags_set_.
3299         (Target_sparc::Target_sparc): Initialize new fields.
3300         (Target_sparc::do_make_elf_object): New function.
3301         (Target_sparc::do_adjust_elf_header): New function.
3302
3303 2012-04-23  Cary Coutant  <ccoutant@google.com>
3304
3305         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3306         CU range table of gdb index.
3307
3308 2012-04-20  David S. Miller  <davem@davemloft.net>
3309
3310         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3311         instead of false.
3312
3313 2012-04-16  David S. Miller  <davem@davemloft.net>
3314
3315         * sparc.cc (Target_sparc::got_address): New function.
3316         (Sparc_relocate_functions::gdop_hix22): New function.
3317         (Sparc_relocate_functions::gdop_lox10): New function.
3318         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3319         relocs.
3320         (Target_sparc::Scan::local): Likewise if the global symbol is not
3321         preemptible and is not IFUNC.
3322         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3323         transformations for local and non-preemptible non-IFUNC global
3324         symbols.
3325
3326         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3327         writing out 64-bit part of ranges.
3328
3329         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3330         -fpic and -fpie respectively.
3331         * Makefile.in: Regenerate.
3332
3333         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3334         (Target_sparc::Target_sparc): Initialize new field.
3335         (Target_sparc::do_plt_section_for_global): New function.
3336         (Target_sparc::do_plt_section_for_local): New function.
3337         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3338         (Target_sparc::make_plt_section): New function, broken out of
3339         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3340         (Target_sparc::make_plt_entry): Call make_plt_section.
3341         (Target_sparc::make_local_ifunc_plt_entry): New function.
3342         (Target_sparc::rela_ifunc_section): New function.
3343         (Target_sparc::plt_section): Remove const.
3344         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3345         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3346         and ifunc_count_ fields.
3347         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3348         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3349         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3350         (Output_data_plt_sparc::rela_ifunc): New function.
3351         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3352         (Output_data_plt_sparc::has_ifunc_section): New function.
3353         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3354         (Output_data_plt_sparc::address_for_global): New function.
3355         (Output_data_plt_sparc::address_for_local): New function.
3356         (Output_data_plt_sparc::plt_index_to_offset): New function.
3357         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3358         and entry_count.
3359         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3360         entry_count.
3361         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3362         R_SPARC_JMP_IREL to switch.
3363         (Target_sparc::Scan::check_non_pic): Likewise.
3364         (Target_sparc::Scan::local): Handle IFUNC symbols.
3365         (Target_sparc::Scan::local): Likewise.
3366         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3367         and plt_address_for_local.
3368         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3369         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3370
3371         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3372         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3373         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3374         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3375         global relocs too.
3376         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3377         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3378         calls.
3379         * sparc.cc (Target_sparc::Scan::global): Likewise.
3380         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3381
3382 2012-04-16  Cary Coutant  <ccoutant@google.com>
3383
3384         * archive.cc (Library_base::should_include_member): Check for
3385         --export-dynamic-symbol.
3386         * options.h (class General_options): Add --export-dynamic-symbol.
3387         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3388         --export-dynamic-symbol.
3389         (Symbol_table::gc_mark_undef_symbols): Likewise.
3390         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3391
3392 2012-04-12  David S. Miller  <davem@davemloft.net>
3393
3394         * sparc.cc (Reloc::wdisp10): New relocation method.
3395         (Reloc::h34): Likewise.
3396         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3397         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3398         R_SPARC_WDISP10.
3399         (Target_sparc::Scan::local): Likewise.
3400         (Target_sparc::Scan::global): Likewise.
3401         (Target_sparc::Relocate::relocate): Likewise.
3402
3403 2012-04-09  Cary Coutant  <ccoutant@google.com>
3404
3405         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3406         low_pc == 0.
3407
3408 2012-04-06  Ian Lance Taylor  <iant@google.com>
3409
3410         * timer.cc: #include <unistd.h>.
3411
3412 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3413
3414         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3415         * config.in: Regenerate.
3416         * configure: Regenerate.
3417
3418 2012-04-05  Nick Clifton  <nickc@redhat.com>
3419
3420         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3421         (AM_LC_MESSAGES): Add.
3422         * aclocal.m4: Regenerate.
3423         * config.in: Regenerate.
3424         * configure: Regenerate.
3425
3426 2012-03-21  Cary Coutant  <ccoutant@google.com>
3427
3428         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3429         * Makefile.in: Regenerate.
3430         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3431         (Sized_elf_reloc_mapper::symbol_section): New function.
3432         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3433         (make_elf_reloc_mapper): New function.
3434         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3435         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3436         (Dwarf_abbrev_table::do_get_abbrev): New function.
3437         (Dwarf_ranges_table::read_ranges_table): New function.
3438         (Dwarf_ranges_table::read_range_list): New function.
3439         (Dwarf_pubnames_table::read_section): New function.
3440         (Dwarf_pubnames_table::read_header): New function.
3441         (Dwarf_pubnames_table::next_name): New function.
3442         (Dwarf_die::Dwarf_die): New function.
3443         (Dwarf_die::read_attributes): New function.
3444         (Dwarf_die::skip_attributes): New function.
3445         (Dwarf_die::set_name): New function.
3446         (Dwarf_die::set_linkage_name): New function.
3447         (Dwarf_die::attribute): New function.
3448         (Dwarf_die::string_attribute): New function.
3449         (Dwarf_die::int_attribute): New function.
3450         (Dwarf_die::uint_attribute): New function.
3451         (Dwarf_die::ref_attribute): New function.
3452         (Dwarf_die::child_offset): New function.
3453         (Dwarf_die::sibling_offset): New function.
3454         (Dwarf_info_reader::check_buffer): New function.
3455         (Dwarf_info_reader::parse): New function.
3456         (Dwarf_info_reader::do_parse): New function.
3457         (Dwarf_info_reader::do_read_string_table): New function.
3458         (Dwarf_info_reader::lookup_reloc): New function.
3459         (Dwarf_info_reader::get_string): New function.
3460         (Dwarf_info_reader::visit_compilation_unit): New function.
3461         (Dwarf_info_reader::visit_type_unit): New function.
3462         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3463         Sized_elf_reloc_mapper.
3464         (Sized_dwarf_line_info::symbol_section): Remove function.
3465         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3466         (Sized_dwarf_line_info::read_line_mappings): Remove object
3467         parameter, adjust callers.
3468         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3469         * dwarf_reader.h: Include <sys/types.h>.
3470         (class Track_relocs): Remove forward declaration.
3471         (class Elf_reloc_mapper): New class.
3472         (class Sized_elf_reloc_mapper): New class.
3473         (class Dwarf_abbrev_table): New class.
3474         (class Dwarf_range_list): New class.
3475         (class Dwarf_ranges_table): New class.
3476         (class Dwarf_pubnames_table): New class.
3477         (class Dwarf_die): New class.
3478         (class Dwarf_info_reader): New class.
3479         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3480         (Sized_dwarf_line_info::symbol_section): Remove member function.
3481         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3482         base class.
3483         * gdb-index.cc: New source file.
3484         * gdb-index.h: New source file.
3485         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3486         and .debug_types sections, call Layout::add_to_gdb_index.
3487         (Sized_relobj_incr::do_section_name): Implement.
3488         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3489         return type; Implement.
3490         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3491         return type.
3492         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3493         parameter list and return type.
3494         (Sized_incr_dynobj::do_section_contents): Likewise.
3495         * layout.cc: Include gdb-index.h.
3496         (Layout::Layout): Initialize gdb_index_data_.
3497         (Layout::init_fixed_output_section): Check for .gdb_index section.
3498         (Layout::add_to_gdb_index): New function. Instantiate.
3499         * layout.h: Add forward declaration for class Gdb_index.
3500         (Layout::add_to_gdb_index): New member function.
3501         (Layout::gdb_index_data_): New data member.
3502         * main.cc: Include gdb-index.h.
3503         (main): Print statistics for gdb index.
3504         * object.cc (Object::section_contents): Move code into
3505         do_section_contents.
3506         (need_decompressed_section): Check for sections needed when building
3507         gdb index.
3508         (build_compressed_section_map): Likewise.
3509         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3510         gdb index.
3511         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3512         sections; call Layout::add_to_gdb_index.
3513         (Sized_relobj_file::do_decompressed_section_contents): Call
3514         do_section_contents directly.
3515         * object.h (Object::do_section_contents): Adjust parameter list and
3516         return type.
3517         (Object::do_decompressed_section_contents): Call do_section_contents
3518         directly.
3519         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3520         return type.
3521         * options.h (class General_options): Add --gdb-index option.
3522         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3523         list and return type.
3524         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3525         * reloc.h (Track_relocs::checkpoint): New function.
3526         (Track_relocs::reset): New function.
3527
3528         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3529         New test cases.
3530         * testsuite/Makefile.in: Regenerate.
3531         * testsuite/gdb_index_test.cc: New test source file.
3532         * testsuite/gdb_index_test_1.sh: New test source file.
3533         * testsuite/gdb_index_test_2.sh: New test source file.
3534
3535 2012-03-19  Doug Kwan  <dougkwan@google.com>
3536
3537         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3538         (Target_arm::do_finalize_sections): Remove code which defines
3539         __exidx_start and __exidx_end.  Make symbol table parameter
3540         anonymous as it is not used.
3541         * gold.cc (queue_middle_tasks): Call target hook to define any
3542         target-specific symbols.
3543         * target.h (Target::define_standard_symbols): New method.
3544         (Target::do_define_standard_symbols): Same.
3545         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3546         * testsuite/Makefile.in: Regenerate.
3547         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3548         and __exidx_end.
3549         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3550         relocations are generated for __exidx_start and __exidx_end.
3551
3552 2012-03-16  Doug Kwan  <dougkwan@google.com>
3553
3554         * testsuite/Makefile.am: Disable test initpri3b.
3555         * testsuite/Makefile.in: Regenerate.
3556
3557 2012-03-15  Doug Kwan  <dougkwan@google.com>
3558
3559         * arm.cc (Target_arm::got_section): Make .got section read-only
3560         if -z now is given.
3561
3562 2012-03-15  Ian Lance Taylor  <iant@google.com>
3563
3564         PR gold/13850
3565         * layout.cc (Layout::make_output_section): Correctly mark
3566         SHT_INIT_ARRAY, et. al., as relro.
3567
3568 2012-03-14  Doug Kwan  <dougkwan@google.com>
3569
3570         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3571         dynamic relocations for protected symbols in shared objects.
3572
3573 2012-03-13  Ian Lance Taylor  <iant@google.com>
3574
3575         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3576         keep the larger alignment.
3577
3578 2012-03-12  Cary Coutant  <ccoutant@google.com>
3579
3580         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3581         handling of DW_LNE_define_file.
3582
3583 2012-03-12  Cary Coutant  <ccoutant@google.com>
3584
3585         * reduced_debug_output.cc
3586         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3587         codes to switch.
3588
3589 2012-02-29  Cary Coutant  <ccoutant@google.com>
3590
3591         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3592
3593 2012-02-29  Cary Coutant  <ccoutant@google.com>
3594
3595         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3596         Call Object::decompressed_section_contents.
3597         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3598         New dtor.
3599         (Sized_dwarf_line_info::buffer_start_): New data member.
3600         * merge.cc (Output_merge_data::do_add_input_section): Call
3601         Object::decompressed_section_contents.
3602         (Output_merge_string::do_add_input_section): Likewise.
3603         * object.cc (need_decompressed_section): New function.
3604         (build_compressed_section_map): Decompress sections needed later.
3605         (Sized_relobj_file::do_decompressed_section_contents): New function.
3606         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3607         * object.h (Object::decompressed_section_contents): New function.
3608         (Object::discard_decompressed_sections): New function.
3609         (Object::do_decompressed_section_contents): New function.
3610         (Object::do_discard_decompressed_sections): New function.
3611         (Compressed_section_info): New type.
3612         (Compressed_section_map): Include decompressed section contents.
3613         (Sized_relobj_file::do_decompressed_section_contents): New function.
3614         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3615
3616 2012-02-16  Cary Coutant  <ccoutant@google.com>
3617
3618         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3619         * testsuite/Makefile.in: Regenerate.
3620
3621 2012-02-14  Cary Coutant  <ccoutant@google.com>
3622
3623         * options.cc (General_options::finalize): Disallow -pie and -static.
3624
3625 2012-02-03  Doug Kwan  <dougkwan@google.com>
3626
3627         * arm.cc (Arm_relocate_functions::abs8,
3628         Arm_relocate_functions::abs16): Use
3629         Bits::has_signed_unsigned_overflow32.
3630         (Arm_relocate_functions::thm_abs8): Correct range of
3631         overflow check.
3632         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3633         in assertions.
3634
3635 2012-02-02  Doug Kwan  <dougkwan@google.com>
3636
3637         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3638         position independent outputs, not just shared objects.
3639
3640 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3641
3642         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3643         * configure: Regenerated.
3644
3645 2012-01-27  Ian Lance Taylor  <iant@google.com>
3646
3647         * reloc.h (Bits): New class with static functions, copied from
3648         namespace utils in arm.cc.
3649         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3650         instead.
3651
3652 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3653
3654         * incremental.cc (write_info_blocks): Correct relocation offset.
3655
3656 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3657
3658         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3659         (Relocate::tls_gd_to_le): Likewise.
3660
3661 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3662
3663         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3664
3665 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3666
3667         * configure.ac: Check if -mcmodel=medium works.
3668         * configure: Regenerated.
3669
3670 2012-01-24  Cary Coutant  <ccoutant@google.com>
3671
3672         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3673         definition and ...
3674         (read_unsigned_LEB_128_x): ... this new function.
3675         (read_signed_LEB_128): Replaced with inline definition and ...
3676         (read_signed_LEB_128_x): ... this new function.
3677         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3678         (read_unsigned_LEB_128): Add inline definition.
3679         (read_signed_LEB_128_x): New function.
3680         (read_signed_LEB_128): Add inline definition.
3681         * testsuite/Makefile.am (leb128_unittest): New unit test.
3682         * testsuite/Makefile.in: Regenerate.
3683         * testsuite/leb128_unittest.cc: New unit test.
3684
3685 2012-01-23  Ian Lance Taylor  <iant@google.com>
3686
3687         PR gold/13617
3688         * i386.cc (Target_i386::do_code_fill): When using a jmp
3689         instruction, pad with nop instructions.
3690         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3691
3692 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3693
3694         * x86_64.cc (gc_process_relocs): Add typename on types used in
3695         template.
3696         (scan_relocs): Likewise.
3697         (relocate_section): Likewise.
3698         (apply_relocation): Likewise.
3699
3700 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3701
3702         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3703         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3704         under x32.
3705
3706 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3707
3708         * x86_64.cc: Initial support for x32.
3709
3710 2012-01-03  Cary Coutant  <ccoutant@google.com>
3711
3712         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3713         Use abstract base class for GOT.
3714         * gold/output.h (class Output_data_got_base): New abstract base class.
3715         (class Output_data_got): Derive from new base class, adjust ctors.
3716         (Output_data_got::reserve_slot): Make virtual; rename to
3717         do_reserve_slot; Adjust callers.
3718         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3719         pointer to abstract base class.
3720         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3721
3722 2011-12-18  Ian Lance Taylor  <iant@google.com>
3723
3724         * object.h (Relobj::local_symbol_value): New function.
3725         (Relobj::local_plt_offset): New function.
3726         (Relobj::local_has_got_offset): New function.
3727         (Relobj::local_got_offset): New function.
3728         (Relobj::set_local_got_offset): New function.
3729         (Relobj::do_local_symbol_value): New pure virtual function.
3730         (Relobj::do_local_plt_offset): Likewise.
3731         (Relobj::do_local_has_got_offset): Likewise.
3732         (Relobj::do_local_got_offset): Likewise.
3733         (Relobj::do_set_local_got_offset): Likewise.
3734         (Sized_relobj::do_local_has_got_offset): Rename from
3735         local_has_got_offset.
3736         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3737         (Sized_relobj::do_set_local_got_offset): Rename from
3738         set_local_got_offset.
3739         (Sized_relobj_file::do_local_plt_offset): Rename from
3740         local_plt_offset.
3741         (Sized_relobj_file::do_local_symbol_value): New function.
3742         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3743         local_plt_offset.
3744         * output.cc (Output_data_got::Got_entry::write): Change object to
3745         Relobj.  Use local_symbol_value.
3746         (Output_data_got::add_global_with_rel): Change rel_dyn to
3747         Output_data_reloc_generic*.  Use add_global_generic.
3748         (Output_data_got::add_global_with_rela): Remove.  Change all
3749         callers to use add_global_with_rel.
3750         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3751         Output_data_reloc_generic*.  Use add_global_generic.
3752         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3753         callers to use add_global_pair_with_rel.
3754         (Output_data_got::add_local): Change object to Relobj*.
3755         (Output_data_got::add_local_plt): Likewise.
3756         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3757         change rel_dyn to Output_data_reloc_generic*.  Use
3758         add_local_generic.
3759         (Output_data_got::add_local_with_rela): Remove.  Change all
3760         callers to use all_local_with_rel.
3761         (Output_data_got::add_local_pair_with_rel): Change object to
3762         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3763         add_output_section_generic.
3764         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3765         callers to use add_local_pair_with_rel.
3766         (Output_data_got::reserve_local): Change object to Relobj*.
3767         * output.h: (class Output_data_reloc_generic): Add pure virtual
3768         declarations for add_global_generic, add_local_generic,
3769         add_output_section_generic.
3770         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3771         functions for Output_data_reloc_generic.  Update declarations for
3772         changes listed in output.cc.
3773         (class Output_data_got): Change template parameter to got_size.
3774         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3775         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3776         function.
3777         (Sized_relobj_incr::do_local_plt_offset): New function.
3778         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3779         add_global_generic.
3780
3781 2011-12-17  Cary Coutant  <ccoutant@google.com>
3782
3783         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3784         * resolve.cc (Symbol_table::resolve): Likewise.
3785         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3786         arrays.
3787         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3788
3789 2011-12-16  Ian Lance Taylor  <iant@google.com>
3790
3791         * output.h (Output_data_reloc_generic::add): Only call
3792         add_dynamic_reloc if this is a dynamic reloc section.
3793
3794 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3795
3796         PR gold/13505
3797         * target-reloc.h (apply_relocation): Replace <64, false> with
3798         <size, big_endian>.
3799
3800 2011-11-25  Nick Clifton  <nickc@redhat.com>
3801
3802         * po/it.po: New Italian translation.
3803
3804 2011-11-17  Sterling Augustine  <saugustine@google.com>
3805
3806         * script.cc (script_include_directive): Implement.
3807         (read_script_file): New local variables name and search_path. Update
3808         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3809         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3810         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3811
3812 2011-11-11  Sterling Augustine  <saugustine@google.com>
3813
3814         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3815         (file_or_sections_cmd): Likewise.
3816
3817 2011-11-11  Doug Kwan  <dougkwan@google.com>
3818
3819         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3820         if --just-symbols is given.
3821
3822 2011-11-10  Doug Kwan  <dougkwan@google.com>
3823
3824         PR gold/13362
3825         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3826         when processing data relocs.
3827         * reloc.h (Relocate_functions::rel_unaligned): New method.
3828         (Relocate_functions::pcrel_unaligned): Ditto.
3829         (Relocate_functions::rel32_unaligned): Ditto.
3830         (Relocate_functions::pcrel32_unaligned): Ditto.
3831
3832 2011-11-09  Doug Kwan  <dougkwan@google.com>
3833
3834         PR gold/13362
3835         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3836         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3837         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3838         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3839         (Relocate_functions::rel_unaligned): New.
3840         (Relocate_functions::rel32_unaligned): New.
3841         * target-reloc.h (relocate_for_relocatable): Add code to handle
3842         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3843         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3844         arm_unaligned_reloc_r): New targets.
3845         * testsuite/Makefile.in: Regenerate.
3846         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3847         linking.
3848
3849 2011-11-02  Ian Lance Taylor  <iant@google.com>
3850
3851         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3852         NATIVE_LINKER.
3853         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3854         * options.cc (General_options::finalize): Use library search path
3855         from configure script if specified.  If not native and no sysroot,
3856         only search TOOLLIBDIR.
3857         * options.h (Search_directory::Search_directory): Change name to
3858         const std::string&.
3859         (General_options::add_to_library_path_with_sysroot): Change arg to
3860         const std::string&.
3861         * configure, Makefile.in, config.in: Rebuild.
3862
3863 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3864
3865         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3866         we are working around the ARM1176 Erratum.
3867         * options.h (General_options::fix_arm1176): Add option.
3868         * testsuite/Makefile.am: Add testcases, and keep current ones
3869         working.
3870         * testsuite/Makefile.in: Regenerate.
3871         * testsuite/arm_fix_1176.s: New file.
3872         * testsuite/arm_fix_1176.sh: Likewise.
3873
3874 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3875
3876         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3877         may_use_blx_.
3878         (Target_arm::may_use_blx): Remove method.
3879         (Target_arm::set_may_use_blx): Likewise.
3880         (Target_arm::may_use_v4t_interworking): New method.
3881         (Target_arm::may_use_v5t_interworking): Likewise.
3882         (Target_arm::may_use_blx_): Remove member variable.
3883         (Arm_relocate_functions::arm_branch_common): Check for v5T
3884         interworking.
3885         (Arm_relocate_functions::thumb_branch_common): Likewise.
3886         (Reloc_stub::stub_type_for_reloc): Likewise.
3887         (Target_arm::do_finalize_sections): Correct interworking checks.
3888         * testsuite/Makefile.am: Add new tests.
3889         * testsuite/Makefile.in: Regenerate.
3890         * testsuite/arm_farcall_arm_arm.s: New test.
3891         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3892         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3893         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3894         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3895         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3896         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3897         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3898
3899 2011-10-31  Cary Coutant  <ccoutant@google.com>
3900
3901         PR gold/13023
3902         * expression.cc (Expression::eval_with_dot): Add
3903         is_section_dot_assignment parameter.
3904         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3905         absolute and assigning to dot within a section.
3906         * script-sections.cc
3907         (Output_section_element_assignment::set_section_addresses): Pass
3908         dot_section to set_if_absolute.
3909         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3910         as is_section_dot_assignment flag to eval_with_dot.
3911         (Output_section_element_dot_assignment::set_section_addresses):
3912         Likewise.
3913         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3914         parameter.  Also set value if relative to dot_section; set the
3915         symbol's output_section.
3916         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3917         parameter.  Adjust all callers.
3918         (Expression::eval_maybe_dot): Likewise.
3919         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3920         Adjust all callers.
3921         * testsuite/script_test_2.t: Test assignment of an absolute value
3922         to dot within an output section element.
3923
3924 2011-10-31  Cary Coutant  <ccoutant@google.com>
3925
3926         * options.h (class General_options): Add --[no-]gnu-unique options.
3927         * symtab.cc (Symbol_table::sized_write_globals): Convert
3928         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3929
3930 2011-10-31  Cary Coutant  <ccoutant@google.com>
3931
3932         PR gold/13359
3933         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3934         unnecessary assertion.
3935         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3936
3937 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3938
3939         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3940         gc_mark_symbol.
3941         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3942         gc_mark_symbol.
3943         Change to just keep the section associated with symbol.
3944         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3945         they are externally visible and --export-dynamic is turned on.
3946         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3947
3948 2011-10-19  Ian Lance Taylor  <iant@google.com>
3949
3950         PR gold/13163
3951         * script-sections.cc
3952         (Output_section_element_dot_assignment::needs_output_section): New
3953         function.
3954
3955 2011-10-19  Ian Lance Taylor  <iant@google.com>
3956
3957         PR gold/13204
3958         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3959         --section-start option was seen.
3960         * options.h (General_options::any_section_start): New function.
3961
3962 2011-10-18  David S. Miller  <davem@davemloft.net>
3963
3964         PR binutils/13301
3965         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3966         member to track relocation locations that have moved during TLS
3967         reloc optimizations.
3968         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3969         (Target_sparc::Relocate::relocate): Adjust view down by 4
3970         bytes if it matches reloc_adjust_addr_.
3971         (Target_sparc::Relocate::relocate_tls): Always move the
3972         __tls_get_addr call delay slot instruction forward 4 bytes when
3973         performing relaxation.
3974
3975 2011-10-18  Cary Coutant  <ccoutant@google.com>
3976
3977         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3978         (Output_file::map_no_anonymous): Check for non-zero
3979         return code from posix_fallocate.
3980
3981 2011-10-17  Cary Coutant  <ccoutant@google.com>
3982
3983         PR gold/13245
3984         * plugin.cc (is_visible_from_outside): Check for symbols
3985         referenced from dynamic objects.
3986         * resolve.cc (Symbol_table::resolve): Don't count references
3987         from dynamic objects as references from real ELF files.
3988         * testsuite/plugin_test_2.sh: Adjust expected result.
3989
3990 2011-10-17  Cary Coutant  <ccoutant@google.com>
3991
3992         * gold.cc: Include timer.h.
3993         (queue_middle_tasks): Stamp time.
3994         (queue_final_tasks): Likewise.
3995         * main.cc (main): Store timer in parameters.  Print timers
3996         for each pass.
3997         * parameters.cc (Parameters::Parameters): Initialize timer_.
3998         (Parameters::set_timer): New function.
3999         (set_parameters_timer): New function.
4000         * parameters.h (Parameters::set_timer): New function.
4001         (Parameters::timer): New function.
4002         (Parameters::timer_): New data member.
4003         (set_parameters_timer): New function.
4004         * timer.cc (Timer::stamp): New function.
4005         (Timer::get_pass_time): New function.
4006         * timer.h (Timer::stamp): New function.
4007         (Timer::get_pass_time): New function.
4008         (Timer::pass_times_): New data member.
4009
4010 2011-10-17  Cary Coutant  <ccoutant@google.com>
4011
4012         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4013         task for members of lib groups.
4014
4015 2011-10-17  Cary Coutant  <ccoutant@google.com>
4016
4017         PR gold/13288
4018         * fileread.cc (File_read::find_view): Add assert.
4019         (File_read::make_view): Move bounds check (replace with assert)...
4020         (File_read::find_or_make_view): ... to here.
4021
4022 2011-10-12  Cary Coutant  <ccoutant@google.com>
4023
4024         * output.cc (Output_file::open_base_file): Handle case where
4025         ::read returns less than requested size.
4026
4027 2011-10-10  Cary Coutant  <ccoutant@google.com>
4028
4029         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4030         Initialize defined_count_.
4031         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4032         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4033         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4034         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4035         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4036         * incremental.h (Sized_relobj_incr::defined_count_): New data
4037         member.
4038         (Sized_incr_dynobj::defined_count_): New data member.
4039         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4040         Return zeroes instead of internal error.
4041
4042 2011-10-10  Cary Coutant  <ccoutant@google.com>
4043
4044         PR gold/13249
4045         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4046         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4047         * output.h (class Output_reloc): Add use_plt_offset flag.
4048         (Output_reloc::type_): Adjust size of bit field.
4049         (Output_reloc::use_plt_offset_): New bit field.
4050         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4051         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4052         flag.  Adjust all callers.
4053         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4054         creating RELATIVE relocations.
4055
4056 2011-10-10  Nick Clifton  <nickc@redhat.com>
4057
4058         * po/es.po: Updated Spanish translation.
4059         * po/fi.po: Updated Finnish translation.
4060
4061 2011-10-03   Diego Novillo  <dnovillo@google.com>
4062
4063         * options.cc (parse_uint): Fix dereference of RETVAL.
4064
4065 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4066
4067         * layout.h (section_order_map_): New member.
4068         (get_section_order_map): New member function.
4069         * output.cc (Output_section::add_input_section): Check for patterns
4070         only when --section-ordering-file is specified.
4071         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4072         output_sections have been formed.
4073         * layout.cc (Layout_Layout): Initialize section_order_map_.
4074         * plugin.cc (update_section_order): Store order in order_map. Do not
4075         update the order.
4076         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4077         * testsuite/Makefile.in: Regenerate.
4078         * testsuite/plugin_section_order.c: New file.
4079         * testsuite/plugin_final_layout.cc: New file.
4080         * testsuite/plugin_final_layout.sh: New file.
4081
4082 2011-09-29  Cary Coutant  <ccoutant@google.com>
4083
4084         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4085         Check for NULL.
4086         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4087         symbols during incremental update.
4088         (Symbol_table::add_from_dynobj): Likewise.
4089
4090 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4091             Ian Lance Taylor  <iant@google.com>
4092
4093         * symtab.cc (Symbol_table::define_special_symbol): Always
4094         canonicalize version string.
4095
4096 2011-09-26  Cary Coutant  <ccoutant@google.com>
4097
4098         * gold.cc (queue_initial_tasks): Move option checks ...
4099         * options.cc (General_options::finalize): ... to here. Disable
4100         some options; make others fatal.
4101
4102 2011-09-26  Cary Coutant  <ccoutant@google.com>
4103
4104         gcc PR lto/47247
4105         * plugin.cc (get_symbols_v2): New function.
4106         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4107         (is_referenced_from_outside): New function.
4108         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4109         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4110         (get_symbols): Pass version parameter.
4111         (get_symbols_v2): New function.
4112         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4113         parameter.
4114         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4115         (onload): Add LDPT_GET_SYMBOLS_V2.
4116         (all_symbols_read_hook): Use get_symbols_v2; check for
4117         LDPR_PREVAILING_DEF_IRONLY_EXP.
4118         * testsuite/plugin_test_3.sh: Update expected results.
4119
4120 2011-09-23  Simon Baldwin  <simonb@google.com>
4121
4122         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4123         configuration options.
4124         * configure: Regenerate.
4125         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4126         * Makefile.in: Regenerate.
4127         * testsuite/Makefile.in: Regenerate.
4128
4129 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4130
4131         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4132
4133 2011-09-19  Cary Coutant  <ccoutant@google.com>
4134
4135         * incremental.cc (can_incremental_update): Fix typo in comment.
4136         * incremental.h (can_incremental_update): Likewise.
4137
4138 2011-09-18  Cary Coutant  <ccoutant@google.com>
4139
4140         * incremental.cc (can_incremental_update): New function.
4141         * incremental.h (can_incremental_update): New function.
4142         * layout.cc (Layout::init_fixed_output_section): Call it.
4143         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4144         * object.cc (Sized_relobj_file::do_layout): Call
4145         can_incremental_update.
4146
4147 2011-09-13  Cary Coutant  <ccoutant@google.com>
4148
4149         * configure.ac: Check for glibc support for gnu_indirect_function
4150         support with static linking, setting automake conditional
4151         IFUNC_STATIC.
4152         * Makefile.in: Regenerate.
4153         * configure: Regenerate.
4154
4155         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4156         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4157         for IFUNC_STATIC.
4158         * testsuite/Makefile.in: Regenerate.
4159
4160 2011-09-13  Cary Coutant  <ccoutant@google.com>
4161
4162         * incremental.cc (Sized_relobj_incr::do_layout): Call
4163         report_comdat_group for kept comdat sections.
4164         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4165         * testsuite/Makefile.in: Regenerate.
4166         * testsuite/incr_comdat_test_1.cc: New source file.
4167         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4168         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4169         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4170
4171 2011-09-13  Ian Lance Taylor  <iant@google.com>
4172
4173         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4174         variable external_symbols_offset.
4175
4176 2011-09-12  Ian Lance Taylor  <iant@google.com>
4177
4178         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4179         triggered if object has no symbols.
4180
4181 2011-09-09  David S. Miller  <davem@davemloft.net>
4182
4183         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4184         (Output_fill_debug_line::do_write): Likewise.
4185
4186 2011-08-29  Cary Coutant  <ccoutant@google.com>
4187
4188         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4189         casts to match formatting specs.
4190         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4191
4192 2011-08-26  Cary Coutant  <ccoutant@google.com>
4193
4194         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4195         remaining hole size when allocating.
4196         (Layout::make_output_section): Set fill methods for debug sections.
4197         * layout.h (Free_list::Free_list_node): Move from private to
4198         public.
4199         (Free_list::set_min_hole_size): New function.
4200         (Free_list::begin, Free_list::end): New functions.
4201         (Free_list::min_hole_): New data member.
4202         * output.cc: Include dwarf.h.
4203         (Output_fill_debug_info::do_minimum_hole_size): New function.
4204         (Output_fill_debug_info::do_write): New function.
4205         (Output_fill_debug_line::do_minimum_hole_size): New function.
4206         (Output_fill_debug_line::do_write): New function.
4207         (Output_section::Output_section): Initialize new data member.
4208         (Output_section::set_final_data_size): Ensure patch space is larger
4209         than minimum hole size.
4210         (Output_section::do_write): Fill holes in debug sections.
4211         * output.h (Output_fill): New class.
4212         (Output_fill_debug_info): New class.
4213         (Output_fill_debug_line): New class.
4214         (Output_section::set_free_space_fill): New function.
4215         (Output_section::free_space_fill_): New data member.
4216         * testsuite/Makefile.am (incremental_test_3): Add
4217         --incremental-patch option.
4218         (incremental_test_4): Likewise.
4219         (incremental_test_5): Likewise.
4220         (incremental_test_6): Likewise.
4221         (incremental_copy_test): Likewise.
4222         (incremental_common_test_1): Likewise.
4223         * testsuite/Makefile.in: Regenerate.
4224
4225 2011-08-26  Nick Clifton  <nickc@redhat.com>
4226
4227         * po/es.po: Updated Spanish translation.
4228
4229 2011-08-01  Cary Coutant  <ccoutant@google.com>
4230
4231         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4232         * gold/testsuite/Makefile.in: Regenerate.
4233         * gold/testsuite/justsyms_exec.c: New source file.
4234         * gold/testsuite/justsyms_lib.c: New source file.
4235
4236 2011-08-01  Cary Coutant  <ccoutant@google.com>
4237
4238         * layout.cc (Layout::set_segment_offsets): Don't realign text
4239         segment if -Ttext was specified.
4240         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4241         file type.
4242         * object.h (Sized_relobj_file::e_type): New function.
4243         (Sized_relobj_file::e_type_): New data member.
4244         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4245         base address for ET_EXEC files.
4246         * target.cc (Target::do_make_elf_object_implementation): Allow
4247         ET_EXEC files with --just-symbols option.
4248
4249 2011-07-28  Cary Coutant  <ccoutant@google.com>
4250
4251         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4252         Add thread_number parameter.
4253         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4254         * workqueue-threads.cc
4255         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4256         current thread if its thread number is greater than desired thread
4257         count.
4258         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4259         Add thread_number parameter.
4260         (Workqueue::should_cancel_thread): Likewise.
4261         (Workqueue::find_runnable_or_wait): Pass thread_number to
4262         should_cancel_thread.
4263         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4264         parameter.
4265
4266 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4267
4268         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4269         only after checking if it cannot be forced local.
4270         * symtab.h (is_externally_visible): Check if the symbol is not forced
4271         local.
4272
4273 2011-07-15  Ian Lance Taylor  <iant@google.com>
4274
4275         * options.h (class General_options): Add --print-output-format.
4276         Move -EL next to -EB, for  better --help output.
4277         * target-select.cc: Include <cstdio>, "options.h", and
4278         "parameters.h".
4279         (Target_selector::do_target_bfd_name): New function.
4280         (print_output_format): New function.
4281         * target-select.h (class Target_selector): Update declarations.
4282         (Target_selector::target_bfd_name): New function.
4283         (print_output_format): Declare.
4284         * main.cc: Include "target-select.h".
4285         (main): Handle --print-output-format.
4286         * gold.cc: Include "target-select.h".
4287         (queue_initial_tasks): Handle --print-output-format when there are
4288         no input files.
4289         * parameters.cc (parameters_force_valid_target): Give a better
4290         error message if -EB/-EL does not match target.
4291         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4292         function.
4293
4294 2011-07-15  Ian Lance Taylor  <iant@google.com>
4295
4296         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4297         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4298         (Output_data_plt_i386::do_write): Write address of .dynamic
4299         section to first entry in .got.plt section.
4300         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4301         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4302         Initialize layout_.
4303         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4304         section to first entry in .got.plt section.
4305         * layout.h (Layout::dynamic_section): New function.
4306
4307 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4308
4309         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4310         to claim_file call.
4311         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4312         input_section_position_, and input_section_glob_.
4313         (read_layout_from_file): Call function section_ordering_specified.
4314         * layout.h (is_section_ordering_specified): New function.
4315         (section_ordering_specified): New function.
4316         (section_ordering_specified_): New boolean member.
4317         * main.cc(main): Call load_plugins after layout object is defined.
4318         * output.cc (Output_section::add_input_section): Use
4319         function section_ordering_specified to check if section ordering is
4320         needed.
4321         * output.cc (Output_section::add_relaxed_input_section): Use
4322         function section_ordering_specified to check if section ordering is
4323         needed.
4324         (Output_section::update_section_layout): New function.
4325         (Output_section::sort_attached_input_sections): Check if input section
4326         must be reordered.
4327         * output.h (Output_section::update_section_layout): New function.
4328         * plugin.cc (get_section_count): New function.
4329         (get_section_type): New function.
4330         (get_section_name): New function.
4331         (get_section_contents): New function.
4332         (update_section_order): New function.
4333         (allow_section_ordering): New function.
4334         (Plugin::load): Add the new interfaces to the transfer vector.
4335         (Plugin_manager::load_plugins): New parameter.
4336         (Plugin_manager::all_symbols_read): New parameter.
4337         (Plugin_manager::claim_file): New parameter. Save the elf object for
4338         unclaimed objects.
4339         (Plugin_manager::get_elf_object): New function.
4340         (Plugin_manager::get_view): Change to directly use the bool to check
4341         if get_view is called from claim_file_hook.
4342         * plugin.h (input_objects): New function
4343         (Plugin__manager::load_plugins): New parameter.
4344         (Plugin_manager::claim_file): New parameter.
4345         (Plugin_manager::get_elf_object): New function.
4346         (Plugin_manager::in_claim_file_handler): New function.
4347         (Plugin_manager::in_claim_file_handler_): New member.
4348         (layout): New function.
4349         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4350         handler with an extra parameter. Make the elf object before calling
4351         claim_file handler.
4352         * testsuite/plugin_test.c (get_section_count): New function pointer.
4353         (get_section_type): New function pointer.
4354         (get_section_name): New function pointer.
4355         (get_section_contents): New function pointer.
4356         (update_section_order): New function pointer.
4357         (allow_section_ordering): New function pointer.
4358         (onload): Check if the new interfaces exist.
4359
4360 2011-07-13  Ian Lance Taylor  <iant@google.com>
4361
4362         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4363         relro section.
4364         * x86_64.cc (Target_x86_64::got_section): Likewise.
4365         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4366         (relro_now_test_SOURCES): New variable.
4367         (relro_now_test_DEPENDENCIES): New variable.
4368         (relro_now_test_LDFLAGS): New variable.
4369         (relro_now_test_LDADD): New variable.
4370         (relro_now_test.so): New target.
4371         * testsuite/Makefile.in: Rebuild.
4372
4373 2011-07-12  Ian Lance Taylor  <iant@google.com>
4374
4375         PR gold/12980
4376         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4377         GLOB_DAT relocation rather than a RELATIVE relocation for a
4378         protected symbol when creating a shared library.
4379         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4380         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4381         * testsuite/protected_main_1.cc (main): Test that protected
4382         function has same address.
4383
4384 2011-07-11  Ian Lance Taylor  <iant@google.com>
4385
4386         PR gold/12979
4387         * options.h (class General_options): Add -Bgroup.
4388         * options.cc (General_options::finalize): If -Bgroup is set,
4389         default to --unresolved-symbols=report-all.
4390         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4391         * target-reloc.h (issue_undefined_symbol_error): Handle
4392         --unresolved-symbols=report-all.
4393
4394 2011-07-08  Ian Lance Taylor  <iant@google.com>
4395
4396         PR gold/11985
4397         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4398         if linker script discards key sections.
4399         (Layout::create_dynamic_symtab): Likewise.
4400         (Layout::assign_local_dynsym_offsets): Likewise.
4401         (Layout::sized_create_version_sections): Likewise.
4402         (Layout::create_interp): Likewise.
4403         (Layout::finish_dynamic_section): Likewise.
4404         (Layout::set_dynamic_symbol_size): Likewise.
4405
4406 2011-07-08  Ian Lance Taylor  <iant@google.com>
4407
4408         PR gold/12386
4409         * options.h (class General_options): Add --unresolved-symbols.
4410         * target-reloc.h (issue_undefined_symbol_error): Check
4411         --unresolved-symbols.  Add comments.
4412
4413 2011-07-08  Ian Lance Taylor  <iant@google.com>
4414
4415         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4416         expression more complex.
4417
4418 2011-07-08  Ian Lance Taylor  <iant@google.com>
4419
4420         PR gold/11317
4421         * target-reloc.h (issue_undefined_symbol_error): New inline
4422         function, broken out of relocate_section.
4423         (relocate_section): Call issue_undefined_symbol_error.
4424         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4425         there is no TLS segment if we are about to issue an undefined
4426         symbol error.
4427         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4428
4429 2011-07-08  Ian Lance Taylor  <iant@google.com>
4430
4431         PR gold/12279
4432         * resolve.cc (Symbol_table::should_override): Add fromtype
4433         parameter.  Change all callers.  Give error when linking together
4434         TLS and non-TLS symbol.
4435         (Symbol_table::should_override_with_special): Add fromtype
4436         parameter.  Change all callers.
4437         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4438         there is no TLS segment if we have reported some errors.
4439         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4440
4441 2011-07-08  Ian Lance Taylor  <iant@google.com>
4442
4443         PR gold/12372
4444         * target.h (Target::plt_address_for_global): New function.
4445         (Target::plt_address_for_local): New function.
4446         (Target::plt_section_for_global): Remove.
4447         (Target::plt_section_for_local): Remove.
4448         (Target::do_plt_address_for_global): New virtual function.
4449         (Target::do_plt_address_for_local): New virtual function.
4450         (Target::do_plt_section_for_global): Remove.
4451         (Target::do_plt_section_for_local): Remove.
4452         (Target::register_global_plt_entry): Add Symbol_table and Layout
4453         parameters.
4454         * output.cc (Output_data_got::Got_entry::write): Use
4455         plt_address_for_global and plt_address_for_local.
4456         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4457         address of output section.
4458         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4459         got_irelative_, and irelative_count_ fields.  Update
4460         declarations.
4461         (Output_data_plt_i386::has_irelative_section): New function.
4462         (Output_data_plt_i386::entry_count): Add irelative_count_.
4463         (Output_data_plt_i386::set_final_data_size): Likewise.
4464         (class Target_i386): Add got_irelative_ and rel_irelative_
4465         fields.  Update declarations.
4466         (Target_i386::Target_i386): Initialize new fields.
4467         (Target_i386::do_plt_address_for_global): New function replacing
4468         do_plt_section_for_global.
4469         (Target_i386::do_plt_address_for_local): New function replacing
4470         do_plt_section_for_local.
4471         (Target_i386::got_section): Create got_irelative_.
4472         (Target_i386::rel_irelative_section): New function.
4473         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4474         fields.  Don't define __rel_iplt_{start,end}.
4475         (Output_data_plt_i386::add_entry): Add symtab and layout
4476         parameters.  Change all callers.  Use different PLT and GOT for
4477         IFUNC symbols.
4478         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4479         layout parameters.  Change all callers.  Use different PLT and
4480         GOT.
4481         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4482         (Output_data_plt_i386::rel_irelative): New function.
4483         (Output_data_plt_i386::address_for_global): New function.
4484         (Output_data_plt_i386::address_for_local): New function.
4485         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4486         IRELATIVE GOT when changing IFUNC GOT entries.
4487         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4488         reloc.
4489         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4490         if we didn't create an IRELATIVE GOT.
4491         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4492         plt_address_for_local.
4493         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4494         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4495         got_irelative_, and irelative_count_ fields.  Update
4496         declarations.
4497         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4498         Initialize new fields.  Remove symtab parameter.  Change all
4499         callers.
4500         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4501         irelative_count_.
4502         (Output_data_plt_x86_64::has_irelative_section): New function.
4503         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4504         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4505         fields.  Update declarations.
4506         (Target_x86_64::Target_x86_64): Initialize new fields.
4507         (Target_x86_64::do_plt_address_for_global): New function replacing
4508         do_plt_section_for_global.
4509         (Target_x86_64::do_plt_address_for_local): New function replacing
4510         do_plt_section_for_local.
4511         (Target_x86_64::got_section): Create got_irelative_.
4512         (Target_x86_64::rela_irelative_section): New function.
4513         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4514         all callers.  Don't create __rel_iplt_{start,end}.
4515         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4516         parameters.  Change all callers.  Use different PLT and GOT for
4517         IFUNC symbols.
4518         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4519         layout parameters.  Change all callers.  Use different PLT and
4520         GOT.
4521         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4522         parameters.  Change all callers.  Use different PLT and GOT for
4523         IFUNC symbols.
4524         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4525         (Output_data_plt_x86_64::rela_irelative): New function.
4526         (Output_data_plt_x86_64::address_for_global): New function.
4527         (Output_data_plt_x86_64::address_for_local): New function.
4528         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4529         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4530         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4531         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4532         parameters.
4533         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4534         reloc.
4535         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4536         symbols if we didn't create an IRELATIVE GOT.
4537         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4538         plt_address_for_local.
4539         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4540         * testsuite/ifuncvar1.c: New test file.
4541         * testsuite/ifuncvar2.c: New test file.
4542         * testsuite/ifuncvar3.c: New test file.
4543         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4544         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4545         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4546         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4547         * testsuite/Makefile.in: Rebuild.
4548
4549 2011-07-07  Cary Coutant  <ccoutant@google.com>
4550
4551         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4552         (two_file_test_1_ndebug.o): Likewise.
4553         (two_file_test_1b_ndebug.o): Likewise.
4554         (two_file_test_2_ndebug.o): Likewise.
4555         (two_file_test_main_ndebug.o): Likewise.
4556         (incremental_test_2): Link with no-debug versions.
4557
4558 2011-07-06  Cary Coutant  <ccoutant@google.com>
4559
4560         * gold/incremental.cc
4561         (Output_section_incremental_inputs::write_info_blocks): Check for
4562         hidden and internal symbols.
4563
4564 2011-07-06  Cary Coutant  <ccoutant@google.com>
4565
4566         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4567         Check disposition for startup file.
4568         (Incremental_inputs::report_command_line): Ignore
4569         --incremental-startup-unchanged option.
4570         * options.cc (General_options::parse_incremental_startup_unchanged):
4571         New function.
4572         (General_options::General_options): Initialize new data member.
4573         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4574         (General_options): Add --incremental-startup-unchanged option.
4575         (General_options::incremental_startup_disposition): New function.
4576         (General_options::incremental_startup_disposition_): New data member.
4577
4578 2011-07-06  Cary Coutant  <ccoutant@google.com>
4579
4580         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4581         input file index to Script_info ctor.
4582         (Sized_incremental_binary::do_file_has_changed): Find the
4583         command-line argument for files named in scripts.
4584         * incremental.h (Script_info::Script_info): New ctor
4585         with input file index.
4586         (Script_info::input_file_index): New function.
4587         (Script_info::input_file_index_): New data member.
4588         (Incremental_binary::get_library): Add const.
4589         (Incremental_binary::get_script_info): Add const.
4590         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4591         * testsuite/Makefile.am (incremental_test_5): New test case.
4592         (incremental_test_6): New test case.
4593         * testsuite/Makefile.in: Regenerate.
4594
4595 2011-07-06  Cary Coutant  <ccoutant@google.com>
4596
4597         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4598         debug output when command lines differ.
4599
4600 2011-07-06  Cary Coutant  <ccoutant@google.com>
4601
4602         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4603         --incremental-patch option.
4604         * layout.cc (Free_list::allocate): Extend allocation beyond original
4605         end if enabled.
4606         (Layout::make_output_section): Mark sections that should get
4607         patch space.
4608         * options.cc (parse_percent): New function.
4609         * options.h (parse_percent): New function.
4610         (DEFINE_percent): New macro.
4611         (General_options): Add --incremental-patch option.
4612         * output.cc (Output_section::Output_section): Initialize new data
4613         members.
4614         (Output_section::add_input_section): Print section name when out
4615         of patch space.
4616         (Output_section::add_output_section_data): Likewise.
4617         (Output_section::set_final_data_size): Add patch space when
4618         doing --incremental-full.
4619         (Output_section::do_reset_address_and_file_offset): Remove patch
4620         space.
4621         (Output_segment::set_section_list_addresses): Print debug output
4622         only if --incremental-update.
4623         * output.h (Output_section::set_is_patch_space_allowed): New function.
4624         (Output_section::is_patch_space_allowed_): New data member.
4625         (Output_section::patch_space_): New data member.
4626         * parameters.cc (Parameters::incremental_full): New function.
4627         * parameters.h (Parameters::incremental_full): New function
4628         * testsuite/Makefile.am (incremental_test_2): Add test for
4629         --incremental-patch option.
4630         * testsuite/Makefile.in: Regenerate.
4631         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4632         (t18): Remove function body.
4633
4634 2011-07-05  Doug Kwan  <dougkwan@google.com>
4635
4636         PR gold/12771
4637         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4638         Arm_Address type for relocation result.
4639         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4640         overflow check.
4641         (Arm_relocate_functions::abs32): Use unaligned access.
4642         (Arm_relocate_functions::rel32): Ditto.
4643         (Arm_relocate_functions::prel31): Ditto.
4644         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4645         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4646         static data relocations.
4647         * testsuite/Makefile.in: Regnerate.
4648         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4649
4650 2011-07-05  Ian Lance Taylor  <iant@google.com>
4651
4652         PR gold/12392
4653         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4654         symbols if necessary.
4655         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4656
4657 2011-07-05  Ian Lance Taylor  <iant@google.com>
4658
4659         PR gold/12952
4660         * resolve.cc (Symbol::override_base_with_special): Simply override
4661         version with special symbol version, ignoring previous version.
4662
4663 2011-07-05  Ian Lance Taylor  <iant@google.com>
4664
4665         * object.cc (Sized_relobj_file::include_section_group): Add
4666         information to comment about signature location.
4667
4668 2011-07-02  Ian Lance Taylor  <iant@google.com>
4669
4670         PR gold/12957
4671         * options.h (class General_options): Add -f and -F.
4672         * options.cc (General_options::finalize): Fatal error if -f/-F
4673         are used without -shared.
4674         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4675
4676 2011-07-02  Ian Lance Taylor  <iant@google.com>
4677
4678         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4679
4680 2011-07-01  Ian Lance Taylor  <iant@google.com>
4681
4682         PR gold/12525
4683         PR gold/12952
4684         * resolve.cc (Symbol::override_base_with_special): Don't override
4685         the version if the overriding symbol has a different name.
4686         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4687         all callers.  If we give an error about an undefined version,
4688         define the base version if necessary.
4689         * dynobj.h (class Versions): Update declaration.
4690         * testsuite/weak_alias_test_5.cc: New file.
4691         * testsuite/weak_alias_test.script: New file.
4692         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4693         and versioned_alias have the right value, and call t2.
4694         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4695         weak_alias_test_5.so.
4696         (weak_alias_test_LDADD): Likewise.
4697         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4698         * testsuite/Makefile.in: Rebuild.
4699
4700 2011-07-01  Ian Lance Taylor  <iant@google.com>
4701
4702         PR gold/12525
4703         * options.h (class General_options): Support -z notext.
4704         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4705         -Wl,-z,notext.
4706         (two_file_shared_nonpic.so): Likewise.
4707         (two_file_shared_mixed.so): Likewise.
4708         (two_file_shared_mixed_1.so): Likewise.
4709         (weak_undef_lib_nonpic.so): Likewise.
4710         (alt/weak_undef_lib_nonpic.so): Likewise.
4711         (tls_test_shared_nonpic.so): Likewise.
4712         * testsuite/Makefile.in: Rebuild.
4713
4714 2011-07-01  Ian Lance Taylor  <iant@google.com>
4715
4716         PR gold/12525
4717         * configure.ac: Test whether static linking works, setting
4718         the automake conditional HAVE_STATIC.
4719         * testsuite/Makefile.am: Disable tests using -static if
4720         HAVE_STATIC is not true.
4721         * configure, testsuite/Makefile.in: Rebuild.
4722
4723 2011-07-01  Ian Lance Taylor  <iant@google.com>
4724
4725         PR gold/12525
4726         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4727         Assert if we see DW_EH_PE_indirect.
4728         * target.h (Target::ehframe_datarel_base): New function.
4729         (Target::do_ehframe_datarel_base): New target function.
4730         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4731         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4732         function.
4733
4734 2011-07-01  Ian Lance Taylor  <iant@google.com>
4735
4736         PR gold/12571
4737         * options.h (class General_options): Add
4738         --ld-generated-unwind-info.
4739         * ehframe.cc (Fde::write): Add address parameter.  Change all
4740         callers.  If associated with PLT, fill in address and size.
4741         (Cie::set_output_offset): Only add merge mapping if there is an
4742         object.
4743         (Cie::write): Add address parameter.  Change all callers.
4744         (Eh_frame::add_ehframe_for_plt): New function.
4745         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4746         input_offset_ fields into union u_, with new plt field.
4747         (Fde::Fde): Adjust for new union field.
4748         (Fde::Fde) [Output_data version]: New constructor.
4749         (Fde::add_mapping): Only add merge mapping if there is an object.
4750         (class Cie): Update declarations.
4751         (class Eh_frame): Declare add_ehframe_for_plt.
4752         * layout.cc (Layout::layout_eh_frame): Break out code into
4753         make_eh_frame_section, and call it.
4754         (Layout::make_eh_frame_section): New function.
4755         (Layout::add_eh_frame_for_plt): New function.
4756         * layout.h (class Layout): Update declarations.
4757         * merge.cc (Merge_map::add_mapping): Add assertion.
4758         * i386.cc: Include "dwarf.h".
4759         (class Output_data_plt_i386): Make first_plt_entry,
4760         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4761         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4762         and plt_eh_frame_fde.
4763         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4764         boundary.  Call add_eh_frame_for_plt if appropriate.
4765         * x86_64.cc: Include "dwarf.h".
4766         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4767         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4768         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4769         and plt_eh_frame_fde.
4770         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4771         appropriate.
4772
4773 2011-06-29  Ian Lance Taylor  <iant@google.com>
4774
4775         PR gold/12629
4776         * object.cc (Sized_relobj_file::layout_section): Change shdr
4777         parameter to be const.
4778         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4779         out of do_layout.
4780         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4781         appropriate.  Call layout_eh_frame_section.
4782         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4783         sections.
4784         * object.h (class Sized_relobj_file): Update declarations.
4785
4786 2011-06-29  Ian Lance Taylor  <iant@google.com>
4787
4788         PR gold/12652
4789         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4790         modifier.
4791         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4792
4793 2011-06-29  Ian Lance Taylor  <iant@google.com>
4794
4795         PR gold/12675
4796         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4797         SHT_X86_64_UNWIND.
4798         * layout.cc (Layout::layout_eh_frame): Likewise.
4799
4800 2011-06-29  Ian Lance Taylor  <iant@google.com>
4801
4802         PR gold/12695
4803         * layout.cc (Layout::symtab_section_shndx): New function.
4804         * layout.h (class Layout): Declare symtab_section_shndx.
4805         * output.cc (Output_section::write_header): Call it.
4806
4807 2011-06-29  Ian Lance Taylor  <iant@google.com>
4808
4809         PR gold/12818
4810         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4811         symbols which are not used in a relocation.
4812
4813 2011-06-28  Ian Lance Taylor  <iant@google.com>
4814
4815         PR gold/12898
4816         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4817         script create indistinguishable segments.
4818         (Layout::set_segment_offsets): Use stable_sort when sorting
4819         segments.  Pass this to Compare_segments constructor.
4820         * layout.h (class Layout): Make segment_precedes non-static.
4821         (class Compare_segments): Change from struct to class.  Add
4822         layout_ field.  Add constructor.
4823         * script-sections.cc
4824         (Script_sections::attach_sections_using_phdrs_clause): Rename
4825         local orphan to is_orphan.  Don't report failure to put empty
4826         section in segment.  On attachment failure, report name of
4827         section, and attach to first PT_LOAD segment.
4828
4829 2011-06-28  Ian Lance Taylor  <iant@google.com>
4830
4831         PR gold/12934
4832         * target-select.cc (Target_selector::Target_selector): Add
4833         emulation parameter.  Change all callers.
4834         (select_target_by_bfd_name): Rename from select_target_by_name.
4835         Change all callers.
4836         (select_target_by_emulation): New function.
4837         (supported_emulation_names): New function.
4838         * target-select.h (class Target_selector): Add emulation_ field.
4839         Update declarations.
4840         (Target_selector::recognize_by_bfd_name): Rename from
4841         recognize_by_name.  Change all callers.
4842         (Target_selector::supported_bfd_names): Rename from
4843         supported_names.  Change all callers.
4844         (Target_selector::recognize_by_emulation): New function.
4845         (Target_selector::supported_emulations): New function.
4846         (Target_selector::emulation): New function.
4847         (Target_selector::do_recognize_by_bfd_name): Rename from
4848         do_recognize_by_name.  Change all callers.
4849         (Target_selector::do_supported_bfd_names): Rename from
4850         do_supported_names.  Change all callers.
4851         (Target_selector::do_recognize_by_emulation): New function.
4852         (Target_selector::do_supported_emulations): New function.
4853         (select_target_by_bfd_name): Change name in declaration.
4854         (select_target_by_emulation): Declare.
4855         (supported_emulation_names): Declare.
4856         * parameters.cc (parameters_force_valid_target): Try to find
4857         target based on emulation from -m option.
4858         * options.h (class General_options): Change doc string for -m.
4859         * options.cc (help): Print emulations.
4860         (General_options::parse_V): Likewise.
4861         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4862         Add emulation parameter.  Change all callers.
4863
4864 2011-06-28  Ian Lance Taylor  <iant@google.com>
4865
4866         * target.h (class Target): Add osabi_ field.
4867         (Target::osabi): New function.
4868         (Target::set_osabi): New function.
4869         (Target::Target): Initialize osabi_.
4870         (Target::do_adjust_elf_header): Make pure virtual.
4871         (Sized_target::do_adjust_elf_header): Declare.
4872         * target.cc (Sized_target::do_adjust_elf_header): New function.
4873         (class Sized_target): Instantiate all versions.
4874         * freebsd.h (class Target_freebsd): Remove.
4875         (Target_selector_freebsd::do_recognize): Call set_osabi on
4876         Target.
4877         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4878         (Target_selector_freebsd::set_osabi): Remove.
4879         * i386.cc (class Target_i386): Inherit from Sized_target rather
4880         than Target_freebsd.
4881         * x86_64.cc (class Target_x86_64): Likewise.
4882
4883 2011-06-28  Ian Lance Taylor  <iant@google.com>
4884
4885         * target.h (Target::can_check_for_function_pointers): Rewrite.
4886         Make non-virtual.
4887         (Target::can_icf_inline_merge_sections): Likewise.
4888         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4889         (Target::Target_info): Add can_icf_inline_merge_sections field.
4890         (Target::do_can_check_for_function_pointers): New virtual
4891         function.
4892         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4893         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4894         from can_check_for_function_pointers, move in file.
4895         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4896         section_may_have_icf_unsafe_poineters, move in file.
4897         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4898         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4899         Rename from can_check_for_function_pointers, move in file.
4900         (Target_i386::can_icf_inline_merge_sections): Remove.
4901         (Target_i386::i386_info): Initialize
4902         can_icf_inline_merge_sections.
4903         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4904         Initialize can_icf_inline_merge_sections.
4905         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4906         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4907         Rename from can_check_for_function_pointers, move in file.
4908         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4909         (Target_x86_64::x86_64_info): Initialize
4910         can_icf_inline_merge_sections.
4911         * testsuite/testfile.cc (Target_test::test_target_info):
4912         Likewise.
4913         * icf.cc (get_section_contents): Correct formatting.
4914
4915 2011-06-27  Ian Lance Taylor  <iant@google.com>
4916
4917         * symtab.cc (Symbol::versioned_name): New function.
4918         (Symbol_table::add_to_final_symtab): Use versioned_name when
4919         appropriate.
4920         (Symbol_table::sized_write_symbol): Likewise.
4921         * symtab.h (class Symbol): Declare versioned_name.
4922         * stringpool.h (class Stringpool_template): Add variant of add
4923         which takes a std::basic_string.
4924         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4925         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4926         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4927         (ver_test_12.o): New target.
4928         * testsuite/Makefile.in: Rebuild.
4929
4930 2011-06-27  Doug Kwan  <dougkwan@google.com>
4931
4932         * arm.cc (Arm_relocate_functions::thm_jump8,
4933         Arm_relocate_functions::thm_jump11): Use a wider signed
4934         type to compute offset.
4935         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4936         arm_thm_jump8.
4937         * testsuite/Makefile.in: Regenerate.
4938         * testsuite/arm_branch_in_range.sh: Check test results of
4939         arm_thm_jump11 and arm_thm_jump8.
4940         * testsuite/arm_thm_jump11.s: New test source file.
4941         * testsuite/arm_thm_jump11.t: New linker script.
4942         * testsuite/arm_thm_jump8.s: New test source file.
4943         * testsuite/arm_thm_jump8.t: New linker script.
4944
4945 2011-06-24  Ian Lance Taylor  <iant@google.com>
4946
4947         * layout.cc: Include "object.h".
4948         (ctors_sections_in_init_array): New static variable.
4949         (Layout::is_ctors_in_init_array): New function.
4950         (Layout::layout): Add entry to ctors_sections_in_init_array if
4951         appropriate.
4952         * layout.h (class Layout): Declare is_ctors_in_init_array.
4953         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4954         is_ctors_reverse_view is set.
4955         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4956         all callers.  Set is_ctors_reverse_view field of View_size.
4957         (Sized_relobj_file::reverse_words): New function.
4958         * object.h (Sized_relobj_file::View_size): Add
4959         is_ctors_reverse_view field.
4960         (class Sized_relobj_file): Update declarations.
4961         * testsuite/initpri3.c: New test.
4962         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4963         initpri3b.
4964         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4965         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4966         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4967         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4968         * testsuite/Makefile.in: Rebuild.
4969
4970 2011-06-24  Cary Coutant  <ccoutant@google.com>
4971
4972         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4973         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4974         (debug_msg_cdebug.err): New targets.
4975         * testsuite/Makefile.in: Regenerate.
4976         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4977         Fix checks for link with shared library.
4978
4979 2011-06-24  Doug Kwan  <dougkwan@google.com>
4980
4981         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4982         skip empty text sections.
4983         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4984
4985 2011-06-22  Ian Lance Taylor  <iant@google.com>
4986
4987         PR gold/12910
4988         * options.h (class General_options): Add --ctors-in-init-array.
4989         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4990         friends as SHT_PROGBITS for merging sections.
4991         (Layout::layout): Remove special handling of .init_array and
4992         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4993         and .dtors if ctors_in_init_array.
4994         (Layout::make_output_section): Force correct section types for
4995         .init_array and friends.  Don't sort if doing relocatable link,
4996         Don't sort .ctors and .dtors if ctors_in_init_array.
4997         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4998         (Layout::output_section_name): Add relobj parameter.  Change all
4999         callers.  Handle .ctors. and .dtors. in code rather than table.
5000         Handle .ctors and .dtors if ctors_in_init_array.
5001         (Layout::match_file_name): New function, moved from output.cc.
5002         * layout.h (class Layout): Update declarations.
5003         * output.cc: Include "layout.h".
5004         (Input_section_sort_entry::get_priority): New function.
5005         (Input_section_sort_entry::match_file_name): Just call
5006         Layout::match_file_name.
5007         (Output_section::Input_section_sort_init_fini_compare::operator()):
5008         Handle .ctors and .dtors.  Sort by explicit priority rather than
5009         by name.
5010         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5011         * testsuite/initpri2.c: New test.
5012         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5013         (check_PROGRAMS): Add initpri2.
5014         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5015         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5016         * configure, testsuite/Makefile.in: Rebuild.
5017
5018 2011-06-19  Ian Lance Taylor  <iant@google.com>
5019
5020         PR gold/12880
5021         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5022         .interp section to a PT_INTERP segment even if we have seen a
5023         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5024         clause in a linker script.
5025         (Layout::finalize): Don't create a .interp section if we've
5026         already create a PT_INTERP segment.
5027         (Layout::create_interp): Always call choose_output_section (revert
5028         patch of 2011-06-17).  Don't create PT_INTERP segment.
5029         * script-sections.cc
5030         (Script_sections::create_note_and_tls_segments): Add a .interp
5031         section to a PT_INTERP segment even if we have seen a
5032         --dynamic-linker option.
5033
5034 2011-06-18  Ian Lance Taylor  <iant@google.com>
5035
5036         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5037         merely because a non-PT_LOAD segment has a dynamic reloc.
5038
5039 2011-06-18  Ian Lance Taylor  <iant@google.com>
5040
5041         * layout.cc (Layout::finish_dynamic_section): Don't create
5042         DT_FLAGS entry if not needed.
5043
5044 2011-06-18  Ian Lance Taylor  <iant@google.com>
5045
5046         PR gold/12745
5047         * layout.cc (Layout::layout_eh_frame): Correct handling of
5048         writable .eh_frame section.
5049
5050 2011-06-17  Ian Lance Taylor  <iant@google.com>
5051
5052         PR gold/12893
5053         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5054         symbol is redefined with the exact same object and value.
5055
5056 2011-06-17  Ian Lance Taylor  <iant@google.com>
5057
5058         PR gold/12880
5059         * layout.h (class Layout): Add interp_segment_ field.
5060         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5061         (Layout::attach_allocated_section_to_segment): If making shared
5062         library, put .interp section in PT_INTERP segment.
5063         (Layout::finalize): Also call create_interp if -dynamic-linker
5064         option was used.
5065         (Layout::create_interp): Assert that there is no PT_INTERP
5066         segment.  If not using a SECTIONS clause, use make_output_section.
5067         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5068         * script-sections.cc
5069         (Script_sections::create_note_and_tls_segments): If making shared
5070         library, put .interp section in PT_INTERP segment.
5071
5072 2011-06-17  Ian Lance Taylor  <iant@google.com>
5073
5074         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5075         when making a shared library.
5076
5077 2011-06-17  Ian Lance Taylor  <iant@google.com>
5078
5079         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5080         parameter.  Change all callers.  Don't issue warning about PC32
5081         against locally defined symbol.
5082
5083 2011-06-16  Ian Lance Taylor  <iant@google.com>
5084
5085         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5086         occurs in same object.
5087
5088 2011-06-14  Alan Modra  <amodra@gmail.com>
5089
5090         * po/POTFILES.in: Regenerate.
5091
5092 2011-06-09  Ian Lance Taylor  <iant@google.com>
5093
5094         * script-sections.cc
5095         (Orphan_output_section::set_section_addresses): For a relocatable
5096         link set address to 0.
5097
5098 2011-06-09  Cary Coutant  <ccoutant@google.com>
5099
5100         PR gold/12804
5101         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5102         used with --compress-debug-sections.
5103         * gold/object.cc (Sized_relobj_file::do_layout): Report
5104         uncompressed size of compressed input sections.
5105
5106 2011-06-08  Cary Coutant  <ccoutant@google.com>
5107
5108         PR gold/12804
5109         * testsuite/two_file_test_2_v1.cc: Change initialization of
5110         v2 to keep it in .data.
5111
5112 2011-06-07  Cary Coutant  <ccoutant@google.com>
5113
5114         * common.cc (Symbol_table::do_allocate_commons_list): Call
5115         gold_fallback.
5116         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5117         (Errors::fallback): New function.
5118         (gold_fallback): New function.
5119         * errors.h (Errors::fallback): New function.
5120         * gold.cc (gold_exit): Change status parameter to enum; adjust
5121         all callers.
5122         (queue_initial_tasks): Call gold_fallback.
5123         * gold.h: Include cstdlib.
5124         (Exit_status): New enum type.
5125         (gold_exit): Change status parameter to enum.
5126         (gold_fallback): New function.
5127         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5128         (Layout::create_symtab_sections): Likewise.
5129         (Layout::create_shdrs): Likewise.
5130         * main.cc (main): Adjust call to gold_exit.
5131         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5132         (Output_data_got::add_got_entry_pair): Likewise.
5133         (Output_section::add_input_section): Likewise.
5134         (Output_section::add_output_section_data): Likewise.
5135         (Output_segment::set_section_list_addresses): Likewise.
5136         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5137
5138 2011-06-07  Cary Coutant  <ccoutant@google.com>
5139
5140         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5141         for incremental links.
5142         * output.cc (Output_segment::set_section_list_addresses): Remove
5143         FIXME and test for TLS or BSS.
5144
5145 2011-06-07  Cary Coutant  <ccoutant@google.com>
5146
5147         * testsuite/Makefile.am: Add incremental_copy_test,
5148         incremental_common_test_1.
5149         * testsuite/Makefile.in: Regenerate.
5150         * testsuite/common_test_1_v1.c: New source file.
5151         * testsuite/common_test_1_v2.c: New source file.
5152         * testsuite/copy_test_v1.cc: New source file.
5153
5154 2011-06-07  Cary Coutant  <ccoutant@google.com>
5155
5156         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5157         update, allocate common from bss section's free list.
5158         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5159         linker-defined symbols.
5160         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5161         Skip GOT and PLT entries that are no longer referenced.
5162         (Output_section_incremental_inputs::write_info_blocks): Mark
5163         linker-defined symbols.
5164         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5165         * output.cc (Output_section::allocate): New function.
5166         * output.h (Output_section::allocate): New function.
5167         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5168         linker-defined symbols.
5169         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5170         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5171         (Symbol::init_base_output_data): Likewise.
5172         (Symbol::init_base_output_segment): Likewise.
5173         (Symbol::init_base_constant): Likewise.
5174         (Sized_symbol::init_output_data): Likewise.
5175         (Sized_symbol::init_output_segment): Likewise.
5176         (Sized_symbol::init_constant): Likewise.
5177         (Symbol_table::do_define_in_output_data): Likewise.
5178         (Symbol_table::do_define_in_output_segment): Likewise.
5179         (Symbol_table::do_define_as_constant): Likewise.
5180         * symtab.h (Symbol::is_predefined): New function.
5181         (Symbol::init_base_output_data): Add is_predefined parameter.
5182         (Symbol::init_base_output_segment): Likewise.
5183         (Symbol::init_base_constant): Likewise.
5184         (Symbol::is_predefined_): New data member.
5185         (Sized_symbol::init_output_data): Add is_predefined parameter.
5186         (Sized_symbol::init_output_segment): Likewise.
5187         (Sized_symbol::init_constant): Likewise.
5188         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5189
5190 2011-06-07  Cary Coutant  <ccoutant@google.com>
5191
5192         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5193         instead of emit_copy_reloc.
5194         (Copy_relocs::emit_copy_reloc): Refactor.
5195         (Copy_relocs::make_copy_reloc): New function.
5196         (Copy_relocs::add_copy_reloc): Remove.
5197         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5198         section.
5199         (Copy_relocs::make_copy_reloc): New function.
5200         (Copy_relocs::add_copy_reloc): Remove.
5201         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5202         unchanged input files.
5203         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5204         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5205         Reserve BSS space for COPY relocations.
5206         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5207         (Output_section_incremental_inputs::write_info_blocks): Record
5208         whether a symbol is copied from a shared object.
5209         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5210         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5211         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5212         (Incremental_input_entry_reader::get_output_symbol_index): Add
5213         is_copy parameter.
5214         (Incremental_binary::emit_copy_relocs): New function.
5215         (Incremental_binary::do_emit_copy_relocs): New function.
5216         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5217         new data member.
5218         (Sized_incremental_binary::add_copy_reloc): New function.
5219         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5220         (Sized_incremental_binary::Copy_reloc): New struct.
5221         (Sized_incremental_binary::Copy_relocs): New typedef.
5222         (Sized_incremental_binary::copy_relocs_): New data member.
5223         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5224         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5225         * target.h (Sized_target::emit_copy_reloc): New function.
5226         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5227
5228 2011-06-02  Cary Coutant  <ccoutant@google.com>
5229
5230         PR gold/12163
5231         * gold/archive.cc (Archive::Archive): Initialize new data member.
5232         (Archive::include_all_members): Return if archive has already been
5233         included.
5234         * gold/archive.h (Archive::include_all_members_): New data member.
5235
5236 2011-06-02  Nick Clifton  <nickc@redhat.com>
5237
5238         * dynobj.h: Fix spelling mistake in comment.
5239         * output.cc: Likewise.
5240
5241 2011-05-31  Doug Kwan  <dougkwan@google.com>
5242             Asier Llano
5243
5244         PR gold/12826
5245         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5246         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5247         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5248         redundant arm_exidx_test.so.
5249         * testsuite/Makefile.in: Regenerate.
5250         (check_SCRIPTS): Add pr12826.sh
5251         (check_DATA): Add pr12826.stdout
5252         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5253         * testsuite/pr12826.sh: New file.
5254         * testsuite/pr12826_1.s: Ditto.
5255         * testsuite/pr12826_1.s: Ditto.
5256
5257 2011-05-30  Ian Lance Taylor  <iant@google.com>
5258
5259         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5260         sections.
5261
5262 2011-05-29  Ian Lance Taylor  <iant@google.com>
5263
5264         PR gold/12804
5265         * testsuite/Makefile.am: Use different file name for two_file_test
5266         temporary file for each incremental test.
5267         * testsuite/Makefile.in: Rebuild.
5268
5269 2011-05-29  Ian Lance Taylor  <iant@google.com>
5270
5271         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5272         binary input file is empty.
5273
5274 2011-05-27  Ian Lance Taylor  <iant@google.com>
5275
5276         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5277         (ver_test_9.so): Likewise.
5278         * testsuite/Makefile.in: Rebuild.
5279
5280 2011-05-26 Cary Coutant  <ccoutant@google.com>
5281
5282         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5283         * incremental.cc (Incremental_inputs::report_input_section): Fix
5284         comment, indentation.
5285         (Incremental_inputs::report_comdat_group): New function.
5286         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5287         of data for incremental input file entry.
5288         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5289         group count, COMDAT group signatures.
5290         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5291         an unchanged input file.
5292         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5293         Initialize new data member.
5294         (Incremental_object_entry::add_comdat_group): New function.
5295         (Incremental_object_entry::get_comdat_group_count): New function.
5296         (Incremental_object_entry::get_comdat_signature_key): New function.
5297         (Incremental_object_entry::groups_): New data member.
5298         (Incremental_inputs::report_comdat_group): New function.
5299         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5300         data for incremental input file entry.
5301         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5302         (Incremental_input_entry_reader::get_input_section): Adjust size of
5303         data for incremental input file entry.
5304         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5305         (Incremental_input_entry_reader::get_comdat_group_signature): New
5306         function.
5307         * object.cc (Sized_relobj::include_section_group): Report kept
5308         COMDAT groups for incremental links.
5309
5310 2011-05-24  David Meyer  <pdox@google.com>
5311
5312         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5313         with name parameter.  Add found_name parameter.
5314         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5315         * dirsearch.h (class Dirsearch): Update declaration.
5316
5317 2011-05-24  Ian Lance Taylor  <iant@google.com>
5318
5319         * archive.cc (Library_base::should_include_member): Pull in object
5320         from archive if it defines the entry symbol.
5321         * parameters.cc (Parameters::entry): New function.
5322         * parameters.h (class Parameters): Declare entry.
5323         * output.h (class Output_file_header): Remove entry_ field.
5324         * output.cc (Output_file_header::Output_file_header): Remove entry
5325         parameter.  Change all callers.
5326         (Output_file_header::entry): Use parameters->entry.
5327         * gold.cc (queue_middle_tasks): Likewise.
5328         * plugin.cc (Plugin_hook::run): Likewise.
5329
5330 2011-05-24 Cary Coutant  <ccoutant@google.com>
5331
5332         * gold.cc (queue_initial_tasks): Pass incremental base filename
5333         to Output_file::open_base_file; don't print error message.
5334         * incremental-dump.cc (main): Adjust call to
5335         Output_file::open_for_modification.
5336         * incremental-dump.cc (main): Likewise.
5337         * incremental.cc (Incremental_inputs::report_command_line):
5338         Ignore --incremental-base option when comparing command lines.
5339         Ignore parameter when given as separate argument.
5340         * options.h (class General_options): Add --incremental-base.
5341         * output.cc (Output_file::Output_file):
5342         (Output_file::open_base_file): Add base_name and writable parameters;
5343         read base file into new file; print error message here.
5344         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5345         callers.
5346         * output.h (Output_file::open_for_modification): Rename to...
5347         (Output_file::open_base_file): ...this; add base_name and
5348         writable parameters; adjust all callers.
5349         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5350         callers.
5351         * testsuite/Makefile.am (incremental_test_4): Test
5352         --incremental-base.
5353         * testsuite/Makefile.in: Regenerate.
5354
5355 2011-05-24 Cary Coutant  <ccoutant@google.com>
5356
5357         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5358         incremental_test_4.
5359         * testsuite/Makefile.in: Regenerate.
5360         * testsuite/two_file_test_1_v1.cc: New test source file.
5361         * testsuite/two_file_test_1b_v1.cc: New test source file.
5362         * testsuite/two_file_test_2_v1.cc: New test source file.
5363
5364 2011-05-24 Cary Coutant  <ccoutant@google.com>
5365
5366         * dynobj.h (Dynobj::do_dynobj): New function.
5367         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5368         flag and soname for shared objects.
5369         * incremental.cc (Incremental_inputs::report_object): Make
5370         either Incremental_object_entry or Incremental_dynobj_entry; add
5371         soname to string table.
5372         (Incremental_inputs::report_input_section): Add assertion.
5373         (Output_section_incremental_inputs::set_final_data_size): Adjust
5374         type of input file entry for shared libraries; adjust size of
5375         shared library info entry.
5376         (Output_section_incremental_inputs::write_input_files): Write
5377         as_needed flag for shared libraries.
5378         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5379         of input file entry for shared libraries; write soname.
5380         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5381         soname from incremental info.
5382         * incremental.h (enum Incremental_input_flags): Add
5383         INCREMENTAL_INPUT_AS_NEEDED.
5384         (Incremental_input_entry::Incremental_input_entry): Initialize new
5385         data member.
5386         (Incremental_input_entry::set_as_needed): New function.
5387         (Incremental_input_entry::as_needed): New function.
5388         (Incremental_input_entry::do_dynobj_entry): New function.
5389         (Incremental_input_entry::as_needed_): New data member.
5390         (Incremental_object_entry::Incremental_object_entry): Don't check
5391         for shared library.
5392         (Incremental_object_entry::do_type): Likewise.
5393         (class Incremental_dynobj_entry): New class.
5394         (Incremental_input_entry_reader::as_needed): New function.
5395         (Incremental_input_entry_reader::get_soname): New function.
5396         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5397         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5398         size of shared library info entry.
5399         * layout.cc (Layout::finish_dynamic_section): Don't test for
5400         incremental link when adding DT_NEEDED entries.
5401         * object.h (Object::Object): Initialize new data member.
5402         (Object::dynobj): New function.
5403         (Object::set_as_needed): New function.
5404         (Object::as_needed): New function.
5405         (Object::do_dynobj): New function.
5406         (Object::as_needed_): New data member.
5407
5408 2011-05-24 Cary Coutant  <ccoutant@google.com>
5409
5410         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5411         info; adjust display of GOT entries.
5412         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5413         vector of input objects; remove file_status_.
5414         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5415         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5416         got_plt reader; call target hooks to reserve GOT entries.
5417         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5418         of input file info header and GOT info entry.
5419         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5420         relocation info.
5421         (Got_plt_view_info::got_descriptor): Remove.
5422         (Got_plt_view_info::sym_index): New data member.
5423         (Got_plt_view_info::input_index): New data member.
5424         (Local_got_offset_visitor::visit): Write input file index.
5425         (Global_got_offset_visitor::visit): Write 0 for input file index.
5426         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5427         with sym_index and input_index.
5428         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5429         incremental info GOT entry; replace got_descriptor with input_index.
5430         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5431         map from input file index to object.
5432         (Sized_relobj_incr::do_layout): Replace direct data member reference
5433         with accessor function.
5434         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5435         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5436         Adjust size of input file info header.
5437         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5438         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5439         (Incremental_input_entry_reader::get_input_section): Adjust size of
5440         input file info header.
5441         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5442         of incremental info GOT entry.
5443         (Incremental_got_plt_reader::get_got_desc): Remove.
5444         (Incremental_got_plt_reader::get_got_symndx): New function.
5445         (Incremental_got_plt_reader::get_got_input_index): New function.
5446         (Sized_incremental_binary::Sized_incremental_binary): Remove
5447         file_status_; add input_objects_.
5448         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5449         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5450         (Sized_incremental_binary::file_is_unchanged): Remove.
5451         (Sized_incremental_binary::set_input_object): New function.
5452         (Sized_incremental_binary::input_object): New function.
5453         (Sized_incremental_binary::file_status_): Remove.
5454         (Sized_incremental_binary::input_objects_): New data member.
5455         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5456         references.
5457         (Sized_relobj_incr::invalid_address): Move to base class.
5458         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5459         class.
5460         (Sized_relobj_incr::do_output_section_offset): Likewise.
5461         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5462         (Sized_relobj_incr::section_offsets_): Likewise.
5463         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5464         function.
5465         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5466         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5467         with accessor function.
5468         (Sized_relobj_file::do_layout): Likewise.
5469         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5470         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5471         (Sized_relobj_file::compute_final_local_value): Replace refs to
5472         section_offsets_ with accessor function.
5473         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5474         * object.h (Relobj::Relobj): Initialize new data members.
5475         (Relobj::add_dyn_reloc): New function.
5476         (Relobj::first_dyn_reloc): New function.
5477         (Relobj::dyn_reloc_count): New function.
5478         (Relobj::first_dyn_reloc_): New data member.
5479         (Relobj::dyn_reloc_count_): New data member.
5480         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5481         references.
5482         (Sized_relobj::Address): New typedef.
5483         (Sized_relobj::invalid_address): Move here from child class.
5484         (Sized_relobj::Sized_relobj): Initialize new data members.
5485         (Sized_relobj::sized_relobj): New function.
5486         (Sized_relobj::is_output_section_offset_invalid): Move here from
5487         child class.
5488         (Sized_relobj::get_output_section_offset): Likewise.
5489         (Sized_relobj::local_has_got_offset): Likewise.
5490         (Sized_relobj::local_got_offset): Likewise.
5491         (Sized_relobj::set_local_got_offset): Likewise.
5492         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5493         (Sized_relobj::clear_got_offsets): New function.
5494         (Sized_relobj::section_offsets): Move here from child class.
5495         (Sized_relobj::do_output_section_offset): Likewise.
5496         (Sized_relobj::do_set_section_offset): Likewise.
5497         (Sized_relobj::Local_got_offsets): Likewise.
5498         (Sized_relobj::local_got_offsets_): Likewise.
5499         (Sized_relobj::section_offsets_): Likewise.
5500         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5501         references.
5502         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5503         class.
5504         (Sized_relobj_file::sized_relobj): New function
5505         (Sized_relobj_file::local_has_got_offset): Move to base class.
5506         (Sized_relobj_file::local_got_offset): Likewise.
5507         (Sized_relobj_file::set_local_got_offset): Likewise.
5508         (Sized_relobj_file::get_output_section_offset): Likewise.
5509         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5510         (Sized_relobj_file::do_output_section_offset): Likewise.
5511         (Sized_relobj_file::do_set_section_offset): Likewise.
5512         (Sized_relobj_file::Local_got_offsets): Likewise.
5513         (Sized_relobj_file::local_got_offsets_): Likewise.
5514         (Sized_relobj_file::section_offsets_): Likewise.
5515         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5516         (all constructors).
5517         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5518         (Output_reloc::get_symbol_index): Likewise.
5519         (Output_reloc::local_section_offset): Likewise.
5520         (Output_reloc::get_address): Likewise.
5521         (Output_reloc::symbol_value): Likewise.
5522         (Output_data_got::reserve_slot): Move to class definition.
5523         (Output_data_got::reserve_local): New function.
5524         (Output_data_got::reserve_slot_for_global): Remove.
5525         (Output_data_got::reserve_global): New function.
5526         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5527         (all constructors, two instantiations).
5528         (Output_reloc::get_relobj): New function (two instantiations).
5529         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5530         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5531         (Output_data_reloc::add_global): Adjust type of relobj.
5532         (Output_data_reloc::add_global_relative): Likewise.
5533         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5534         (Output_data_reloc::add_local): Likewise.
5535         (Output_data_reloc::add_local_relative): Likewise.
5536         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5537         (Output_data_reloc::add_local_section): Likewise.
5538         (Output_data_reloc::add_output_section): Likewise.
5539         (Output_data_reloc::add_absolute): Likewise.
5540         (Output_data_reloc::add_target_specific): Likewise.
5541         (Output_data_got::reserve_slot): Move definition here.
5542         (Output_data_got::reserve_local): New function.
5543         (Output_data_got::reserve_global): New function.
5544         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5545         section_offsets_ with accessor function.
5546         (Sized_relobj_file::write_sections): Likewise.
5547         (Sized_relobj_file::do_relocate_sections): Likewise.
5548         * target.h (Sized_target::reserve_local_got_entry): New function.
5549         (Sized_target::reserve_global_got_entry): New function.
5550         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5551         (Target_x86_64::reserve_global_got_entry): New function.
5552         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5553
5554 2011-05-23 Cary Coutant  <ccoutant@google.com>
5555
5556         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5557         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5558         bit when checking got_type.
5559         * incremental.cc (Sized_incremental_binary::setup_readers):
5560         Store symbol table and string table locations; initialize bit vector
5561         of file status flags.
5562         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5563         unchanged files.
5564         (Sized_incremental_binary::do_process_got_plt): New function.
5565         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5566         (Output_section_incremental_inputs::set_final_data_size): Record
5567         file index for each input file.
5568         (Output_section_incremental_inputs::write_got_plt): Store file index
5569         instead of input entry offset for each GOT entry.
5570         * incremental.h
5571         (Incremental_input_entry::Incremental_input_entry): Initialize new
5572         data member.
5573         (Incremental_input_entry::set_offset): Store file index.
5574         (Incremental_input_entry::get_file_index): New function.
5575         (Incremental_input_entry::file_index_): New data member.
5576         (Incremental_binary::process_got_plt): New function.
5577         (Incremental_binary::do_process_got_plt): New function.
5578         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5579         data members.
5580         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5581         (Sized_incremental_binary::set_file_is_unchanged): New function.
5582         (Sized_incremental_binary::file_is_unchanged): New function.
5583         (Sized_incremental_binary::do_process_got_plt): New function.
5584         (Sized_incremental_binary::file_status_): New data member.
5585         (Sized_incremental_binary::main_symtab_loc_): New data member.
5586         (Sized_incremental_binary::main_strtab_loc_): New data member.
5587         * output.cc (Output_data_got::Got_entry::write): Add case
5588         RESERVED_CODE.
5589         (Output_data_got::add_global): Call add_got_entry.
5590         (Output_data_got::add_global_plt): Likewise.
5591         (Output_data_got::add_global_with_rel): Likewise.
5592         (Output_data_got::add_global_with_rela): Likewise.
5593         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5594         (Output_data_got::add_global_pair_with_rela): Likewise.
5595         (Output_data_got::add_local): Call add_got_entry.
5596         (Output_data_got::add_local_plt): Likewise.
5597         (Output_data_got::add_local_with_rel): Likewise.
5598         (Output_data_got::add_local_with_rela): Likewise.
5599         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5600         (Output_data_got::add_local_pair_with_rela): Likewise.
5601         (Output_data_got::reserve_slot): New function.
5602         (Output_data_got::reserve_slot_for_global): New function.
5603         (Output_data_got::add_got_entry): New function.
5604         (Output_data_got::add_got_entry_pair): New function.
5605         (Output_section::add_output_section_data): Edit FIXME.
5606         * output.h
5607         (Output_section_data_build::Output_section_data_build): New
5608         constructor with size parameter.
5609         (Output_data_space::Output_data_space): Likewise.
5610         (Output_data_got::Output_data_got): Initialize new data member; new
5611         constructor with size parameter.
5612         (Output_data_got::add_constant): Call add_got_entry.
5613         (Output_data_got::reserve_slot): New function.
5614         (Output_data_got::reserve_slot_for_global): New function.
5615         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5616         (Output_data_got::add_got_entry): New function.
5617         (Output_data_got::add_got_entry_pair): New function.
5618         (Output_data_got::free_list_): New data member.
5619         * target.h (Sized_target::init_got_plt_for_update): New function.
5620         (Sized_target::register_global_plt_entry): New function.
5621         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5622         Initialize new data member; call init; add constructor with PLT count.
5623         (Output_data_plt_x86_64::init): New function.
5624         (Output_data_plt_x86_64::add_relocation): New function.
5625         (Output_data_plt_x86_64::reserve_slot): New function.
5626         (Output_data_plt_x86_64::free_list_): New data member.
5627         (Target_x86_64::init_got_plt_for_update): New function.
5628         (Target_x86_64::register_global_plt_entry): New function.
5629         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5630         incremental updates.
5631         (Output_data_plt_x86_64::add_relocation): New function.
5632         * testsuite/object_unittest.cc (Object_test): Set default options.
5633
5634 2011-05-16  Ian Lance Taylor  <iant@google.com>
5635
5636         * options.h (class General_options): Make -i a synonym for -r.
5637
5638 2011-05-16  Ian Lance Taylor  <iant@google.com>
5639
5640         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5641
5642 2011-05-10 Cary Coutant  <ccoutant@google.com>
5643
5644         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5645         strip_all (-s).
5646
5647 2011-05-06  Ian Lance Taylor  <iant@google.com>
5648
5649         * layout.cc (Layout::layout): If the output section flags change,
5650         update the ordering.
5651
5652 2011-04-25 Cary Coutant  <ccoutant@google.com>
5653
5654         * incremental-dump.cc (dump_incremental_inputs): Print local
5655         symbol info for each input file.
5656         * incremental.cc
5657         (Output_section_incremental_inputs::set_final_data_size): Add local
5658         symbol info to input file entries in incremental info.
5659         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5660         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5661         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5662         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5663         implementation.
5664         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5665         (Sized_incr_relobj::do_relocate): Write the local symbols.
5666         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5667         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5668         Adjust size of input file header.
5669         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5670         (Incremental_inputs_reader::get_local_symbol_count): New function.
5671         (Incremental_inputs_reader::get_input_section): Adjust size of input
5672         file header.
5673         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5674         (Sized_incr_relobj::This): New typedef.
5675         (Sized_incr_relobj::sym_size): New const data member.
5676         (Sized_incr_relobj::Local_symbol): New struct.
5677         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5678         (Sized_incr_relobj::do_local_symbol_offset): New function.
5679         (Sized_incr_relobj::local_symbol_count_): New data member.
5680         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5681         (Sized_incr_relobj::local_symbol_index_): New data member.
5682         (Sized_incr_relobj::local_symbol_offset_): New data member.
5683         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5684         (Sized_incr_relobj::local_symbols_): New data member.
5685         * object.h (Relobj::output_local_symbol_count): New function.
5686         (Relobj::local_symbol_offset): New function.
5687         (Relobj::do_output_local_symbol_count): New function.
5688         (Relobj::do_local_symbol_offset): New function.
5689         (Sized_relobj::do_output_local_symbol_count): New function.
5690         (Sized_relobj::do_local_symbol_offset): New function.
5691
5692 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5693
5694         * descriptors.cc (set_close_on_exec): New function.
5695         (Descriptors::open): Use set_close_on_exec.
5696         * output.cc (S_ISLNK): Define if not defined.
5697
5698 2011-04-22 Cary Coutant  <ccoutant@google.com>
5699
5700         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5701         global symbol map.
5702         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5703         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5704         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5705         relocations.
5706         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5707         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5708         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5709         * incremental.h
5710         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5711         function.
5712         (Incremental_binary::apply_incremental_relocs): New function.
5713         (Incremental_binary::do_apply_incremental_relocs): New function.
5714         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5715         data member.
5716         (Sized_incremental_binary::add_global_symbol): New function.
5717         (Sized_incremental_binary::global_symbol): New function.
5718         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5719         (Sized_incremental_binary::symbol_map_): New data member.
5720         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5721         * target.h (Sized_target::apply_relocation): New function.
5722         * target-reloc.h (apply_relocation): New function.
5723         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5724
5725 2011-04-22  Doug Kwan  <dougkwan@google.com>
5726
5727         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5728         flag of a SHT_ARM_EXIDX section.
5729         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5730         * testsuite/Makefile.in: Regenerate.
5731         * testsuite/arm_exidx_test.s: New file.
5732         * testsuite/arm_exidx_test.sh: Same.
5733
5734 2011-04-20 Cary Coutant  <ccoutant@google.com>
5735
5736         PR gold/12689
5737         * archive.h (Incremental_archive_entry::Archive_member):
5738         Initialize arg_serial_ (second constructor).
5739
5740 2011-04-17  Ian Lance Taylor  <iant@google.com>
5741
5742         * object.cc (Relocate_info::location): Simplify location string.
5743         * errors.cc (Errors::error_at_location): Don't print program
5744         name.
5745         (Errors::warning_at_location): Likewise.
5746         (Errors::undefined_symbol): Likewise.
5747         * testsuite/debug_msg.sh: Update accordingly.
5748
5749 2011-04-14 Cary Coutant  <ccoutant@google.com>
5750
5751         * gold/layout.cc (Layout::symtab_section_offset): New function.
5752         * gold/layout.h (Layout::symtab_section_offset): New function.
5753         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5754
5755 2011-04-12  Ian Lance Taylor  <iant@google.com>
5756
5757         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5758         with MREMAP_MAYMOVE.
5759         * output.h (class Output_file): Add map_is_allocated_ field.
5760         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5761         not available, provide stubs.  If mremap is not available, #define
5762         it to gold_mremap.
5763         (MREMAP_MAYMOVE): Define if not defined.
5764         (Output_file::Output_file): Initialize map_is_allocated_.
5765         (Output_file::resize): Check map_is_allocated_.
5766         (Output_file::map_anonymous): If mmap fails, use malloc.
5767         (Output_file::unmap): Don't do anything for an anonymous map.
5768         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5769         is not available, provide stubs.
5770         (File_read::View::~View): Use free rather than delete[].
5771         (File_read::make_view): Use malloc rather than new[].  If mmap
5772         fails, use malloc.
5773         (File_read::find_or_make_view): Use malloc rather than new[].
5774         * gold.h: Remove HAVE_REMAP code.
5775         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5776         exists.  Rename mremap to gold_mremap.  If mmap is not available
5777         don't do anything.
5778         * configure, config.in: Rebuild.
5779
5780 2011-04-11  Ian Lance Taylor  <iant@google.com>
5781
5782         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5783         initialize local variable v.
5784
5785 2011-04-11  Cary Coutant  <ccoutant@google.com>
5786
5787         * archive.cc (Archive::include_member): Adjust call to
5788         report_object.
5789         (Add_archive_symbols::run): Track argument serial numbers.
5790         (Lib_group::include_member): Likewise.
5791         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5792         * archive.h (Incremental_archive_entry::Archive_member):
5793         Initialize arg_serial_.
5794         (Archive_member::arg_serial_): New data member.
5795         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5796         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5797         incremental link.
5798         (Sized_dynobj::do_for_all_local_got_entries): New function.
5799         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5800         function.
5801         * fileread.cc (get_mtime): New function.
5802         * fileread.h (get_mtime): New function.
5803         * gold.cc (queue_initial_tasks): Check for incremental update.
5804         (process_incremental_input): New function.
5805         (queue_middle_tasks): Don't force valid target for incremental
5806         update.
5807         * incremental-dump.cc (find_input_containing_global): Adjust
5808         size of symbol info entry.
5809         (dump_incremental_inputs): Dump argument serial number and
5810         in_system_directory flag; bias shndx by 1; print symbol names
5811         when dumping per-file symbol lists; use new symbol info readers.
5812         * incremental.cc
5813         (Output_section_incremental_inputs:update_data_size): New function.
5814         (Sized_incremental_binary::setup_readers): Setup input readers
5815         for each input file; build maps for files added from libraries
5816         and scripts.
5817         (Sized_incremental_binary::check_input_args): New function.
5818         (Sized_incremental_binary::do_check_inputs): Build map of argument
5819         serial numbers to input arguments.
5820         (Sized_incremental_binary::do_file_has_changed): Rename
5821         do_file_is_unchanged to this; compare file modification times.
5822         (Sized_incremental_binary::do_init_layout): New function.
5823         (Sized_incremental_binary::do_reserve_layout): New function.
5824         (Sized_incremental_binary::do_get_input_reader): Remove.
5825         (Sized_incremental_binary::get_symtab_view): New function.
5826         (Incremental_checker::can_incrementally_link_output_file): Remove.
5827         (Incremental_inputs::report_command_line): Exclude --debug options.
5828         (Incremental_inputs::report_archive_begin): Add parameter; track
5829         argument serial numbers; don't put input file entry for archive
5830         before archive members.
5831         (Incremental_inputs::report_archive_end): Put input file entry
5832         for archive after archive members.
5833         (Incremental_inputs::report_object): Add parameter; track argument
5834         serial numbers and in_system_directory flag.
5835         (Incremental_inputs::report_script): Add parameter; track argument
5836         serial numbers.
5837         (Output_section_incremental_inputs::set_final_data_size): Adjust
5838         size of symbol info entry; check for forwarding symbols.
5839         (Output_section_incremental_inputs::write_input_files): Write
5840         in_system_directory flag and argument serial number.
5841         (Output_section_incremental_inputs::write_info_blocks): Map section
5842         indices between incremental info and original input file; store
5843         input section index for each symbol.
5844         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5845         change operator() to visit().
5846         (class Global_got_offset_visitor): Likewise.
5847         (class Global_symbol_visitor_got_plt):
5848         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5849         classes.
5850         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5851         (Sized_incr_relobj::do_read_symbols): New function.
5852         (Sized_incr_relobj::do_layout): New function.
5853         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5854         (Sized_incr_relobj::do_add_symbols): New function.
5855         (Sized_incr_relobj::do_should_include_member): New function.
5856         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5857         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5858         (Sized_incr_relobj::do_section_size): New function.
5859         (Sized_incr_relobj::do_section_name): New function.
5860         (Sized_incr_relobj::do_section_contents): New function.
5861         (Sized_incr_relobj::do_section_flags): New function.
5862         (Sized_incr_relobj::do_section_entsize): New function.
5863         (Sized_incr_relobj::do_section_address): New function.
5864         (Sized_incr_relobj::do_section_type): New function.
5865         (Sized_incr_relobj::do_section_link): New function.
5866         (Sized_incr_relobj::do_section_info): New function.
5867         (Sized_incr_relobj::do_section_addralign): New function.
5868         (Sized_incr_relobj::do_initialize_xindex): New function.
5869         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5870         (Sized_incr_relobj::do_read_relocs): New function.
5871         (Sized_incr_relobj::do_gc_process_relocs): New function.
5872         (Sized_incr_relobj::do_scan_relocs): New function.
5873         (Sized_incr_relobj::do_count_local_symbols): New function.
5874         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5875         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5876         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5877         (Sized_incr_relobj::do_relocate): New function.
5878         (Sized_incr_relobj::do_set_section_offset): New function.
5879         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5880         (Sized_incr_dynobj::do_read_symbols): New function.
5881         (Sized_incr_dynobj::do_layout): New function.
5882         (Sized_incr_dynobj::do_add_symbols): New function.
5883         (Sized_incr_dynobj::do_should_include_member): New function.
5884         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5885         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5886         (Sized_incr_dynobj::do_section_size): New function.
5887         (Sized_incr_dynobj::do_section_name): New function.
5888         (Sized_incr_dynobj::do_section_contents): New function.
5889         (Sized_incr_dynobj::do_section_flags): New function.
5890         (Sized_incr_dynobj::do_section_entsize): New function.
5891         (Sized_incr_dynobj::do_section_address): New function.
5892         (Sized_incr_dynobj::do_section_type): New function.
5893         (Sized_incr_dynobj::do_section_link): New function.
5894         (Sized_incr_dynobj::do_section_info): New function.
5895         (Sized_incr_dynobj::do_section_addralign): New function.
5896         (Sized_incr_dynobj::do_initialize_xindex): New function.
5897         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5898         (make_sized_incremental_object): New function.
5899         (Incremental_library::copy_unused_symbols): New function.
5900         (Incremental_library::do_for_all_unused_symbols): New function.
5901         * incremental.h (enum Incremental_input_flags): New type.
5902         (class Incremental_checker): Remove.
5903         (Incremental_input_entry::Incremental_input_entry): Add argument
5904         serial number.
5905         (Incremental_input_entry::arg_serial): New function.
5906         (Incremental_input_entry::set_is_in_system_directory): New function.
5907         (Incremental_input_entry::is_in_system_directory): New function.
5908         (Incremental_input_entry::arg_serial_): New data member.
5909         (Incremental_input_entry::is_in_system_directory_): New data member.
5910         (class Script_info): Move here from script.h.
5911         (Script_info::Script_info): Add filename parameter.
5912         (Script_info::filename): New function.
5913         (Script_info::filename_): New data member.
5914         (Incremental_script_entry::Incremental_script_entry): Add argument
5915         serial number.
5916         (Incremental_object_entry::Incremental_object_entry): Likewise.
5917         (Incremental_object_entry::add_input_section): Build list of input
5918         sections with map to original shndx.
5919         (Incremental_object_entry::get_input_section_index): New function.
5920         (Incremental_object_entry::shndx_): New data member.
5921         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5922         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5923         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5924         serial number.
5925         (Incremental_inputs::report_archive_begin): Likewise.
5926         (Incremental_inputs::report_object): Likewise.
5927         (Incremental_inputs::report_script): Likewise.
5928         (class Incremental_global_symbol_reader): New class.
5929         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5930         and store flags and input file type.
5931         (Incremental_input_entry_reader::arg_serial): New function.
5932         (Incremental_input_entry_reader::type): Extract type from flags.
5933         (Incremental_input_entry_reader::is_in_system_directory): New function.
5934         (Incremental_input_entry_reader::get_input_section_count): Call
5935         accessor function for type.
5936         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5937         function for type; adjust size of global symbol entry.
5938         (Incremental_input_entry_reader::get_global_symbol_count): Call
5939         accessor function for type.
5940         (Incremental_input_entry_reader::get_object_count): Likewise.
5941         (Incremental_input_entry_reader::get_object_offset): Likewise.
5942         (Incremental_input_entry_reader::get_member_count): Likewise.
5943         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5944         (Incremental_input_entry_reader::get_member_offset): Likewise.
5945         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5946         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5947         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5948         (Incremental_input_entry_reader::get_global_symbol_reader): New
5949         function.
5950         (Incremental_input_entry_reader::get_output_symbol_index): New
5951         function.
5952         (Incremental_input_entry_reader::type_): Remove.
5953         (Incremental_input_entry_reader::flags_): New data member.
5954         (Incremental_inputs_reader::input_file_offset): New function.
5955         (Incremental_inputs_reader::input_file_index): New function.
5956         (Incremental_inputs_reader::input_file): Call input_file_offset.
5957         (Incremental_inputs_reader::input_file_at_offset): New function.
5958         (Incremental_relocs_reader::get_r_type): Reformat.
5959         (Incremental_relocs_reader::get_r_shndx): Reformat.
5960         (Incremental_relocs_reader::get_r_offset): Reformat.
5961         (Incremental_relocs_reader::data): New function.
5962         (Incremental_binary::Incremental_binary): Initialize new data members.
5963         (Incremental_binary::check_inputs): Add cmdline parameter.
5964         (Incremental_binary::file_is_unchanged): Remove.
5965         (Input_reader::arg_serial): New function.
5966         (Input_reader::get_unused_symbol_count): New function.
5967         (Input_reader::get_unused_symbol): New function.
5968         (Input_reader::do_arg_serial): New function.
5969         (Input_reader::do_get_unused_symbol_count): New function.
5970         (Input_reader::do_get_unused_symbol): New function.
5971         (Incremental_binary::input_file_count): New function.
5972         (Incremental_binary::get_input_reader): Change signature to use
5973         index instead of filename.
5974         (Incremental_binary::file_has_changed): New function.
5975         (Incremental_binary::get_input_argument): New function.
5976         (Incremental_binary::get_library): New function.
5977         (Incremental_binary::get_script_info): New function.
5978         (Incremental_binary::init_layout): New function.
5979         (Incremental_binary::reserve_layout): New function.
5980         (Incremental_binary::output_file): New function.
5981         (Incremental_binary::do_check_inputs): New function.
5982         (Incremental_binary::do_file_is_unchanged): Remove.
5983         (Incremental_binary::do_file_has_changed): New function.
5984         (Incremental_binary::do_init_layout): New function.
5985         (Incremental_binary::do_reserve_layout): New function.
5986         (Incremental_binary::do_input_file_count): New function.
5987         (Incremental_binary::do_get_input_reader): Change signature.
5988         (Incremental_binary::input_args_map_): New data member.
5989         (Incremental_binary::library_map_): New data member.
5990         (Incremental_binary::script_map_): New data member.
5991         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5992         new data members.
5993         (Sized_incremental_binary::output_section): New function.
5994         (Sized_incremental_binary::inputs_reader): Add const.
5995         (Sized_incremental_binary::symtab_reader): Add const.
5996         (Sized_incremental_binary::relocs_reader): Add const.
5997         (Sized_incremental_binary::got_plt_reader): Add const.
5998         (Sized_incremental_binary::get_symtab_view): New function.
5999         (Sized_incremental_binary::Inputs_reader): New typedef.
6000         (Sized_incremental_binary::Input_entry_reader): New typedef.
6001         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6002         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6003         (Sized_incremental_binary::do_file_has_changed): New function.
6004         (Sized_incremental_binary::do_init_layout): New function.
6005         (Sized_incremental_binary::do_reserve_layout): New function.
6006         (Sized_input_reader::Inputs_reader): Remove.
6007         (Sized_input_reader::Input_entry_reader): Remove.
6008         (Sized_input_reader::do_arg_serial): New function.
6009         (Sized_input_reader::do_get_unused_symbol_count): New function.
6010         (Sized_input_reader::do_get_unused_symbol): New function.
6011         (Sized_incremental_binary::do_input_file_count): New function.
6012         (Sized_incremental_binary::do_get_input_reader): Change signature;
6013         use index instead of filename.
6014         (Sized_incremental_binary::section_map_): New data member.
6015         (Sized_incremental_binary::input_entry_readers_): New data member.
6016         (class Sized_incr_relobj): New class.
6017         (class Sized_incr_dynobj): New class.
6018         (make_sized_incremental_object): New function.
6019         (class Incremental_library): New class.
6020         * layout.cc (Free_list::num_lists): New static data member.
6021         (Free_list::num_nodes): New static data member.
6022         (Free_list::num_removes): New static data member.
6023         (Free_list::num_remove_visits): New static data member.
6024         (Free_list::num_allocates): New static data member.
6025         (Free_list::num_allocate_visits): New static data member.
6026         (Free_list::init): New function.
6027         (Free_list::remove): New function.
6028         (Free_list::allocate): New function.
6029         (Free_list::dump): New function.
6030         (Free_list::print_stats): New function.
6031         (Layout_task_runner::run): Resize output file for incremental updates.
6032         (Layout::Layout): Initialize new data members.
6033         (Layout::set_incremental_base): New function.
6034         (Layout::init_fixed_output_section): New function.
6035         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6036         incremental updates.
6037         (Layout::create_gold_note): Do not create gold note section for
6038         incremental updates.
6039         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6040         for incremental updates.
6041         (Layout::set_section_offsets): For incremental updates, allocate space
6042         from free list.
6043         (Layout::create_symtab_sections): Layout with offsets relative to
6044         start of section; for incremental updates, allocate space from free
6045         list.
6046         (Layout::create_shdrs): For incremental updates, allocate space from
6047         free list.
6048         (Layout::finish_dynamic_section): For incremental updates, do not
6049         check --as-needed (fixed in subsequent patch).
6050         * layout.h (class Free_list): New class.
6051         (Layout::set_incremental_base): New function.
6052         (Layout::incremental_base): New function.
6053         (Layout::init_fixed_output_section): New function.
6054         (Layout::allocate): New function.
6055         (Layout::incremental_base_): New data member.
6056         (Layout::free_list_): New data member.
6057         * main.cc (main): Print Free_list statistics.
6058         * object.cc (Relobj::finalize_incremental_relocs): Add
6059         clear_counts parameter; clear counts only when clear_counts is set.
6060         (Sized_relobj::Sized_relobj): Initialize new base class.
6061         (Sized_relobj::do_layout): Don't report special sections.
6062         (Sized_relobj::do_for_all_local_got_entries): New function.
6063         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6064         symtab_off to all symbol table offsets.
6065         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6066         * object.h (class Got_offset_list): Move to top of file.
6067         (Object::Object): Allow case where input_file == NULL.
6068         (Object::~Object): Likewise.
6069         (Object::input_file): Assert that input_file != NULL.
6070         (Object::lock): Allow case where input_file == NULL.
6071         (Object::unlock): Likewise.
6072         (Object::is_locked): Likewise.
6073         (Object::token): Likewise.
6074         (Object::release): Likewise.
6075         (Object::is_incremental): New function.
6076         (Object::get_mtime): New function.
6077         (Object::for_all_local_got_entries): New function.
6078         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6079         (Object::set_is_in_system_directory): New function.
6080         (Object::is_in_system_directory): New function.
6081         (Object::do_is_incremental): New function.
6082         (Object::do_get_mtime): New function.
6083         (Object::do_for_all_local_got_entries): New function.
6084         (Object::is_in_system_directory_): New data member.
6085         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6086         (class Sized_relobj_base): New class.
6087         (class Sized_relobj): Derive from Sized_relobj_base.
6088         (class Sized_relobj::Symbols): Redeclare from base class.
6089         (class Sized_relobj::local_got_offset_list): Remove.
6090         (class Sized_relobj::Output_sections): Redeclare from base class.
6091         (class Sized_relobj::do_for_all_local_got_entries): New function.
6092         (class Sized_relobj::write_local_symbols): Add offset parameter.
6093         (class Sized_relobj::local_symbol_offset_): Update comment.
6094         (class Sized_relobj::local_dynsym_offset_): Update comment.
6095         * options.cc (Input_arguments::add_file): Remove const.
6096         * options.h (Input_file_argument::Input_file_argument):
6097         Initialize arg_serial_ (all constructors).
6098         (Input_file_argument::set_arg_serial): New function.
6099         (Input_file_argument::arg_serial): New function.
6100         (Input_file_argument::arg_serial_): New data member.
6101         (Input_arguments::Input_arguments): Initialize file_count_.
6102         (Input_arguments::add_file): Remove const.
6103         (Input_arguments::number_of_input_files): New function.
6104         (Input_arguments::file_count_): New data member.
6105         (Command_line::number_of_input_files): Call
6106         Input_arguments::number_of_input_files.
6107         * output.cc (Output_segment_headers::Output_segment_headers):
6108         Set current size.
6109         (Output_section::Input_section::current_data_size): New function.
6110         (Output_section::Output_section): Initialize new data members.
6111         (Output_section::add_input_section): Don't do merge sections for
6112         an incremental link; allocate space from free list for an
6113         incremental update.
6114         (Output_section::add_output_section_data): Allocate space from
6115         free list for an incremental update.
6116         (Output_section::update_data_size): New function.
6117         (Output_section::set_fixed_layout): New function.
6118         (Output_section::reserve): New function.
6119         (Output_segment::set_section_addresses): Remove const.
6120         (Output_segment::set_section_list_addresses): Remove const; allocate
6121         space from free list for an incremental update.
6122         (Output_segment::set_offset): Adjust size of RELRO segment for an
6123         incremental update.
6124         * output.h (Output_data::current_data_size): Move here from
6125         child classes.
6126         (Output_data::pre_finalize_data_size): New function.
6127         (Output_data::update_data_size): New function.
6128         (Output_section_headers::update_data_size): new function.
6129         (Output_section_data_build::current_data_size): Move to Output_data.
6130         (Output_data_strtab::update_data_size): New function.
6131         (Output_section::current_data_size): Move to Output_data.
6132         (Output_section::set_fixed_layout): New function.
6133         (Output_section::has_fixed_layout): New function.
6134         (Output_section::reserve): New function.
6135         (Output_section::update_data_size): New function.
6136         (Output_section::has_fixed_layout_): New data member.
6137         (Output_section::free_list_): New data member.
6138         (Output_segment::set_section_addresses): Remove const.
6139         (Output_segment::set_section_list_addresses): Remove const.
6140         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6141         New function.
6142         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6143         New function.
6144         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6145         parameter when calling Add_symbols constructor; store argument
6146         serial number for members of a lib group.
6147         (Add_symbols::locks): Allow case where token == NULL.
6148         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6149         (Read_member::~Read_member): New function.
6150         (Read_member::is_runnable): New function.
6151         (Read_member::locks): New function.
6152         (Read_member::run): New function.
6153         (Check_script::~Check_script): New function.
6154         (Check_script::is_runnable): New function.
6155         (Check_script::locks): New function.
6156         (Check_script::run): New function.
6157         (Check_library::~Check_library): New function.
6158         (Check_library::is_runnable): New function.
6159         (Check_library::locks): New function.
6160         (Check_library::run): New function.
6161         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6162         (Add_symbols::library_): New data member.
6163         (class Read_member): New class.
6164         (class Check_script): New class.
6165         (class Check_library): New class.
6166         * reloc.cc (Read_relocs::is_runnable): Allow case where
6167         token == NULL.
6168         (Read_relocs::locks): Likewise.
6169         (Scan_relocs::locks): Likewise.
6170         (Relocate_task::locks): Likewise.
6171         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6172         to clear counters.
6173         (Sized_relobj::incremental_relocs_scan): Fix comment.
6174         (Sized_relobj::do_relocate): Pass output file offset to
6175         write_local_symbols.
6176         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6177         from class declaration.
6178         * script.cc (read_input_script): Allocate Script_info; pass
6179         argument serial number to report_script.
6180         * script.h (class Script_info): Move to incremental.h.
6181         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6182         * symtab.h (Symbol_table::add_from_incrobj): New function.
6183         (Symbol_table::set_file_offset): New function.
6184
6185 2011-04-05  Cary Coutant  <ccoutant@google.com>
6186
6187         * incremental-dump.cc (dump_incremental_inputs): Change signature
6188         to take a Sized_incremental_binary; change caller.  Use readers
6189         in Sized_incremental_binary.
6190         * incremental.cc
6191         (Sized_incremental_binary::find_incremental_inputs_sections):
6192         Rename do_find_incremental_inputs_sections to this.
6193         (Sized_incremental_binary::setup_readers): New function.
6194         (Sized_incremental_binary::do_check_inputs): Check
6195         has_incremental_info_ flag; move setup code to setup_readers;
6196         use input readers.
6197         (Sized_incremental_binary::do_file_is_unchanged): New function.
6198         (Sized_incremental_binary::do_get_input_reader): New function.
6199         * incremental.h (class Incremental_binary): Move to end of file.
6200         (Incremental_binary::file_is_unchanged): New function.
6201         (Incremental_binary::do_file_is_unchanged): New function.
6202         (Incremental_binary::Input_reader): New class.
6203         (Incremental_binary::get_input_reader): New function.
6204         (class Sized_incremental_binary): Move to end of file.
6205         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6206         input section reader classes.
6207         (Sized_incremental_binary::has_incremental_info): New function.
6208         (Sized_incremental_binary::inputs_reader): New function.
6209         (Sized_incremental_binary::symtab_reader): New function.
6210         (Sized_incremental_binary::relocs_reader): New function.
6211         (Sized_incremental_binary::got_plt_reader): New function.
6212         (Sized_incremental_binary::do_file_is_unchanged): New function.
6213         (Sized_incremental_binary::Sized_input_reader): New class.
6214         (Sized_incremental_binary::get_input_reader): New function.
6215         (Sized_incremental_binary::find_incremental_inputs_sections):
6216         Rename do_find_incremental_inputs_sections to this.
6217         (Sized_incremental_binary::setup_readers): New function.
6218         (Sized_incremental_binary::has_incremental_info_): New data member.
6219         (Sized_incremental_binary::inputs_reader_): New data member.
6220         (Sized_incremental_binary::symtab_reader_): New data member.
6221         (Sized_incremental_binary::relocs_reader_): New data member.
6222         (Sized_incremental_binary::got_plt_reader_): New data member.
6223         (Sized_incremental_binary::current_input_file_): New data member.
6224
6225 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6226
6227         PR gold/12640
6228         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6229         violation.
6230
6231 2011-03-30  Cary Coutant  <ccoutant@google.com>
6232
6233         * archive.cc (Archive::include_member): Adjust call to report_object.
6234         (Add_archive_symbols::run): Add script_info to call to
6235         report_archive_begin.
6236         (Lib_group::include_member): Adjust call to report_object.
6237         (Add_lib_group_symbols::run): Adjust call to report_object.
6238         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6239         blocks.  Add object count for script input files.
6240         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6241         script_info parameter; change all callers.
6242         (Incremental_inputs::report_object): Add script_info parameter;
6243         change all callers.
6244         (Incremental_inputs::report_script): Store backpointer to
6245         incremental info entry.
6246         (Output_section_incremental_inputs::set_final_data_size): Record
6247         additional information for scripts.
6248         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6249         * incremental.h (Incremental_script_entry::add_object): New function.
6250         (Incremental_script_entry::get_object_count): New function.
6251         (Incremental_script_entry::get_object): New function.
6252         (Incremental_script_entry::objects_): New data member; adjust
6253         constructor.
6254         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6255         (Incremental_inputs::report_object): Add script_info parameter.
6256         (Incremental_inputs_reader::get_object_count): New function.
6257         (Incremental_inputs_reader::get_object_offset): New function.
6258         * options.cc (Input_arguments::add_file): Return reference to
6259         new input argument.
6260         * options.h (Input_argument::set_script_info): New function.
6261         (Input_argument::script_info): New function.
6262         (Input_argument::script_info_): New data member; adjust all
6263         constructors.
6264         (Input_file_group::add_file): Return reference to new input argument.
6265         (Input_file_lib::add_file): Likewise.
6266         (Input_arguments::add_file): Likewise.
6267         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6268         * script.cc (Parser_closure::Parser_closure): Add script_info
6269         parameter; adjust all callers.
6270         (Parser_closure::script_info): New function.
6271         (Parser_closure::script_info_): New data member.
6272         (read_input_script): Report scripts earlier to incremental info.
6273         (script_add_file): Set script_info in Input_argument.
6274         (script_add_library): Likewise.
6275         * script.h (Script_options::Script_info): Rewrite class.
6276
6277 2011-03-29  Cary Coutant  <ccoutant@google.com>
6278
6279         * archive.cc (Library_base::should_include_member): Move
6280         method here from class Archive.
6281         (Archive::Archive): Initialize base class.
6282         (Archive::should_include_member): Move to base class.
6283         (Archive::do_for_all_unused_symbols): New function.
6284         (Add_archive_symbols::run): Remove redundant access to
6285         incremental_inputs.
6286         (Lib_group::Lib_group): Initialize base class.
6287         (Lib_group::do_filename): New function.
6288         (Lib_group::include_member): Pass pointer to Lib_group to
6289         report_object.
6290         (Lib_group::do_for_all_unused_symbols): New function.
6291         (Add_lib_group_symbols::run): Report archive information for
6292         incremental links.
6293         * archive.h (class Library_base): New base class.
6294         (class Archive): Derive from Library_base.
6295         (Archive::filename): Move to base class.
6296         (Archive::set_incremental_info): Likewise.
6297         (Archive::incremental_info): Likewise.
6298         (Archive::Should_include): Likewise.
6299         (Archive::should_include_member): Likewise.
6300         (Archive::Armap_entry): Remove.
6301         (Archive::Unused_symbol_iterator): Remove.
6302         (Archive::unused_symbols_begin): Remove.
6303         (Archive::unused_symbols_end): Remove.
6304         (Archive::do_filename): New function.
6305         (Archive::do_get_mtime): New function.
6306         (Archive::do_for_all_unused_symbols): New function.
6307         (Archive::task_): Move to base class.
6308         (Archive::incremental_info_): Likewise.
6309         (class Lib_group): Derive from Library_base.
6310         (Lib_group::do_filename): New function.
6311         (Lib_group::do_get_mtime): New function.
6312         (Lib_group::do_for_all_unused_symbols): New function.
6313         (Lib_group::task_): Move to base class.
6314         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6315         function.
6316         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6317         function.
6318         * incremental.cc (Incremental_inputs::report_archive_begin):
6319         Use Library_base; call library's get_mtime; add incremental inputs
6320         entry before members.
6321         (class Unused_symbol_visitor): New class.
6322         (Incremental_inputs::report_archive_end): Use Library_base; use
6323         visitor class to record unused symbols; don't add incremental inputs
6324         entry after members.
6325         (Incremental_inputs::report_object): Use Library_base.
6326         * incremental.h
6327         (Incremental_archive_entry::Incremental_archive_entry): Remove
6328         unused Archive parameter.
6329         (Incremental_inputs::report_archive_begin): Use Library_base.
6330         (Incremental_inputs::report_archive_end): Likewise.
6331         (Incremental_inputs::report_object): Likewise.
6332         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6333         function.
6334         * object.h (Object::for_all_global_symbols): New function.
6335         (Object::do_for_all_global_symbols): New function.
6336         (Sized_relobj::do_for_all_global_symbols): New function.
6337         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6338         function.
6339         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6340         function.
6341
6342 2011-03-27  Ian Lance Taylor  <iant@google.com>
6343
6344         * archive.cc (Archive::interpret_header): Return -1 if something
6345         goes wrong.  Change callers accordingly.
6346
6347 2011-03-25  Cary Coutant  <ccoutant@google.com>
6348
6349         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6350         * testsuite/Makefile.in: Regenerate.
6351
6352 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6353
6354         * plugin.cc (get_view): New.
6355         (Plugin::load): Pass get_view to the plugin.
6356         (Plugin_manager::get_view): New.
6357
6358 2011-03-21  Ian Lance Taylor  <iant@google.com>
6359
6360         * testsuite/final_layout.sh: Rewrite to not use dc.
6361         * testsuite/relro_test.sh: Fail if dc is not present.
6362
6363 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6364
6365         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6366         Change == to -eq.
6367         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6368         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6369         Change == to -eq.
6370         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6371         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6372
6373 2011-03-14  Ian Lance Taylor  <iant@google.com>
6374
6375         * script-sections.cc (Sort_output_sections::script_compare):
6376         Rename from is_before, change return type.
6377         (Sort_output_sections::operator()): Adjust accordingly.
6378
6379 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6380
6381         PR gold/12572
6382         * testsuite/odr_violation2.cc: Add comment to make all error line
6383         numbers double digits.
6384         * testsuite/debug_msg.sh: Adjust expected errors.
6385
6386 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6387
6388         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6389         but mark earlier ones as non-canonical
6390         (offset_to_iterator): Update search target and example
6391         (do_addr2line): Return extra lines in a vector*
6392         (format_file_lineno): Extract from do_addr2line
6393         (one_addr2line): Add vector* out-param
6394         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6395         when a lineno entry appeared last for its instruction
6396         (Dwarf_line_info): Add vector* out-param
6397         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6398         * symtab.cc (Odr_violation_compare): Include the lineno in the
6399         comparison again.
6400         (linenos_from_loc): New. Combine the canonical line for an
6401         address with its other lines.
6402         (True_if_intersect): New. Helper functor to make
6403         std::set_intersection a query.
6404         (detect_odr_violations): Compare sets of lines instead of just
6405         one line for each function. This became less deterministic, but
6406         has fewer false positives.
6407         * symtab.h: Declarations.
6408         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6409         mix an optimized and non-optimized object in the same binary
6410         (odr_violation2.so): Same.
6411         * testsuite/Makefile.in: Regenerate from Makefile.am.
6412         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6413         * testsuite/debug_msg.sh: Update line numbers and add
6414         assertions.
6415         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6416         non-optimized context.
6417         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6418         isn't inlined, and use OdrDerived in an optimized context.
6419         * testsuite/odr_header1.h: Defines OdrDerived, where
6420         optimization will change the
6421         first-instruction-in-the-destructor's file and line number.
6422         * testsuite/odr_header2.h: Defines OdrBase.
6423
6424 2011-03-09  Ian Lance Taylor  <iant@google.com>
6425
6426         * fileread.cc (File_read::clear_views): Don't delete the whole
6427         file view.
6428
6429 2011-03-08  Ian Lance Taylor  <iant@google.com>
6430
6431         PR gold/12525
6432         * fileread.cc: #include <climits>.
6433         (GOLD_IOV_MAX): Define.
6434         (File_read::read_multiple): Limit number of entries by iov_max.
6435         * fileread.h (class File_read): Always set max_readv_entries to
6436         128.
6437
6438 2011-03-07  Ian Lance Taylor  <iant@google.com>
6439
6440         PR gold/12525
6441         * options.h (class General_options): Add -dy and -dn.
6442
6443 2011-03-02  Cary Coutant  <ccoutant@google.com>
6444
6445         * testsuite/script_test_9.t: Add TLS segment.
6446
6447 2011-03-02  Simon Baldwin  <simonb@google.com>
6448
6449         * configure.ac: Add check for gnu_indirect_function support in
6450         the toolchain building binutils.
6451         * configure: Rebuild.
6452
6453 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6454
6455         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6456         plugin only symbols.
6457         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6458         in plugin files as not needed in the symbol table.
6459
6460 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6461
6462         * output.cc (Output_section::add_input_section): Delay fill
6463         generation for section ordering.
6464
6465 2011-02-09  Ian Lance Taylor  <iant@google.com>
6466
6467         PR gold/12316
6468         * object.h (class Sized_relobj): Remove clear_local_symbols.
6469         * reloc.cc (Sized_relobj::do_relocate): Don't call
6470         clear_local_symbols.
6471
6472 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6473
6474         * plugin.cc (is_visible_from_outside): Return true for symbols
6475         in the -u option.
6476
6477 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6478
6479         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6480         filename.
6481
6482 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6483
6484         * icf.h (is_section_foldable_candidate): Change type of parameter
6485         to std::string.
6486         * icf.cc (Icf::find_identical_sections): Change type of local variable
6487         section_name to be std::string.
6488         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6489
6490 2011-01-25  Ian Lance Taylor  <iant@google.com>
6491
6492         * script.cc (script_add_extern): Rewrite to use
6493         add_symbol_reference.
6494
6495 2011-01-25  Doug Kwan  <dougkwan@google.com>
6496
6497         * icf.cc (get_section_contents): Always lock section's object.
6498
6499 2011-01-24  Ian Lance Taylor  <iant@google.com>
6500
6501         * options.h (class General_options): Accept
6502         --no-detect-odr-violations.
6503
6504 2011-01-24  Ian Lance Taylor  <iant@google.com>
6505
6506         * version.cc (version_string): Bump to 1.11.
6507
6508 2011-01-24  Ian Lance Taylor  <iant@google.com>
6509
6510         * plugin.cc (class Plugin_rescan): Define new class.
6511         (Plugin_manager::claim_file): Set any_claimed_.
6512         (Plugin_manager::save_archive): New function.
6513         (Plugin_manager::save_input_group): New function.
6514         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6515         necessary.
6516         (Plugin_manager::new_undefined_symbol): New function.
6517         (Plugin_manager::rescan): New function.
6518         (Plugin_manager::rescannable_defines): New function.
6519         (Plugin_manager::add_input_file): Set any_added_.
6520         * plugin.h (class Plugin_manager): define new fields rescannable_,
6521         undefined_symbols_, any_claimed_, and any_added_.  Declare
6522         Plugin_rescan as friend.  Declare new functions.
6523         (Plugin_manager::Rescannable): Define type.
6524         (Plugin_manager::Rescannable_list): Define type.
6525         (Plugin_manager::Undefined_symbol_list): Define type.
6526         (Plugin_manager::Plugin_manager): Initialize new fields.
6527         * archive.cc (Archive::defines_symbol): New function.
6528         (Add_archive_symbols::run): Pass archive to plugins if any.
6529         * archive.h (class Archive): Declare defines_symbol.
6530         * readsyms.cc (Input_group::~Input_group): New function.
6531         (Finish_group::run): Pass input_group to plugins if any.
6532         * readsyms.h (class Input_group): Declare destructor.
6533         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6534         any.
6535
6536 2011-01-10  Ian Lance Taylor  <iant@google.com>
6537
6538         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6539         section as relro.
6540         (Layout::set_segment_offsets): Reset increase_relro before calling
6541         set_section_addresses a second time.
6542
6543 2011-01-04  Cary Coutant  <ccoutant@google.com>
6544
6545         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6546         sections before NOBITS sections.
6547
6548 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6549
6550         * version.cc (print_version): Update copyright to 2011.
6551
6552 2010-12-23  Cary Coutant  <ccoutant@google.com>
6553
6554         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6555         of OS to this->add.  Add OD parameter to second form of the function.
6556
6557 2010-12-20  Ian Lance Taylor  <iant@google.com>
6558
6559         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6560         second of two consecutive entries with same offset.
6561
6562 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6563
6564         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6565         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6566         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6567         to avoid unneeded links against $(LDADD).
6568         * testsuite/Makefile.in: Regenerate.
6569
6570 2010-12-15  Ian Lance Taylor  <iant@google.com>
6571
6572         PR gold/12324
6573         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6574         for R_X86_64_32 and R_X86_64_PC32.
6575         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6576         ver_matching_def_pic.o.
6577         (ver_matching_def_pic.o): New target.
6578
6579 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6580
6581         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6582         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6583         Move definition before File_read::View member definitions.
6584         (File_read::View::~View): Initialize and hold lock before
6585         updating current_mapped_bytes.
6586
6587 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6588
6589         * dwarf_reader.cc: Remove outdated comment.
6590         * gold-threads.cc: Fix typo in error message.
6591         * archive.cc: Fix typos in comments.
6592         * archive.h: Likewise.
6593         * arm-reloc-property.cc: Likewise.
6594         * arm-reloc-property.h: Likewise.
6595         * arm-reloc.def: Likewise.
6596         * arm.cc: Likewise.
6597         * attributes.h: Likewise.
6598         * cref.cc: Likewise.
6599         * ehframe.cc: Likewise.
6600         * fileread.h: Likewise.
6601         * gold.h: Likewise.
6602         * i386.cc: Likewise.
6603         * icf.cc: Likewise.
6604         * incremental.h: Likewise.
6605         * int_encoding.cc: Likewise.
6606         * layout.h: Likewise.
6607         * main.cc: Likewise.
6608         * merge.h: Likewise.
6609         * object.cc: Likewise.
6610         * object.h: Likewise.
6611         * options.cc: Likewise.
6612         * readsyms.cc: Likewise.
6613         * reduced_debug_output.cc: Likewise.
6614         * reloc.cc: Likewise.
6615         * script-sections.cc: Likewise.
6616         * sparc.cc: Likewise.
6617         * symtab.h: Likewise.
6618         * target-reloc.h: Likewise.
6619         * target.cc: Likewise.
6620         * target.h: Likewise.
6621         * timer.cc: Likewise.
6622         * timer.h: Likewise.
6623         * x86_64.cc: Likewise.
6624
6625 2010-12-09  Cary Coutant  <ccoutant@google.com>
6626
6627         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6628         stack.
6629         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6630         parameter; change all callers.
6631         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6632         * options.h (warn_execstack): New option.
6633
6634 2010-12-07  Doug Kwan  <dougkwan@google.com>
6635
6636         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6637         like function call relocations.
6638
6639 2010-12-07  Ian Lance Taylor  <iant@google.com>
6640
6641         * archive.cc (Archive::get_elf_object_for_member): Permit
6642         punconfigured to be NULL.
6643         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6644         (Archive::include_member): Pass NULL to get_elf_object_for_member
6645         if we searched for the archive and this is the first included
6646         object.
6647
6648 2010-12-01  Ian Lance Taylor  <iant@google.com>
6649
6650         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6651         track_relocs_type_ field.
6652         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6653         Set track_relocs_type_.
6654         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6655         contents when using RELA relocs.
6656         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6657         reloc_map_.
6658         * reloc.cc (Track_relocs::next_addend): New function.
6659         * reloc.h (class Track_relocs): Declare next_addend.
6660
6661 2010-12-01  Ian Lance Taylor  <iant@google.com>
6662
6663         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6664         virtual destructor.
6665
6666 2010-12-01  Ian Lance Taylor  <iant@google.com>
6667
6668         * README: Update compilers known to work and fail.
6669
6670 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6671
6672         * configure.in: For --enable-gold, handle value `default' instead of
6673         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6674         not the default.
6675         * configure: Regenerate.
6676
6677 2010-11-18  Doug Kwan  <dougkwan@google.com>
6678
6679         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6680         and right_alignment to be zero.  Store result alignment only if it is
6681         greater than existing alignment.
6682
6683 2010-11-16  Cary Coutant  <ccoutant@google.com>
6684
6685         PR gold/12220
6686         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6687         Check for ".zdebug_line".
6688
6689 2010-11-16  Doug Kwan  <dougkwan@google.com>
6690             Cary Coutant  <ccoutant@google.com>
6691
6692         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6693         by reference; adjust all callers.
6694         * output.cc (Output_segment::set_section_addresses): Adjust references
6695         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6696         list is empty.
6697         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6698         end at page boundary.
6699
6700 2010-11-16  Cary Coutant  <ccoutant@google.com>
6701
6702         PR gold/12220
6703         * layout.cc (Layout::choose_output_section): Transform names of
6704         compressed sections even when using a script with a SECTIONS clause.
6705         (Layout::output_section_name): Remove code to transform
6706         compressed debug section names.
6707         * output.cc (Output_section::add_input_section): Use uncompressed
6708         section size when tracking input sections.
6709
6710 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6711
6712         * symtab.h (Symbol::NON_PIC_REF): Remove.
6713         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6714         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6715         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6716         (Symbol::use_plt_offset): Take a flags argument and pass it
6717         directly to needs_dynamic_reloc.  Restrict check for undefined
6718         weak symbols to function calls.
6719         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6720         (Target_arm::Scan::global): Use it.
6721         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6722         (Target_arm::Relocate::relocate): Likewise.
6723         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6724         parameter with an r_type parameter.  Use get_reference_flags
6725         to get the flags.
6726         (Target_arm::Relocate::relocate): Update accordingly.
6727         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6728         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6729         (Target_i386::Scan::global): Likewise.
6730         (Target_i386::Relocate::relocate): Likewise.
6731         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6732         parameter with an r_type parameter.  Use get_reference_flags
6733         to get the flags.
6734         (Target_i386::Relocate::relocate): Update accordingly.
6735         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6736         (Target_powerpc::Scan::global): Use it.
6737         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6738         (Target_powerpc::Relocate::relocate): Likewise.
6739         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6740         (Target_sparc::Scan::global): Use it.
6741         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6742         (Target_sparc::Relocate::relocate): Likewise.
6743         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6744         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6745         (Target_x86_64::Scan::global): Likewise.
6746         (Target_x86_64::Relocate::relocate): Likewise.
6747
6748 2010-11-08  Doug Kwan  <dougkwan@google.com>
6749             Cary Coutant  <ccoutant@google.com>
6750
6751         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6752         (Arm_exidx_merge_section::section_contents_): New data member.
6753         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6754         (Arm_input_section::~Arm_input_section): De-allocate memory.
6755         (Arm_input_section::original_contents_): New data member.
6756         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6757         in parameters instead of calling Object::section_contents without
6758         locking.
6759         (Arm_output_section::group_section): New parameter TASK.  Pass it
6760         to callees that need locking objects.
6761         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6762         to lock EXIDX input sections.  Fix a formatting issue.  Call
6763         Arm_exidx_merged_section::build_contents to create merged section
6764         contents.
6765         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6766         to lock object of stub table owner.
6767         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6768         TEXT_SIZE to initialize data member TEXT_SIZE_.
6769         (Arm_exidx_input_section::addralign): Fix typo in comment.
6770         (Arm_exidx_input_section::text_size): New method.
6771         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6772         that require locking objects.  Lock objects before scanning for stubs
6773         and updating local symbols.
6774         (Arm_input_section<big_endian>::init): Copy contents of original
6775         input section.
6776         (Arm_input_section<big_endian>::do_write): Use saved contents of
6777         original input section instead of calling Object::section_contents
6778         without locking.
6779         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6780         size without calling Object::section_size().
6781         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6782         for size.  Allocate a buffer for merged EXIDX entries.
6783         (Arm_exidx_merged_section::build_contents): New method.
6784         (Arm_exidx_merged_section::do_write): Move merge section contents
6785         building code to Arm_exidx_merged_section::build_contetns.  Write
6786         out contetns in buffer instead of building it on the fly.
6787         (Arm_relobj::make_exidx_input_section): Also pass text section size
6788         to Arm_exidx_input_section constructor.
6789         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6790         (Arm_dynobj::do_read_symbols): Fix memory leak.
6791         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6792         * target.h: (class Task): Add forward declaration.
6793         (Target::relax): Add new parameter TASK and pass it to
6794         Target::do_relax().
6795         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6796
6797 2010-11-05  Cary Coutant  <ccoutant@google.com>
6798
6799         PR gold/10708
6800         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6801         object when reading from the file.
6802         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6803         second layout pass.
6804         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6805         when reading section contents.
6806         (get_section_contents): Likewise.
6807         (icf::find_identical_sections): Likewise.
6808         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6809         object when reading from the file.
6810         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6811         the object when doing deferred section layout.
6812
6813 2010-11-03  Nick Clifton  <nickc@redhat.com>
6814
6815         PR gold/12001
6816         * script.h (class Symbol_assignment: name): New member.  Returns
6817         the name of the symbol.
6818         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6819         Returns true if the given symbol name is on the list of
6820         assignments wating to be processed.
6821         * archive.cc (should_incldue_member): If the symbol is undefined,
6822         check to see if it is on the list of symbols pending assignment.
6823
6824 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6825
6826         * script-sections.cc (Script_sections::find_memory_region): Check
6827         for a NULL output section pointer.
6828
6829 2010-10-29  Doug Kwan  <dougkwan@google.com>
6830
6831         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6832         Output_section::add_relaxed_input_section.
6833         * output.cc (Output_section::add_relaxed_input_section): Add new
6834         arguments LAYOUT and NAME.  Set section order index.
6835         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6836         Copy section order index.
6837         * output.h (Output_section::add_relaxed_input_section): Add new
6838         arguments LAYOUT and NAME.
6839
6840 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6841
6842         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6843         NATIVE_OR_CROSS_LINKER.
6844         * testsuite/Makefile.in: Regenerate.
6845
6846 2010-10-20  Doug Kwan  <dougkwan@google.com>
6847
6848         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6849         without SHF_LINK_ORDER flags.
6850         * layout.cc (Layout::choose_output_section): Do not filter
6851         SHF_LINK_ORDER flag in a relocatable link.
6852
6853 2010-10-17  Cary Coutant  <ccoutant@google.com>
6854
6855         * output.h (Output_segment::set_section_addresses): Change function
6856         signature.  Update all callers.
6857         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6858         sections.
6859         (Output_segment::set_section_addresses): Align after last TLS
6860         section.  Add padding before last relro section instead of after.
6861
6862 2010-10-17  Doug Kwan  <dougkwan@google.com>
6863
6864         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6865         GOT output section to be writable.
6866
6867 2010-10-14  Cary Coutant  <ccoutant@google.com>
6868
6869         * debug.h (DEBUG_INCREMENTAL): New flag.
6870         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6871         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6872         mode.
6873         * incremental.cc (report_command_line): Ignore all forms of
6874         --incremental.
6875         * layout.cc (Layout::Layout): Check parameters for incremental link
6876         mode.
6877         * options.cc (General_options::parse_incremental): New function.
6878         (General_options::parse_no_incremental): New function.
6879         (General_options::parse_incremental_full): New function.
6880         (General_options::parse_incremental_update): New function.
6881         (General_options::incremental_mode_): New data member.
6882         (General_options::finalize): Check incremental_mode_.
6883         * options.h (General_options): Update help text for --incremental.
6884         Add --no-incremental, --incremental-full, --incremental-update.
6885         (General_options::Incremental_mode): New enum type.
6886         (General_options::incremental_mode): New function.
6887         (General_options::incremental_mode_): New data member.
6888         * parameters.cc (Parameters::incremental_mode_): New data member.
6889         (Parameters::set_options): Set incremental_mode_.
6890         (Parameters::set_incremental_full): New function.
6891         (Parameters::incremental): New function.
6892         (Parameters::incremental_update): New function.
6893         (set_parameters_incremental_full): New function.
6894         * parameters.h (Parameters::set_incremental_full): New function.
6895         (Parameters::incremental): New function.
6896         (Parameters::incremental_update): New function.
6897         (Parameters::incremental_mode_): New data member.
6898         (set_parameters_incremental_full): New function.
6899         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6900         incremental link mode.
6901         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6902         (Sized_relobj::do_relocate_sections): Likewise.
6903         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6904         option.
6905         * testsuite/Makefile.in: Regenerate.
6906         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6907
6908 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6909
6910         * script-sections.h (class Script_sections): Make
6911         Sections_elements typedef public.
6912         * script-sections.cc (class Sort_output_sections): Add elements_
6913         field.  Add constructor which sets it; change all callers.
6914         (Sort_output_sections::is_before): New function.
6915         (Sort_output_sections::operator()): Call is_before.
6916         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6917         conditional.
6918         * testsuite/script_test_10.sh: New test. Test script section
6919         order.
6920         * testsuite/script_test_10.t: Likewise.
6921         * testsuite/script_test_10.s: Likewise.
6922         * testsuite/Makefile.am: Wrap the cross linker tests and the
6923         common tests into NATIVE_OR_CROSS_LINKER.
6924         (check_SCRIPTS): Add script_test_10.sh.
6925         (check_DATA): Add script_test_10.stdout.
6926         (script_test_10.o, script_test_10): New targets.
6927         (script_test_10.stdout): New target.
6928         * configure, testsuite/Makefile.in: Regenerate.
6929
6930 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6931
6932         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6933         error for the deprecated relocations.
6934         (Target_arm::Scan::global): Likewise.
6935         (Target_arm::Relocate::relocate): Likewise.
6936
6937 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6938
6939         * fileread.cc (Input_file::find_file): Initialize *found_name
6940         and *namep when using the fallback search for case 4.
6941
6942 2010-10-11  Cary Coutant  <ccoutant@google.com>
6943
6944         * options.h (class General_options): Redefine -z lazy as an alias for
6945         the negation of -z now.
6946
6947 2010-10-11  Ian Lance Taylor  <iant@google.com>
6948
6949         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6950         binding.
6951
6952 2010-10-06  Nick Clifton  <nickc@redhat.com>
6953
6954         * script-sections.cc(class Memory_region): Remove
6955         current_lma_offset_ field.  Rename current_vma_offset_ to
6956         current_offset_.  Add last_section_ field.
6957         (Memory_region::get_current_vma_address): Rename to
6958         get_current_address.
6959         (Memory_region::get_current_lma_address): Delete.
6960         (Memory_region::increment_vma_offset): Rename to
6961         increment_offset.
6962         (Memory_region::increment_lma_offset): Delete.
6963         (Memory_region::attributes_compatible): New method.  Returns
6964         true if the provided section is compatible with the region.
6965         (Memory_region::get_last_section): New method.  Returns the last
6966         section to use the region.
6967         (Memory_region::set_last_section): New method.  Stores the last
6968         section to use the region.
6969         (Script_sections::block_in_region): New method.  Returns true if
6970         a block of memory is contained within a region.
6971         (Script_sections::find_memory_region): New method.  Locates a
6972         memory region to be used to set a VMA or LMA address.
6973         (Output_section_definition::set_section_addresses): Add code to
6974         check for addresses set by memory regions.
6975         (Output_segment::set_section_addresses): Remove memory region
6976         walking code.
6977         (Script_sections::create_segment): Add a warning if a header
6978         segment is created outside of any region.
6979         * script-sections.h (class Script_sections): Add prototypes for
6980         find_memory_region and block_in_region methods.
6981         * testsuite/memory_test.s: Use .long instead of .word.
6982         * testsuite/memory_test.t: Add some more output sections.
6983         * testsuite/memory_test.sh: Update expected output.
6984
6985 2010-10-02  Doug Kwan  <dougkwan@google.com>
6986
6987         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6988         defintion to symtab.h
6989         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6990         declaration to defintion.
6991
6992 2010-10-01  Nick Clifton  <nickc@redhat.com>
6993
6994         * expression.cc (eval): Replace dummy argument with NULL.
6995         (eval_maybe_dot): Check for a NULL result section pointer.
6996         (Symbol_expression::value): Likewise.
6997         (Dot_expression::value): Likewise.
6998         (BINARY_EXPRESSION): Likewise.
6999         (Max_expression::value): Likewise.
7000         (Min_expression::value): Likewise.
7001         (Absolute_expression::value): Likewise.
7002         (Addr_expression::value_from_output_section): Likewise.
7003         (Loaddddr_expression::value_from_output_section): Likewise.
7004         (Segment_start_expression::value): Likewise.
7005         * script-sections.cc
7006         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7007         argument with NULL.
7008         (Sections_elememt_dot_assignment::set_section_addresses):
7009         Likewise.
7010         (Output_data_expression::do_write_to_buffer): Likewise.
7011         (Output_section_definition::finalize_symbols): Likewise.
7012         (Output_section_definition::set_section_addresses): Likewise.
7013
7014 2010-09-30  Doug Kwan  <dougkwan@google.com>
7015
7016         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7017
7018 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7019
7020         * target.h (Target::can_icf_inline_merge_sections): New virtual
7021         function.
7022         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7023         virtual function.
7024         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7025         virtual function.
7026         * icf.cc (get_section_contents): Inline merge sections only when
7027         target allows it.
7028
7029 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7030
7031         * configure: Regenerate.
7032
7033 2010-09-17  Ian Lance Taylor  <iant@google.com>
7034
7035         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7036         * testsuite/Makefile.am (memory_test.o): New target.
7037         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7038         memory_test.t.
7039         * testsuite/Makefile.in: Rebuild.
7040
7041 2010-09-17  Doug Kwan  <dougkwan@google.com>
7042
7043         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7044         defintion if relocation uses GOT entries of the symbol.
7045         * testsuite/icf_safe_test.sh: Fix test.
7046         * testsuite/icf_safe_so_test.sh: Fix test.
7047
7048 2010-09-16  Cary Coutant  <ccoutant@google.com>
7049
7050         * script_sections.cc (class Memory_region): Remove "NULL" from
7051         vector initializations.
7052
7053 2010-09-15  Cary Coutant  <ccoutant@google.com>
7054
7055         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7056         Resolve forwarding symbols.
7057
7058 2010-09-15  Doug Kwan  <dougkwan@google.com>
7059
7060         * gold/testsuite/script_test_3.t: Add ARM special sections.
7061         * gold/testsuite/script_test_4.t: Same.
7062         * gold/testsuite/script_test_5.t: Same.
7063         * gold/testsuite/script_test_6.t: Same.
7064         * gold/testsuite/script_test_7.t: Same.
7065         * gold/testsuite/script_test_7.t: Same.
7066         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7067
7068 2010-09-14  Cary Coutant  <ccoutant@google.com>
7069
7070         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7071         (Target_x86_64::Relocate::relocate_tls): Replace check for
7072         saw_tls_block_reloc_ with test for executable section.
7073
7074 2010-09-12  Cary Coutant  <ccoutant@google.com>
7075
7076         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7077         position-independent executables to shared libraries need dynamic
7078         relocations.
7079         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7080         position-independent executables.
7081         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7082         * testsuite/Makefile.in: Regenerate.
7083
7084 2010-09-10  Nick Clifton  <nickc@redhat.com>
7085
7086         PR gold/11997
7087         * testsuite/memory_test.t: Discard any sections that are not
7088         needed.
7089
7090 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7091
7092         PR gold/11996
7093         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7094         "This::" to work around a bug in gcc 4.2.
7095
7096         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7097
7098 2010-09-09  Rafael Espindola  <espindola@google.com>
7099
7100         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7101         sections with different PF_X flags in the same segment.
7102         (Layout::find_first_load_seg): Search all segments to find the first
7103         one.
7104         * options.h (rosegment): New.
7105
7106 2010-09-08  Rafael Espindola  <espindola@google.com>
7107
7108         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7109
7110 2010-09-08  Doug Kwan  <dougkwan@google.com>
7111
7112         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7113         (Arm_relobj::do_relocate_sections): Add new parameter for output
7114         file to match the parent.
7115         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7116         of local symbols instead of input values.  Update code to track
7117         changes in gold::relocate_section.
7118         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7119         (Sized_relobj::compute_final_local_value_internal): New methods.
7120         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7121         body into private version of Sized_relobj::compute_final_local_value.
7122         Call the inline method.
7123         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7124         merged symbol value if there is one.
7125         (Symbol_value::has_output_value): New method defintiion.
7126         (Sized_relobj::Compute_final_local_value_status): New enum type.
7127         (Sized_relobj::compute_final_local_value): New methods.
7128         (Sized_relobj::compute_final_local_value_internal): New methods.
7129         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7130         and arm_cortex_a8.sh.
7131         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7132         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7133         New tests.
7134         * Makefile.in: Regenerate.
7135         * testsuite/arm_bl_out_of_range.s: Update test.
7136         * testsuite/thumb_bl_out_of_range.s: Ditto.
7137         * testsuite/thumb_blx_out_of_range.s: Ditto.
7138         * testsuite/arm_branch_out_of_range.sh: New file.
7139         * testsuite/arm_cortex_a8.sh: Ditto.
7140         * testsuite/arm_cortex_a8_b.s: Ditto.
7141         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7142         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7143         * testsuite/arm_cortex_a8_bl.s: Ditto.
7144         * testsuite/arm_cortex_a8_blx.s: Ditto.
7145         * testsuite/arm_cortex_a8_local.s: Ditto.
7146         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7147         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7148
7149 2010-09-08  Rafael Espindola  <espindola@google.com>
7150
7151         * Makefile.am (memory_test.stdout): Run readelf with -W.
7152         * Makefile.in: Regenerate.
7153         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7154         64 bit output.
7155
7156 2010-09-08  Rafael Espindola  <espindola@google.com>
7157
7158         * script-sections.cc (Script_sections::add_memory_region): Convert
7159         field precision to int.
7160         * script.cc (script_set_section_region, script_set_section_region):
7161         Convert field precision to int.
7162
7163 2010-09-08  Rafael Espindola  <espindola@google.com>
7164
7165         * arm.cc (do_finalize_sections): Create the __exidx_start and
7166         __exdix_end symbols even when the section is missing.
7167
7168 2010-09-08  Nick Clifton  <nickc@redhat.com>
7169
7170         * README: Remove claim that MEMORY is not supported.
7171         * expression.cc (script_exp_function_origin)
7172         (script_exp_function_length): Move from here to ...
7173         * script.cc: ... here.
7174         (script_set_section_region, script_add_memory)
7175         (script_parse_memory_attr, script_include_directive): New
7176         functions.
7177         * script-sections.cc
7178         (class Memory_region): New class.
7179         (class Output_section_definition): Add set_memory_region,
7180         set_section_vma, set_section_lma and get_section_name methods.
7181         (class Script_Sections): Add add_memory_region,
7182         find_memory_region, find_memory_region_origin,
7183         find_memory_region_length and set_memory_region methods.
7184         Have set_section_addresses method walk the list of set memory
7185         regions.
7186         Extend the print methos to display memory regions.
7187         * script-sections.h: Add prototypes for new methods.
7188         Add enum for MEMORY region attributes.
7189         * yyscript.y: Add support for parsing MEMORY regions.
7190         * script-c.h: Add prototypes for new functions.
7191         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7192         * testsuite/Makefile.in: Regenerate.
7193         * testsuite/memory_test.sh: New script.
7194         * testsuite/memory_test.s: New assembler source file.
7195         * testsuite/memory_test.t: New linker script.
7196
7197 2010-08-27  Doug Kwan  <dougkwan@google.com>
7198
7199         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7200         reference override an existing dynamic weak reference.
7201         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7202         * testsuite/Makefile.in: Regenerate.
7203         * testsuite/dyn_weak_ref.sh: New file.
7204         * testsuite/dyn_weak_ref_1.c: Ditto.
7205         * testsuite/dyn_weak_ref_2.c: Ditto.
7206
7207 2010-08-27  Ian Lance Taylor  <iant@google.com>
7208
7209         * incremental.h (class Incremental_input_entry): Add virtual
7210         destructor.
7211
7212 2010-08-27  Ian Lance Taylor  <iant@google.com>
7213
7214         * testsuite/start_lib_test_3.c: Mark t3 as used.
7215
7216 2010-08-27  Nick Clifton  <nickc@redhat.com>
7217
7218         * options.cc (version_script): Fix small typo in previous
7219         whitespace tidyup.
7220
7221 2010-08-25  Nick Clifton  <nickc@redhat.com>
7222
7223         * archive.cc: Formatting fixes: Remove whitespace between
7224         typename and following asterisk.  Remove whitespace between
7225         function name and opening parenthesis.
7226         * archive.h: Likewise.
7227         * arm.cc: Likewise.
7228         * attributes.cc: Likewise.
7229         * attributes.h: Likewise.
7230         * common.cc: Likewise.
7231         * copy-relocs.cc: Likewise.
7232         * dirsearch.h: Likewise.
7233         * dynobj.cc: Likewise.
7234         * ehframe.cc: Likewise.
7235         * ehframe.h: Likewise.
7236         * expression.cc: Likewise.
7237         * fileread.cc: Likewise.
7238         * fileread.h: Likewise.
7239         * gc.h: Likewise.
7240         * gold-threads.cc: Likewise.
7241         * gold.cc: Likewise.
7242         * i386.cc: Likewise.
7243         * icf.h: Likewise.
7244         * incremental-dump.cc: Likewise.
7245         * incremental.cc: Likewise.
7246         * layout.cc: Likewise.
7247         * layout.h: Likewise.
7248         * main.cc: Likewise.
7249         * merge.cc: Likewise.
7250         * merge.h: Likewise.
7251         * object.cc: Likewise.
7252         * object.h: Likewise.
7253         * options.cc: Likewise.
7254         * options.h: Likewise.
7255         * output.cc: Likewise.
7256         * output.h: Likewise.
7257         * plugin.cc: Likewise.
7258         * plugin.h: Likewise.
7259         * powerpc.cc: Likewise.
7260         * reloc.cc: Likewise.
7261         * script-c.h: Likewise.
7262         * script-sections.cc: Likewise.
7263         * script.cc: Likewise.
7264         * stringpool.cc: Likewise.
7265         * symtab.cc: Likewise.
7266         * symtab.h: Likewise.
7267         * target.cc: Likewise.
7268         * timer.cc: Likewise.
7269         * timer.h: Likewise.
7270         * version.cc: Likewise.
7271         * x86_64.cc: Likewise.
7272
7273 2010-08-24  Nick Clifton  <nickc@redhat.com>
7274
7275         PR 11899
7276         * layout.cc (segment_precedes): Sort segments by their physical
7277         addresses, if they have been set.
7278
7279 2010-08-23  Cary Coutant  <ccoutant@google.com>
7280
7281         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7282         symbols data.
7283         (Lib_group::include_member): Unlock object after deleting its
7284         symbols data.
7285         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7286         the bug fixed here.
7287
7288 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7289             Cary Coutant  <ccoutant@google.com>
7290
7291         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7292         constructor, and set_blocker.
7293         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7294         readsyms_blocker_.
7295         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7296         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7297         * testsuite/Makefile.am (start_lib_test): New test case.
7298         * testsuite/Makefile.in: Regenerate.
7299         * testsuite/start_lib_test_main.c: New file.
7300         * testsuite/start_lib_test_1.c: New file.
7301         * testsuite/start_lib_test_2.c: New file.
7302         * testsuite/start_lib_test_3.c: New file.
7303
7304 2010-08-19  Ian Lance Taylor  <iant@google.com>
7305
7306         * Makefile.in: Rebuild with automake 1.11.1.
7307         * aclocal.m4: Likewise.
7308         * testsuite/Makefile.in: Likewise.
7309
7310 2010-08-19  Ian Lance Taylor  <iant@google.com>
7311
7312         PR 10893
7313         * i386.cc (class Output_data_plt_i386): Update declarations.
7314         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7315         local_ifuncs_ fields.
7316         (Target_i386::do_plt_section_for_global): New function.
7317         (Target_i386::do_plt_section_for_local): New function.
7318         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7319         parameter; change all callers.  Initialize global_ifuncs_ and
7320         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7321         __rel_iplt_end.
7322         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7323         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7324         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7325         symbols.
7326         (Target_i386::make_plt_section): New function, broken out of
7327         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7328         (Target_i386::make_plt_entry): Call make_plt_section.
7329         (Target_i386::make_local_ifunc_plt_entry): New function.
7330         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7331         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7332         R_386_IRELATIVE to switch.
7333         (Target_i386::Scan::global): Likewise.
7334         (Target_i386::Relocate::relocate): Likewise.
7335         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7336         switch.
7337         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7338         (Target_x86_64::do_plt_section_for_global): New function.
7339         (Target_x86_64::do_plt_section_for_local): New function.
7340         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7341         parameter; change all callers.  If doing a static link define
7342         __rela_iplt_start and __rela_iplt_end.
7343         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7344         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7345         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7346         to point to .plt.
7347         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7348         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7349         switch.
7350         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7351         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7352         R_X86_64_IRELATIVE to switch.
7353         (Target_x86_64::Scan::global): Likewise.
7354         (Target_x86_64::Relocate::relocate): Likewise.
7355         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7356         switch.
7357         * target.h (class Target): Add plt_section_for_global and
7358         plt_section_for_local functions.  Add do_plt_section_for_global
7359         and do_plt_section_for_local virtual functions.
7360         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7361         clarifying comments.
7362         (Symbol::use_plt_offset): Handle IFUNC symbol.
7363         * object.cc (Sized_relobj::Sized_relobj): Initialize
7364         local_plt_offsets_.
7365         (Sized_relobj::local_has_plt_offset): New function.
7366         (Sized_relobj::local_plt_offset): New function.
7367         (Sized_relobj::set_local_plt_offset): New function.
7368         (Sized_relobj::do_count): Handle IFUNC symbol.
7369         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7370         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7371         is_ifunc_symbol functions.
7372         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7373         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7374         local_plt_offsets_ field.
7375         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7376         * output.h (class Output_section_data): Add non-const
7377         output_section function.
7378         (class Output_data_got): Update declarations.
7379         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7380         Add use_plt_offset parameter to global and local constructors.
7381         Change all callers.  Change local_sym_index_ field to 31 bits.
7382         Change GSYM_CODE and CONSTANT_CODE accordingly.
7383         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7384         doing a static link don't set sh_link field.
7385         (Output_data_got::Got_entry::write): Use PLT offset if
7386         appropriate.
7387         (Output_data_got::add_global_plt): New function.
7388         (Output_data_got::add_local_plt): New function.
7389         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7390         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7391         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7392         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7393         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7394         IFUNC conditional.
7395         * testsuite/ifunc-sel.h: New file.
7396         * testsuite/ifuncmain1.c: New file.
7397         * testsuite/ifuncmain1vis.c: New file.
7398         * testsuite/ifuncmod1.c: New file.
7399         * testsuite/ifuncdep2.c: New file.
7400         * testsuite/ifuncmain2.c: New file.
7401         * testsuite/ifuncmain3.c: New file.
7402         * testsuite/ifuncmod3.c: New file.
7403         * testsuite/ifuncmain4.c: New file.
7404         * testsuite/ifuncmain5.c: New file.
7405         * testsuite/ifuncmod5.c: New file.
7406         * testsuite/ifuncmain6pie.c: New file.
7407         * testsuite/ifuncmod6.c: New file.
7408         * testsuite/ifuncmain7.c: New file.
7409         * configure, testsuite/Makefile.in: Rebuild.
7410
7411 2010-08-18  Ian Lance Taylor  <iant@google.com>
7412
7413         * incremental.cc
7414         (Output_section_incremental_inputs::write_input_files): Add cast
7415         to avoid signed/unsigned comparison warning.
7416         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7417
7418 2010-08-12  Cary Coutant  <ccoutant@google.com>
7419
7420         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7421
7422 2010-08-13  Ian Lance Taylor  <iant@google.com>
7423
7424         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7425
7426 2010-08-12  Cary Coutant  <ccoutant@google.com>
7427             Doug Kwan  <dougkwan@google.com>
7428
7429         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7430         defintion overrides non-weak undef, remember that the original undef
7431         is not weak.
7432         * symtab.cc (Symbol_table::sized_write_global): For undef without
7433         an original weak binding, set binding to global in output.
7434         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7435         * testsuite/Makefile.in: Regenerate.
7436         * testsuite/strong_ref_weak_def.sh: New file.
7437         * testsuite/strong_ref_weak_def_1.c: Ditto.
7438         * testsuite/strong_ref_weak_def_2.c: Ditto.
7439
7440 2010-08-12  Cary Coutant  <ccoutant@google.com>
7441
7442         * testsuite/incremental_test.sh: Rewrite.
7443         * testsuite/incremental_test_1.c: Rewrite.
7444         * testsuite/incremental_test_2.c: Rewrite.
7445
7446 2010-08-12  Cary Coutant  <ccoutant@google.com>
7447
7448         * arm.cc (Target_arm::got_size): Add const.
7449         (Target_arm::got_entry_count): New function.
7450         (Target_arm::plt_entry_count): New function.
7451         (Target_arm::first_plt_entry_offset): New function.
7452         (Target_arm::plt_entry_size): New function.
7453         (Output_data_plt_arm::entry_count): New function.
7454         (Output_data_plt_arm::first_plt_entry_offset): New function.
7455         (Output_data_plt_arm::get_plt_entry_size): New function.
7456         * i386.cc (Target_i386::got_size): Add const.
7457         (Target_i386::got_entry_count): New function.
7458         (Target_i386::plt_entry_count): New function.
7459         (Target_i386::first_plt_entry_offset): New function.
7460         (Target_i386::plt_entry_size): New function.
7461         (Output_data_plt_i386::entry_count): New function.
7462         (Output_data_plt_i386::first_plt_entry_offset): New function.
7463         (Output_data_plt_i386::get_plt_entry_size): New function.
7464         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7465         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7466         * incremental.cc: Include target.h.
7467         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7468         parameter.  Adjust all callers.  Find incremental_got_plt section.
7469         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7470         section.
7471         (Output_section_incremental_inputs::set_final_data_size): Calculate
7472         size of incremental_got_plt section.
7473         (Output_section_incremental_inputs::do_write): Write the
7474         incremental_got_plt section.
7475         (Got_plt_view_info): New struct.
7476         (Local_got_offset_visitor): New class.
7477         (Global_got_offset_visitor): New class.
7478         (Global_symbol_visitor_got_plt): New class.
7479         (Output_section_incremental_inputs::write_got_plt): New function.
7480         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7481         Add parameter.  Adjust all callers.
7482         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7483         (Incremental_inputs::got_plt_section): New function.
7484         (Incremental_inputs::got_plt_section_): New data member.
7485         (Incremental_got_plt_reader): New class.
7486         * layout.cc (Layout::create_incremental_info_sections): Add the
7487         incremental_got_plt section.
7488         * object.h (Got_offset_list::get_list): New function.
7489         (Got offset_list::for_all_got_offsets): New function.
7490         (Sized_relobj::local_got_offset_list): New function.
7491         * powerpc.cc (Target_powerpc::got_size): Add const.
7492         (Target_powerpc::got_entry_count): New function.
7493         (Target_powerpc::plt_entry_count): New function.
7494         (Target_powerpc::first_plt_entry_offset): New function.
7495         (Target_powerpc::plt_entry_size): New function.
7496         (Output_data_plt_powerpc::entry_count): New function.
7497         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7498         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7499         * sparc.cc (Target_sparc::got_size): Add const.
7500         (Target_sparc::got_entry_count): New function.
7501         (Target_sparc::plt_entry_count): New function.
7502         (Target_sparc::first_plt_entry_offset): New function.
7503         (Target_sparc::plt_entry_size): New function.
7504         (Output_data_plt_sparc::entry_count): New function.
7505         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7506         (Output_data_plt_sparc::get_plt_entry_size): New function.
7507         * symtab.h (Symbol::got_offset_list): New function.
7508         (Symbol_table::for_all_symbols): New function.
7509         * target.h (Sized_target::got_entry_count): New function.
7510         (Sized_target::plt_entry_count): New function.
7511         (Sized_target::plt_entry_size): New function.
7512         * x86_64.cc (Target_x86_64::got_size): Add const.
7513         (Target_x86_64::got_entry_count): New function.
7514         (Target_x86_64::plt_entry_count): New function.
7515         (Target_x86_64::first_plt_entry_offset): New function.
7516         (Target_x86_64::plt_entry_size): New function.
7517         (Output_data_plt_x86_64::entry_count): New function.
7518         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7519         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7520
7521 2010-08-12  Cary Coutant  <ccoutant@google.com>
7522
7523         * archive.cc: Include incremental.h.
7524         (Archive::Archive): Initialize incremental_info_.
7525         (Archive::include_member): Record archive members in incremental info.
7526         (Add_archive_symbols::run): Record begin and end of an archive in
7527         incremental info.
7528         (Lib_group::include_member): Record objects in incremental info.
7529         * archive.h (Incremental_archive_entry): Forward declaration.
7530         (Archive::set_incremental_info): New member function.
7531         (Archive::incremental_info): New member function.
7532         (Archive::Unused_symbol_iterator): New class.
7533         (Archive::unused_symbols_begin): New member function.
7534         (Archive::unused_symbols_end): New member function.
7535         (Archive::incremental_info_): New data member.
7536         * incremental-dump.cc (find_input_containing_global): New function.
7537         (dump_incremental_inputs): Dump new incremental info sections.
7538         * incremental.cc: Include symtab.h.
7539         (Output_section_incremental_inputs): New class.
7540         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7541         new incremental info sections.
7542         (Sized_incremental_binary::do_check_inputs): Likewise.
7543         (Incremental_inputs::report_archive): Remove.
7544         (Incremental_inputs::report_archive_begin): New function.
7545         (Incremental_inputs::report_archive_end): New function.
7546         (Incremental_inputs::report_object): New function.
7547         (Incremental_inputs::finalize_inputs): Remove.
7548         (Incremental_inputs::report_input_section): New function.
7549         (Incremental_inputs::report_script): Rewrite.
7550         (Incremental_inputs::finalize): Do nothing but finalize string table.
7551         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7552         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7553         (Incremental_inputs::create_data_sections): New function.
7554         (Incremental_inputs::relocs_entsize): New function.
7555         (Output_section_incremental_inputs::set_final_data_size): New function.
7556         (Output_section_incremental_inputs::do_write): New function.
7557         (Output_section_incremental_inputs::write_header): New function.
7558         (Output_section_incremental_inputs::write_input_files): New function.
7559         (Output_section_incremental_inputs::write_info_blocks): New function.
7560         (Output_section_incremental_inputs::write_symtab): New function.
7561         * incremental.h (Incremental_script_entry): Forward declaration.
7562         (Incremental_object_entry): Forward declaration.
7563         (Incremental_archive_entry): Forward declaration.
7564         (Incremental_inputs): Forward declaration.
7565         (Incremental_inputs_header_data): Remove.
7566         (Incremental_inputs_header): Remove.
7567         (Incremental_inputs_header_write): Remove.
7568         (Incremental_inputs_entry_data): Remove.
7569         (Incremental_inputs_entry): Remove.
7570         (Incremental_inputs_entry_write): Remove.
7571         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7572         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7573         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7574         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7575         Likewise.
7576         (Incremental_input_entry): New class.
7577         (Incremental_script_entry): New class.
7578         (Incremental_object_entry): New class.
7579         (Incremental_archive_entry): New class.
7580         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7581         (Incremental_inputs::report_inputs): Remove.
7582         (Incremental_inputs::report_archive): Remove.
7583         (Incremental_inputs::report_archive_begin): New function.
7584         (Incremental_inputs::report_archive_end): New function.
7585         (Incremental_inputs::report_object): Change prototype.
7586         (Incremental_inputs::report_input_section): New function.
7587         (Incremental_inputs::report_script): Change prototype.
7588         (Incremental_inputs::get_reloc_count): New function.
7589         (Incremental_inputs::set_reloc_count): New function.
7590         (Incremental_inputs::create_data_sections): New function.
7591         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7592         (Incremental_inputs::inputs_section): New function.
7593         (Incremental_inputs::symtab_section): New function.
7594         (Incremental_inputs::relocs_section): New function.
7595         (Incremental_inputs::get_stringpool): Add const.
7596         (Incremental_inputs::command_line): Add const.
7597         (Incremental_inputs::inputs): Remove.
7598         (Incremental_inputs::command_line_key): New function.
7599         (Incremental_inputs::input_file_count): New function.
7600         (Incremental_inputs::input_files): New function.
7601         (Incremental_inputs::relocs_entsize): New function.
7602         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7603         (Incremental_inputs::finalize_inputs): Remove.
7604         (Incremental_inputs::Input_info): Remove.
7605         (Incremental_inputs::lock_): Remove.
7606         (Incremental_inputs::inputs_): Change type.
7607         (Incremental_inputs::inputs_map_): Remove.
7608         (Incremental_inputs::current_object_entry_): New data member.
7609         (Incremental_inputs::inputs_section_): New data member.
7610         (Incremental_inputs::symtab_section_): New data member.
7611         (Incremental_inputs::relocs_section_): New data member.
7612         (Incremental_inputs::reloc_count_): New data member.
7613         (Incremental_inputs_reader): New class.
7614         (Incremental_symtab_reader): New class.
7615         (Incremental_relocs_reader): New class.
7616         * layout.cc (Layout::finalize): Move finalization of incremental info
7617         and creation of incremental info sections to follow finalization of
7618         symbol table.  Set offsets for postprocessing sections.
7619         (Layout::create_incremental_info_sections): Call
7620         Incremental_inputs::create_data_sections.  Add incremental symtab
7621         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7622         sections to layout after input sections.
7623         * layout.h (struct Timespec): Forward declaration.
7624         (Layout::incremental_inputs): Add const.
7625         (Layout::create_incremental_info_sections): Add parameter.
7626         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7627         * object.cc: Include incremental.h.
7628         (Relobj::finalize_incremental_relocs): New function.
7629         (Sized_relobj::do_layout): Record input sections in incremental info.
7630         * object.h (Object::output_section): New function.
7631         (Object::output_section_offset): Moved from Relobj.
7632         (Object::get_incremental_reloc_base): New function.
7633         (Object::get_incremental_reloc_count): New function.
7634         (Object::do_output_section): New function.
7635         (Object::do_output_section_offset): Moved from Relobj.
7636         (Object::do_get_incremental_reloc_base): New function.
7637         (Object::do_get_incremental_reloc_count): New function.
7638         (Object::Object): Initialize new data members.
7639         (Relobj::output_section): Renamed do_output_section and moved to
7640         protected.
7641         (Relobj::output_section_offset): Moved to Object.
7642         (Relobj::do_get_incremental_reloc_base): New function.
7643         (Relobj::do_get_incremental_reloc_count): New function.
7644         (Relobj::allocate_incremental_reloc_counts): New function.
7645         (Relobj::count_incremental_reloc): New function.
7646         (Relobj::finalize_incremental_relocs): New function.
7647         (Relobj::next_incremental_reloc_index): New function.
7648         (Relobj::reloc_counts_): New data member.
7649         (Relobj::reloc_bases_): New data member.
7650         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7651         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7652         (Sized_relobj::incremental_relocs_scan): New function.
7653         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7654         (Sized_relobj::incremental_relocs_write): New function.
7655         (Sized_relobj::incremental_relocs_write_reltype): New function.
7656         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7657         incremental link.
7658         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7659         archives and object files elsewhere.
7660         (Add_symbols::run): Report object files here.
7661         (Finish_group::run): Report end of archive at end of group.
7662         * reloc.cc: Include layout.h, incremental.h.
7663         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7664         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7665         (Sized_relobj::incremental_relocs_scan): New function.
7666         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7667         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7668         (Sized_relobj::incremental_relocs_write): New function.
7669         (Sized_relobj::incremental_relocs_write_reltype): New function.
7670         * script.cc (read_input_script): Rewrite test for incremental link.
7671         Change call to Incremental_inputs::report_script.
7672         * symtab.h (Symbol_table::first_global_index): New function.
7673         (Symbol_table::output_count): New function.
7674
7675 2010-08-12  Doug Kwan  <dougkwan@google.com>
7676
7677         * arm.cc (Target_arm::merge_object_attributes): Check command line
7678         options --no-wchar-size-warning and --no-enum-size-warning.
7679         * options.h (General_options): Add ld-compatible options
7680         --no-enum-size-warning and --no-wchar-size-warning.
7681
7682 2010-08-04  Ian Lance Taylor  <iant@google.com>
7683
7684         * x86_64.cc (Target_x86_64::Scan::local): Use
7685         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7686         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7687         (Target_x86_64::Scan::global): Likewise.
7688         (Target_x86_64::Relocate::relocate): Likewise.
7689         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7690         Likewise.
7691
7692 2010-08-03  Cary Coutant  <ccoutant@google.com>
7693
7694         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7695         to reserve space in merged_strings vector. Keep total input size
7696         for stats.
7697         (Output_merge_string::do_print_merge_stats): Print total input size.
7698         * merge.h (Output_merge_string): Add input_size_ field.
7699         * stringpool.cc (Stringpool_template::string_length): Move
7700         implementations out of Stringpool_template class and place in
7701         stringpool.h.
7702         * stringpool.h (string_length): Move out of Stringpool_template.
7703
7704 2010-08-03  Ian Lance Taylor  <iant@google.com>
7705
7706         PR 11712
7707         * layout.cc (relaxation_loop_body): If address of load segment is
7708         set, adjust address to include headers if possible.
7709
7710 2010-08-03  Ian Lance Taylor  <iant@google.com>
7711
7712         * version.cc (version_string): Bump to 1.10.
7713
7714 2010-08-03  Ian Lance Taylor  <iant@google.com>
7715
7716         PR 11805
7717         * layout.h (enum Output_section_order): Define.
7718         (class Layout): Update declarations.
7719         * layout.cc (Layout::get_output_section): Add order parameter.
7720         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7721         is_first_non_relro parameters.  Change all callers.
7722         (Layout::choose_output_section): Likewise.
7723         (Layout::add_output_section_data): Likewise.
7724         (Layout::make_output_section): Likewise.  Set order.
7725         (Layout::default_section_order): New function.
7726         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7727         * output.cc (Output_section::Output_section): Initialize order_.
7728         Don't initialize deleted fields.
7729         (Output_segment::Output_segment): Don't initialize deleted
7730         fields.
7731         (Output_segment::add_output_section_to_load): New function
7732         replacing add_output_section.  Change all callers to call this or
7733         add_output_section_to_nonload.
7734         (Output_segment::add_output_section_to_nonload): New function.
7735         (Output_segment::remove_output_section): Rewrite.
7736         (Output_segment::add_initial_output_data): Likewise.
7737         (Output_segment::has_any_data_sections): Likewise.
7738         (Output_segment::is_first_section_relro): Likewise.
7739         (Output_segment::maximum_alignment): Likewise.
7740         (Output_segment::has_dynamic_reloc): New function replacing
7741         dynamic_reloc_count.  Change all callers.
7742         (Output_segment::has_dynamic_reloc_list): New function replacing
7743         dynamic_reloc_count_list.  Change all callers.
7744         (Output_segment::set_section_addresses): Rewrite.
7745         (Output_segment::set_offset): Rewrite.
7746         (Output_segment::find_first_and_last_list): Remove.
7747         (Output_segment::set_tls_offsets): Rewrite.
7748         (Output_segment::first_section_load_address): Likewise.
7749         (Output_segment::output_section_count): Likewise.
7750         (Output_segment::section_with_lowest_load_address): Likewise.
7751         (Output_segment::write_section_headers): Likewise.
7752         (Output_segment::print_sections_to_map): Likewise.
7753         * output.h (class Output_data): Remove dynamic_reloc_count_
7754         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7755         (Output_data::add_dynamic_reloc): Rewrite.
7756         (Output_data::has_dynamic_reloc): New function.
7757         (Output_data::dynamic_reloc_count): Remove.
7758         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7759         is_last_relro_, is_first_non_relro_, is_interp_,
7760         is_dynamic_linker_section_ fields.  Add order and set_order
7761         functions.  Remove is_relro_local, set_is_relro_local,
7762         is_last_relro, set_is_last_relro, is_first_non_relro,
7763         set_is_first_non_relro functions, is_interp, set_is_interp,
7764         is_dynamic_linker_section, and set_is_dynamic_linker_section
7765         functions.
7766         (class Output_segment): Change Output_data_list from std::list to
7767         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7768         output_bss_ fields.  Update declarations.
7769
7770 2010-08-02  Ian Lance Taylor  <iant@google.com>
7771
7772         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7773         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7774         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7775
7776 2010-08-02  Ian Lance Taylor  <iant@google.com>
7777
7778         PR 11855
7779         * script.cc (Script_options::Script_options): Initialize
7780         symbol_definitions_ and symbol_references_.
7781         (Script_options::add_symbol_assignment): Update
7782         symbol_definitions_ and symbol_references_.
7783         (Script_options::add_symbol_reference): New function.
7784         (script_symbol): New function.
7785         * script.h (class Script_options): Add symbol_definitions_ and
7786         symbol_references_ fields.
7787         (Script_options::referenced_const_iterator): New type.
7788         (Script_options::referenced_begin): New function.
7789         (Script_options::referenced_end): New function.
7790         (Script_options::is_referenced): New function.
7791         (Script_options::any_unreferenced): New function.
7792         * script-c.h (script_symbol): Declare.
7793         * yyscript.y (exp): Call script_symbol.
7794         * symtab.cc: Include "script.h".
7795         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7796         Change all callers.  Check symbols referenced by scripts.
7797         (Symbol_table::add_undefined_symbols_from_command_line): Add
7798         layout parameter.  Change all callers.
7799         (Symbol_table::do_add_undefined_symbols_from_command_line):
7800         Likewise.  Break out loop body.  Check symbols referenced by
7801         scripts.
7802         (Symbol_table::add_undefined_symbol_from_command_line): New
7803         function broken out of
7804         do_add_undefined_symbols_from_command_line.
7805         * symtab.h (class Symbol_table): Update declarations.
7806         * archive.cc: Include "layout.h".
7807         (Archive::should_include_member): Add layout parameter.  Change
7808         all callers.  Check for symbol mentioned in expression.
7809         * archive.h (class Archive): Update declaration.
7810         * object.cc (Sized_relobj::do_should_include_member): Add layout
7811         parameter.
7812         * object.h (Object::should_include_member): Add layout parameter.
7813         Change all callers.
7814         (Object::do_should_include_member): Add layout parameter.
7815         (class Sized_relobj): Update declaration.
7816         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7817         parameter.
7818         * dynobj.h (class Sized_dynobj): Update declaration.
7819         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7820         layout parameter.
7821         * plugin.h (class Sized_pluginobj): Update declaration.
7822
7823 2010-08-02  Ian Lance Taylor  <iant@google.com>
7824
7825         PR 11866
7826         * output.cc (Output_segment::set_offset): Search for the first and
7827         last sections rather than assuming that the list is in order.
7828         (Output_segment::find_first_and_last_list): New function.
7829         * output.h (class Output_segment): Update declarations.
7830         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7831         (relro_strip_test_SOURCES): New variable.
7832         (relro_strip_test_DEPENDENCIES): New variable.
7833         (relro_strip_test_LDFLAGS): New variable.
7834         (relro_strip_test_LDADD): New variable.
7835         (relro_strip_test.so): New target.
7836
7837 2010-08-02  Ian Lance Taylor  <iant@google.com>
7838
7839         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7840         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7841         (Target_i386::got_tlsdesc_section): New function.
7842         (Target_i386::got_section): Create space for GOT entries for
7843         TLSDESC relocations.
7844         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7845         R_386_TLS_GOTDESC.
7846         (Target_i386::Scan::global): Likewise.
7847         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7848         using TLSDESC GOT.
7849         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7850         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7851         (Target_x86_64::got_tlsdesc_section): New function.
7852         (Target_x86_64::got_section): Create space for GOT entries for
7853         TLSDESC relocations.
7854         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7855         R_386_TLS_GOTDESC.
7856         (Target_x86_64::Scan::global): Likewise.
7857         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7858         using TLSDESC GOT.
7859
7860 2010-08-02  Ian Lance Taylor  <iant@google.com>
7861
7862         * testsuite/final_layout.sh: Use dc to convert from hex to
7863         decimal.
7864
7865 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7866
7867         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7868         paramter to the call to gold::gc_process_relocs.
7869         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7870         paramter to the call to gold::gc_process_relocs.
7871         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7872         parameter to the call to gold::gc_process_relocs.
7873         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7874         template parameter to the call to gold::gc_process_relocs.
7875         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7876         paramter to the call to gold::gc_process_relocs.
7877         * gc.h (get_embedded_addend_size): New function.
7878         (gc_process_relocs): Save the size of the reloc for use by ICF.
7879         * icf.cc (get_section_contents): Get the addend from the text section
7880         for SHT_REL relocation sections.
7881         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7882         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7883         * int_encoding.h (read_from_pointer): New overloaded function.
7884         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7885         * testsuite/icf_sht_rel_addend_test.sh: New file.
7886         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7887         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7888
7889 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7890
7891         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7892         * Makefile.in: Regenerate.
7893         * testsuite/Makefile.in: Regenerate.
7894
7895 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7896
7897         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7898         * gold/testsuite/debug_msg.cc: Likewise.
7899         * gold/testsuite/odr_violation1.cc
7900         * gold/testsuite/odr_violation2.cc
7901
7902 2010-07-21  Cary Coutant  <ccoutant@google.com>
7903
7904         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7905         string, and length fields.
7906         (Output_merge_string::Merged_strings_list): New type.
7907         (Output_merge_string::Merged_strings_lists): New typedef.
7908         (Output_merge_string): Replace merged_strings_ with
7909         merged_strings_lists_.
7910         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7911         Merged_strings_list per input object and section.  Don't store pointer
7912         to the string.  Don't store length with each merged string entry.
7913         (Output_merge_string::finalize_merged_data): Loop over list of merged
7914         strings lists.  Recompute length of each merged string.
7915
7916 2010-07-15  Cary Coutant  <ccoutant@google.com>
7917
7918         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7919         here.
7920
7921 2010-07-14  Ian Lance Taylor  <iant@google.com>
7922
7923         * descriptors.cc (Descriptors::open): Report correct name in error
7924         message.
7925
7926 2010-07-13  Doug Kwan  <dougkwan@google.com>
7927
7928         * arm.cc (Arm_input_section::Arm_input_section): For a
7929         SHT_ARM_EXIDX section, always keeps the input sections.
7930         (Arm_input_section::set_exidx_section_link): New method.
7931         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7932         has_errors_ to false.
7933         (Arm_exidx_input_section::has_errors,
7934         Arm_exidx_input_section::set_has_errors): New methods.
7935         (Arm_exidx_input_section::has_errors_): New data member.
7936         (Arm_relobj::get_exidx_shndx_list): New method.
7937         (Arm_output_section::append_text_sections_to_list): Do not skip
7938         section without SHF_EXECINSTR.
7939         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7940         errors.
7941         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7942         section header.  Make error messages more verbose.  Check for
7943         a non-executable section linked to an EXIDX section.
7944         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7945         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7946         check that there is no deferred EXIDX section if we exit early.
7947         Instead of not making an EXIDX section in case of an error, make one
7948         and set the has_errors flag of it.
7949         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7950         in a relocatable link.
7951         (Target_arm::do_relax): Look for the EXIDX output section instead of
7952         assuming that it is called .ARM.exidx.
7953         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7954         section list.  Do not check for SHF_EXECINSTR section flags but
7955         skip any input section with errors.
7956         * output.cc (Output_section::Output_section): Initialize
7957         always_keeps_input_sections_ to false.
7958         (Output_section::add_input_section): Check for
7959         always_keeps_input_sections_.
7960         *  output.h (Output_section::always_keeps_input_sections,
7961         Output_section::set_always_keeps_input_sections): New methods.
7962         (Output_section::always_keeps_input_sections): New data member.
7963
7964 2010-07-13  Rafael Espindola  <espindola@google.com>
7965
7966         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7967         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7968
7969 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7970             Ian Lance Taylor  <iant@google.com>
7971
7972         * output.h (Output_section_lookup_maps::add_merge_section):
7973         Correct check of whether value was inserted.
7974         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7975         (Output_section_lookup_maps::add_relaxed_input_section):
7976         Likewise.
7977         * arm.cc (Target_arm::got_section): Remove used local os.
7978         * i386.cc (Target_i386::got_section): Likewise.
7979         * x86_64.cc (Target_x86_64::got_section): Likewise.
7980         * sparc.cc (Target_sparc::got_section): Likewise.
7981         (Target_sparc::relocate): Remove unused local have_got_offset.
7982         * powerpc.cc (Target_powerpc::relocate): Likewise.
7983
7984 2010-07-13  Ian Lance Taylor  <iant@google.com>
7985
7986         * compressed_output.cc (zlib_decompress): Fix signature in
7987         !HAVE_ZLIB_H case.
7988
7989         * archive.cc (Archive::include_member): Unlock an external member
7990         of a thin archive.  Don't bother to delete an object we know is
7991         NULL.
7992
7993 2010-07-12  Cary Coutant  <ccoutant@google.com>
7994
7995         * compressed_output.cc (zlib_decompress): New function.
7996         (get_uncompressed_size): New function.
7997         (decompress_input_section): New function.
7998         * compressed_output.h (get_uncompressed_size): New function.
7999         (decompress_input_section): New function.
8000         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8001         Handle compressed debug sections.
8002         * layout.cc (is_compressed_debug_section): New function.
8003         (Layout::output_section_name): Map compressed section names to
8004         canonical names.
8005         * layout.h (is_compressed_debug_section): New function.
8006         (is_debug_info_section): Recognize compressed debug sections.
8007         * merge.cc: Include compressed_output.h.
8008         (Output_merge_data::do_add_input_section): Handle compressed
8009         debug sections.
8010         (Output_merge_string::do_add_input_section): Handle compressed
8011         debug sections.
8012         * object.cc: Include compressed_output.h.
8013         (Sized_relobj::Sized_relobj): Initialize new data members.
8014         (build_compressed_section_map): New function.
8015         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8016         * object.h (Object::section_is_compressed): New method.
8017         (Object::do_section_is_compressed): New method.
8018         (Sized_relobj::Compressed_section_map): New type.
8019         (Sized_relobj::do_section_is_compressed): New method.
8020         (Sized_relobj::compressed_sections_): New data member.
8021         * output.cc (Output_section::add_input_section): Handle compressed
8022         debug sections.
8023         * reloc.cc: Include compressed_output.h.
8024         (Sized_relobj::write_sections): Handle compressed debug sections.
8025
8026 2010-07-08  Cary Coutant  <ccoutant@google.com>
8027
8028         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8029         weak when resolving to a dynamic def.
8030         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8031         for weak undef/dynamic def cases. Adjust callers.
8032         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8033         undef_binding_weak_.
8034         (Symbol_table::sized_write_globals): Adjust symbol binding.
8035         (Symbol_table::sized_write_symbol): Add binding parameter.
8036         * symtab.h (Symbol::set_undef_binding): New method.
8037         (Symbol::is_undef_binding_weak): New method.
8038         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8039         (Symbol_table::should_override): Add new parameter.
8040         (Symbol_table::sized_write_symbol): Add new parameter.
8041
8042         * testsuite/weak_undef_file1.cc: Add new test case.
8043         * testsuite/weak_undef_file2.cc: Fix header comment.
8044         * testsuite/weak_undef_test.cc: Add new test case.
8045
8046 2010-06-29  Doug Kwan  <dougkwan@google.com>
8047
8048         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8049         Initialize USE_SYMBOL_.
8050         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8051         definition.
8052         (Arm_reloc_property::uses_symbol_): New data member declaration.
8053         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8054         uses symbol value and symbol is undefined but not weakly undefined.
8055
8056 2010-06-28  Rafael Espindola  <espindola@google.com>
8057
8058         * plugin.cc (Plugin::load): Use dlerror.
8059
8060 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8061
8062         * symtab.cc (detect_odr_violations): When reporting an ODR
8063         violation, report an object where the symbol is defined.
8064
8065 2010-06-25  Doug Kwan  <dougkwan@google.com>
8066
8067         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8068         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8069         definition.
8070         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8071         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8072         target hook to detect function points.
8073         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8074         * icf.h (Icf::check_section_for_function_pointers): Change type of
8075         parameter SECTION_NAME to const reference to std::string.  Use
8076         target hook to determine if section may have unsafe pointers.
8077         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8078         method definition.
8079
8080 2010-06-21  Rafael Espindola  <espindola@google.com>
8081
8082         * fileread.cc (Input_file::find_fie): New
8083         (Input_file::open): Use Input_file::find_fie.
8084         * fileread.h (Input_file::find_fie): New
8085         * plugin.cc (set_extra_library_path): New.
8086         (Plugin::load): Add set_extra_library_path to the transfer vector.
8087         (Plugin_manager::set_extra_library_path): New.
8088         (Plugin_manager::add_input_file): Use the extra search path if set.
8089         (set_extra_library_path(): New.
8090         * plugin.h (Plugin_manager): Add set_extra_library_path and
8091         extra_search_path_.
8092
8093 2010-06-19  Cary Coutant  <ccoutant@google.com>
8094
8095         * layout.cc (gdb_sections): Add .debug_types.
8096         (lines_only_debug_sections): Likewise.
8097
8098 2010-06-18  Rafael Espindola  <espindola@google.com>
8099
8100         * plugin.cc (add_input_file,add_input_library)
8101         (Plugin_manager::add_input_file): Make filename arguments const.
8102         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8103         const.
8104
8105 2010-06-16  Doug Kwan  <dougkwan@google.com>
8106
8107         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8108         .ARM.attributes section if we have not merged any input
8109         attributes sections.
8110
8111 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8112
8113         * arm.cc: Allow combining objects with no EABI version
8114         information.
8115
8116 2010-06-15  Rafael Espindola  <espindola@google.com>
8117
8118         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8119
8120 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8121
8122         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8123         (struct iovec): Correct !HAVE_READV definition.
8124
8125 2010-06-10  Cary Coutant  <ccoutant@google.com>
8126
8127         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8128         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8129         reloc sections.
8130         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8131
8132         PR 11683
8133         * symtab.h (Symbol::is_placeholder): New member function.
8134         * target-reloc.h (relocate_section): Check for placeholder symbols.
8135
8136         * testsuite/Makefile.am (plugin_test_8): New test.
8137         (plugin_test_9): New test.
8138         * testsuite/Makefile.in: Regenerate.
8139
8140 2010-06-09  Nick Clifton  <nickc@redhat.com>
8141
8142         * yyscript.y (input_list_element): Allow strings prefixed with
8143         the '-' character.  Treat these as libraries.
8144         * script.cc (script_add_library): New function.  Adds a library
8145         specified by "-l<name>" found in an input script.
8146         * script-c.h: Add prototype for script_add_library.
8147
8148 2010-06-07  Doug Kwan  <dougkwan@google.com>
8149
8150         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8151         Restrict stub-group size to be within long conditional branch
8152         range when working around cortex-A8 erratum.
8153
8154 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8155
8156         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8157         #ifdef typo.
8158
8159 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8160
8161         PR gold/11658
8162         * output.cc
8163         (Output_section::Input_section_sort_entry::compare_section_ordering):
8164         Change to return non-zero correctly.
8165         (Output_section::Input_section_sort_section_order_index_compare
8166         ::operator()): Change to fix ambiguity in comparisons.
8167
8168 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8169
8170         * gold.h (is_wildcard_string): New function.
8171         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8172         (Layout::layout_eh_frame): Ditto.
8173         (Layout::find_section_order_index): New method.
8174         (Layout::read_layout_from_file): New method.
8175         * layout.h (Layout::find_section_order_index): New method.
8176         (Layout::read_layout_from_file): New method.
8177         (Layout::input_section_position_): New private member.
8178         (Layout::input_section_glob_): New private member.
8179         * main.cc (main): Call read_layout_from_file here.
8180         * options.h (--section-ordering-file): New option.
8181         * output.cc (Output_section::input_section_order_specified_): New
8182         member.
8183         (Output_section::Output_section): Initialize new member.
8184         (Output_section::add_input_section): Add new parameter.
8185         Keep input sections when --section-ordering-file is used.
8186         (Output_section::set_final_data_size): Sort input sections when
8187         section ordering file is specified.
8188         (Output_section::Input_section_sort_entry): Add new parameter.
8189         Check sorting type.
8190         (Output_section::Input_section_sort_entry::compare_section_ordering):
8191         New method.
8192         (Output_section::Input_section_sort_compare::operator()): Change to
8193         consider section_order_index.
8194         (Output_section::Input_section_sort_init_fini_compare::operator()):
8195         Change to consider section_order_index.
8196         (Output_section::Input_section_sort_section_order_index_compare
8197         ::operator()): New method.
8198         (Output_section::sort_attached_input_sections): Change to sort
8199         according to section order when specified.
8200         (Output_section::add_input_section<32, true>): Add new parameter.
8201         (Output_section::add_input_section<64, true>): Add new parameter.
8202         (Output_section::add_input_section<32, false>): Add new parameter.
8203         (Output_section::add_input_section<64, false>): Add new parameter.
8204         * output.h (Output_section::add_input_section): Add new parameter.
8205         (Output_section::input_section_order_specified): New
8206         method.
8207         (Output_section::set_input_section_order_specified): New method.
8208         (Input_section::Input_section): Initialize section_order_index_.
8209         (Input_section::section_order_index): New method.
8210         (Input_section::set_section_order_index): New method.
8211         (Input_section::section_order_index_): New member.
8212         (Input_section::Input_section_sort_section_order_index_compare): New
8213         struct.
8214         (Output_section::input_section_order_specified_): New member.
8215         * script-sections.cc (is_wildcard_string): Delete and move modified
8216         method to gold.h.
8217         (Output_section_element_input::Output_section_element_input): Modify
8218         call to is_wildcard_string.
8219         (Output_section_element_input::Input_section_pattern
8220         ::Input_section_pattern): Ditto.
8221         (Output_section_element_input::Output_section_element_input): Ditto.
8222         * testsuite/Makefile.am (final_layout): New test case.
8223         * testsuite/Makefile.in: Regenerate.
8224         * testsuite/final_layout.cc: New file.
8225         * testsuite/final_layout.sh: New file.
8226
8227 2010-06-01  Rafael Espindola  <espindola@google.com>
8228
8229         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8230
8231 2010-06-01  Rafael Espindola  <espindola@google.com>
8232
8233         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8234         visibility of symbols.
8235
8236 2010-05-27  Doug Kwan  <dougkwan@google.com>
8237
8238         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8239         from start of output section instead of address for a local symbol
8240         in a merged or relaxed section when doing a relocatable link.
8241
8242 2010-05-26  Rafael Espindola  <espindola@google.com>
8243
8244         PR 11604
8245         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8246         adding sections the garbage collector removed.
8247         * gold/testsuite/Makefile.am: Add test.
8248         * gold/testsuite/Makefile.in: Regenerate.
8249         * gold/testsuite/plugin_test_7.sh: New.
8250         * gold/testsuite/plugin_test_7_1.c: New.
8251         * gold/testsuite/plugin_test_7_2.c: New.
8252
8253 2010-05-26  Rafael Espindola  <espindola@google.com>
8254
8255         * script-sections.cc (Output_section_definition::set_section_addresses):
8256         Check for --section-start.
8257
8258 2010-05-26  Doug Kwan  <dougkwan@google.com>
8259
8260         * arm.cc (Arm_scan_relocatable_relocs): New class.
8261         (Target_arm::relocate_special_relocatable): New method.
8262         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8263         (Arm_relocate_functions::thumb_branch_common): Same.
8264         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8265         instead of Default_scan_relocatable_relocs.
8266         * target-reloc.h (relocate_for_relocatable): Let target handle
8267         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8268         * target.h (Sized_target::relocate_special_relocatable): New method.
8269
8270 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8271
8272         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8273
8274 2010-05-23  Doug Kwan  <dougkwan@google.com>
8275
8276         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8277         instead of a cast.
8278         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8279         with a direct branch, not a conditional branch, to a stub.
8280         * merge.cc (Output_merge_base::record_input_section): New method
8281         defintion.
8282         (Output_merge_data::do_add_input_section): Record input section if
8283         keeps-input-sections flag is set.
8284         (Output_merge_string::do_add_input_section): Ditto.
8285         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8286         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8287         INPUT_SECTIONS_.
8288         (Output_merge_base::keeps_input_sections,
8289         Output_merge_base::set_keeps_input_sections,
8290         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8291         method definitions.
8292         (Output_merge_base::Input_sections): New type declaration.
8293         (Output_merge_base::input_sections_begin,
8294         Output_merge_base::input_sections_end,
8295         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8296         (Output_merge_base::bool keeps_input_sections_,
8297         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8298         Output_merge_base::input_sections_): New data members.
8299         (Output_merge_data::do_set_keeps_input_sections): New method
8300         defintion.
8301         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8302         * output.cc (Output_section::Input_section::relobj): Move method
8303         defintion from class declaration to here and handle merge sections.
8304         (Output_section::Input_section::shndx): Ditto.
8305         (Output_section::Output_section): Remove initializations of removed
8306         data members and initialize new data member LOOKUP_MAPS_.
8307         (Output_section::add_input_section): Set keeps-input-sections flag
8308         for a newly created merge output section as appropriate.  Adjust code
8309         to use Output_section_lookup_maps class.
8310         (Output_section::add_relaxed_input_section): Adjst code for lookup
8311         maps code refactoring.
8312         (Output_section::add_merge_input_section): Add a new parameter
8313         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8314         class.  If adding input section to a newly created merge output
8315         section fails, remove the new merge section.
8316         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8317         Adjust code for use of the Output_section_lookup_maps class.
8318         (Output_section::find_merge_section): Ditto.
8319         (Output_section::build_lookup_maps): New method defintion.
8320         (Output_section::find_relaxed_input_section): Adjust code to use
8321         Output_section_lookup_maps class.
8322         (Output_section::get_input_sections): Export merge sections.  Adjust
8323         code to use Output_section_lookup_maps class.
8324         (Output_section:::add_script_input_section): Adjust code to use
8325         Output_section_lookup_maps class.  Update lookup maps for merge
8326         sections also.
8327         (Output_section::discard_states): Use Output_section_lookup_maps.
8328         (Output_section::restore_states): Same.
8329         * output.h (Merge_section_properties): Move class defintion out of
8330         Output_section.
8331         (Output_section_lookup_maps): New class.
8332         (Output_section::Input_section::is_merge_section): New method
8333         defintion.
8334         (Output_section::Input_section::relobj): Move defintion out of class
8335         defintion.  Declare method only.
8336         (Output_section::Input_section::shndx): Ditto.
8337         (Output_section::Input_section::output_merge_base): New method defintion.
8338         (Output_section::Input_section::u2_.pomb): New union field.
8339         (Output_section::Merge_section_by_properties_map,
8340         Output_section::Output_section_data_by_input_section_map,
8341         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8342         Remove types.
8343         (Output_section::add_merge_input_section): Add new parameter
8344         KEEPS_INPUT_SECTIONS.
8345         (Output_section::build_lookup_maps): New method declaration.
8346         (Output_section::merge_section_map_,
8347         Output_section::merge_section_by_properties_map_,
8348         Output_section::relaxed_input_section_map_,
8349         Output_section::is_relaxed_input_section_map_valid_): Remove data
8350         members.
8351         (Output_section::lookup_maps_): New data member.
8352
8353 2010-05-21  Doug Kwan  <dougkwan@google.com>
8354
8355         PR gold/11619
8356         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8357         avoid a compilation error.
8358
8359 2010-05-19  Rafael Espindola  <espindola@google.com>
8360
8361         * script-sections.cc (Output_section_definition::allocate_to_segment):
8362         Update the phdrs_list even when the output section is NULL.
8363         * testsuite/Makefile.am: Add test.
8364         * testsuite/Makefile.in: Regenerate.
8365         * testsuite/script_test_9.cc: New.
8366         * testsuite/script_test_9.sh: New.
8367         * testsuite/script_test_9.t: New.
8368
8369 2010-05-19  Doug Kwan  <dougkwan@google.com>
8370
8371         * arm.cc (Arm_input_section::original_size): New method.
8372         (Arm_input_section::do_addralign): Add a cast.
8373         (Arm_input_section::do_output_offset): Remove static cast.
8374         (Arm_input_section::original_addralign,
8375          Arm_input_section::original_size_): Change type to uint32_t.
8376         (Arm_input_section::init): Add safe casts for section alignment
8377         and size.
8378         (Arm_input_section::set_final_data_size): Do not set address and
8379         offset of stub table.
8380         (Arm_output_section::fix_exidx_coverage): Change use of of
8381         Output_section::Simple_input_section to that of
8382         Output_section::Input_section.
8383         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8384         except for the first pass.
8385         * output.cc (Output_section::get_input_sections): Change type of
8386         input_sections to std::list<Input_section>.
8387         (Output_section::add_script_input_section): Rename from
8388         Output_section::add_simple_input_section.  Change type of SIS
8389         parameter from Simple_input_section to Input_section.
8390         * output.h (Output_section::Simple_input_section): Remove class.
8391         (Output_section::Input_section): Change class visibility to public.
8392         (Output_section::Input_section::addralign): Use stored alignments
8393         for special input sections if set.
8394         (Output_section::Input_section::set_addralign): New method.
8395         (Output_section::get_input_sections): Change parameter type from
8396         list of Simple_input_section to list of Input_section.
8397         (Output_section::add_script_input_section): Rename from
8398         Output_section::add_simple_input_section. Change first parameter's
8399         type from Simple_input_section to Input_section and remove the
8400         second and third parameters.
8401         * script-sections.cc (Input_section::Input_section_list): Change
8402         type to list of Output_section::Input_section/
8403         (Input_section_info::Input_section_info): Change parameter type of
8404         INPUT_SECTION to Output_section::Input_section.
8405         (Input_section_info::input_section): Change return type.
8406         (Input_section_info::input_section_): Change type to
8407         Output_section::Input_section.
8408         (Output_section_element_input::set_section_addresses): Adjust code
8409         to use Output_section::Input_section instead of
8410         Output_section::Simple_input_section.  Adjust code for renaming
8411         of Output_section::add_simple_input_section.
8412         (Orphan_output_section::set_section_addresses): Ditto.
8413
8414 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8415
8416         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8417         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8418
8419 2010-05-18  Rafael Espindola  <espindola@google.com>
8420
8421         * options.cc (General_options::finalize): Handle -nostdlib.
8422         * options.h (nostdlib): New option.
8423         * script.cc (script_add_search_dir): Handle -nostdlib.
8424
8425 2010-05-12  Doug Kwan  <dougkwan@google.com>
8426
8427         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8428         attributes section only if there no attributes section after merging.
8429         (Target_arm::merge_object_attributes): Move value of
8430         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8431         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8432         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8433         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8434         and arm_attr_merge_7.stdout.
8435         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8436         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8437         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8438         arm_attr_merge_7b.o): New rules.
8439         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8440         arm_attr_merge_7
8441         * testsuite/Makefile.in: Regenerate.
8442         * testsuite/arm_attr_merge.sh: New file.
8443         * testsuite/arm_attr_merge_[67][ab].s: Same.
8444
8445 2010-05-05  Nick Clifton  <nickc@redhat.com>
8446
8447         * po/es.po: Updated Spanish translation.
8448
8449 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8450
8451         * Makefile.am (install-exec-local): Properly install gold as
8452         default cross linker.
8453         * Makefile.in: Regenerated.
8454
8455 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8456             Nick Clifton  <nickc@redhat.com>
8457
8458         * configure.ac (install_as_default): Define and set to false
8459         unless --enable-gold or --enable-gold=both/gold has been
8460         specified.
8461         * configure: Regenerate.
8462
8463         * Makefile.am (install-exec-local): Install the executable as
8464         'ld.gold'.  If install_as_default is true then also install it as
8465         'ld'.
8466         * Makefile.in: Regenerated.
8467
8468 2010-04-24  Ian Lance Taylor  <iant@google.com>
8469
8470         * layout.cc (Layout::layout_reloc): In relocatable link don't
8471         combine reloc sections for grouped sections.
8472
8473 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8474
8475         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8476         sections that are not ordinary to icf.
8477         * icf.cc (get_section_contents): Handle relocation pointing to section
8478         with no object or shndx information.
8479         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8480         * testsuite/Makefile.in: Regenerate.
8481         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8482         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8483
8484 2010-04-22  Ian Lance Taylor  <iant@google.com>
8485
8486         * expression.cc (Expression::Expression_eval_info): Add
8487         result_alignment_pointer field.
8488         (Expression::eval_with_dot): Add result_alignment_pointer
8489         parameter.  Change all callers.
8490         (Expression::eval_maybe_dot): Likewise.
8491         (class Binary_expression): Add alignment_pointer parameter to
8492         left_value and right_value.  Change all callers.
8493         (BINARY_EXPRESSION): Set result alignment.
8494         (class Trinary_expression): Add alignment_pointer parameter to
8495         arg2_value and arg3_value.  Change all callers.
8496         (Trinary_cond::value): Set result alignment.
8497         (Max_expression::value, Min_expression::value): Likewise.
8498         (Align_expression::value): Likewise.
8499         * script-sections.cc (class Sections_element): Add dot_alignment
8500         parameter to set_section_addresses virtual function.  Update
8501         instantiations.
8502         (class Output_section_element): Likewise.
8503         (Script_sections::create_segments): Add dot_alignment parameter.
8504         Change all callers.
8505         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8506         (Script_sections::set_phdrs_clause_addresses): Likewise.
8507         * script-sections.h: Update declarations.
8508         * script.h: Update declarations.
8509         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8510         min_p_align.
8511         * testsuite/script_test_3.t: Set large alignment.
8512         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8513         segment has expected alignment.
8514
8515 2010-04-22  Nick Clifton  <nickc@redhat.com>
8516
8517         * po/gold.pot: Updated by the Translation project.
8518         * po/vi.po: Updated Vietnamese translation.
8519
8520 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8521
8522         * testsuite/Makefile.am (check_PROGRAMS): Add
8523         icf_virtual_function_folding_test.
8524         * testsuite/Makefile.in: Regenerated.
8525
8526 2010-04-15  Andrew Haley  <aph@redhat.com>
8527
8528         * options.h (merge_exidx_entries): New option.
8529         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8530         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8531         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8532         (Target_arm::merge_exidx_entries): New function.
8533         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8534         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8535         to Arm_exidx_fixup constructor.
8536         Add new arg, merge_exidx_entries.
8537         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8538         Arm_output_section::fix_exidx_coverage.
8539
8540 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8541
8542         * icf.cc (get_section_contents): Check for preemptible functions.
8543         Ignore addend when appropriate.
8544         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8545         section folded.
8546         (add_from_relobj): Check for section folded.
8547         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8548         * symtab.h (should_add_dynsym_entry): Add new parameter.
8549         * target-reloc.h (scan_relocs): Check for section folded.
8550         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8551         Check reloc types for function pointers in shared objects.
8552         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8553         case.
8554         (icf_preemptible_functions_test): New test case.
8555         (icf_string_merge_test): New test case.
8556         * testsuite.Makefile.in: Regenerate.
8557         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8558         bar_glob.  Refactor code.
8559         * testsuite/icf_preemptible_functions_test.cc: New file.
8560         * testsuite/icf_preemptible_functions_test.sh: New file.
8561         * testsuite/icf_string_merge_test.cc: New file.
8562         * testsuite/icf_string_merge_test.sh: New file.
8563         * testsuite/icf_virtual_function_folding_test.cc: New file.
8564         * testsuite/icf_virtual_function_folding_test.sh: New file.
8565
8566 2010-04-14  Doug Kwan  <dougkwan@google.com>
8567
8568         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8569         for local symbol recounting if we remove a section due to ICF.
8570         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8571         there are no regular objects in input.
8572
8573 2010-04-13  Doug Kwan  <dougkwan@google.com>
8574
8575         * arm.cc (Arm_input_section::set_final_data_size): Compute
8576         accurate final data size instead of using current data size.
8577
8578 2010-04-09  Doug Kwan  <dougkwan@google.com>
8579
8580         * layout.cc (Layout::choose_output_section): Handle script section
8581         types.
8582         (Layout::make_output_section_for_script): Add section type parameter.
8583         Handle script section types.
8584         * layout.h (Layout::make_output_section_for_script): Add section
8585         type parameter.
8586         * output.cc (Output_section::Output_section): Initialize data member
8587         is_noload_.
8588         (Output_section::do_reset_address_and_file_offset): Do not set address
8589         to 0 if section is a NOLOAD section.
8590         * output.h (Output_section::is_noload): New method.
8591         (Output_section::set_is_noload): Ditto.
8592         (Output_section::is_noload_): New data member.
8593         * script-c.h (Script_section_type): New enum type.
8594         (struct Parser_output_section_header): Add new file section_type.
8595         * script-sections.cc (Sections_element::output_section_name): Add
8596         parameter for returning script section type.
8597         (Output_section_definition::output_section_name): Ditto.
8598         (Output_section_definition::section_type)P; New method.
8599         (Output_section_definiton::script_section_type_name): Ditto.
8600         (Output_section_definition::script_section_type_): New data member.
8601         (Output_section_definition::Output_section_definition): Initialize
8602         data member Output_section_definition::script_section_type_.
8603         (Output_section_definition::create_sections): Pass script section type
8604         to Layout::make_output_section_for_script.
8605         (Output_section_definition::output_section_name): Return script
8606         section type to caller.
8607         (Output_section_definition::set_section_address): Do not advance
8608         dot value and load address if section type is NOLOAD.  Set address
8609         of NOLOAD sections regardless of section flags.
8610         (Output_section_definition::print): Print section type if it is
8611         not SCRIPT_SECTION_TYPE_NONE.
8612         (Output_section_definition::section_type): New method.
8613         (Output_section_definition::script_section_type_name): Ditto.
8614         (Script_sections::output_section_name): Add new parameter
8615         PSECTION_TYPE for returning script section type.  Pass it to
8616         section elements.  Handle discard sections.
8617         (Sort_output_sections::operator()): Handle NOLOAD sections.
8618         * script-sections.h (Script_sections::Section_type): New enum type.
8619         (Script_sections::output_section_name): Add a new parameter for
8620         returning script section type.
8621         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8622         INFO and NOLOAD.
8623         * yyscript.y (union): Add new field SECTION_TYPE.
8624         (COPY, DSECT, INFO, NOLOAD): New tokens.
8625         (opt_address_and_section_type): Change type to output_section_header.
8626         (section_type): New non-terminal
8627         (section_header): Handle section type.
8628         (opt_address_and_section_type): Return section type value.
8629
8630 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8631
8632         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8633         * testsuite/plugin_common_test_2.c (foo): Likewise.
8634
8635 2010-04-08  Doug Kwan  <dougkwan@google.com>
8636
8637         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8638         Output_merge_data.
8639         * output.cc (Output_section::add_merge_input_section): Simplify
8640         code and return status of Output_merge_base::add_input_section.
8641         Update merge section map only if Output_merge_base::add_input_section
8642         returns true.
8643
8644 2010-04-07  Doug Kwan  <dougkwan@google.com>
8645
8646         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8647         if section is marked as containing instructions but has no mapping
8648         symbols.
8649         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8650         correct section index.
8651         (Arm_relobj::find_linked_text_section): Ditto.
8652
8653 2010-04-07  Cary Coutant  <ccoutant@google.com>
8654
8655         * archive.cc (include_member): Destroy Read_symbols_data object before
8656         releasing file.
8657         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8658         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8659         (Read_symbols_data::~Read_symbols_data) New destructor.
8660         (Section_relocs::Section_relocs) New constructor.
8661         (Section_relocs::~Section_relocs) New destructor.
8662         (Read_relocs_data::Read_relocs_data) New constructor.
8663         (Read_relocs_data::~Read_relocs_data) New destructor.
8664         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8665         pointers to NULL after deleting.
8666
8667 2010-04-07  Doug Kwan  <dougkwan@google.com>
8668
8669         * arm.cc: Replace "endianity" with "endianness" in comments.
8670         (Arm_exidx_cantunwind): Ditto.
8671         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8672         (Arm_relobj::merge_flags_and_attributes): New method.
8673         (Arm_relobj::merge_flags_and_attributes_): New data member.
8674         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8675         (Arm_relobj::scan_sections_for_stubs): Ditto.
8676         (Arm_relobj::do_read_symbols): Check to see if we really want to
8677         merge processor-specific flags and attributes.  Exit early if
8678         an object is empty except for section names and the undefined symbol.
8679         (Target_arm::do_finalize_sections): Move check for ELF format to
8680         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8681         attributes from a regular object only when we have determined that
8682         it is aapropriate.  Do not create an .ARM.attributes section in
8683         output if there is no regular input object.
8684         (Target_arm::merge_processor_specific_flags): Check
8685         --warn-mismatch before printing any error.
8686         (Target_arm::merge_object_attributes): Ditto.
8687         * gold.cc (queue_middle_tasks): Handle the case in which there is
8688         no regular object in input.
8689         * options.cc (General_options::parse_EB): New method.
8690         (General_options::parse_EL): Same.
8691         (General_options::General_options): Initialize endianness_.
8692         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8693         New options.
8694         (General_options::Endianness): New enum.
8695         (General_options::endianness): New method.
8696         (General_options::endianness_): New data member.
8697         * parameters.cc (Parameters::set_options): Check target endianness.
8698         (Parameters::set_target_once): Ditto.
8699         (Parameters::check_target_endianness): New method.
8700         (parameters_force_valid_target): If either -EL or -EB is specified,
8701         use it to define endianness of default target.
8702         * parameters.h (Parameters::check_target_endianness): New method
8703         declaration.
8704         * target.h (class Target): Change "endianity" to "endianness"
8705         in comments.
8706
8707 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8708
8709         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8710         * configure: Regenerate.
8711         * Makefile.in: Regenerate.
8712         * testsuite/Makefile.in: Regenerate.
8713
8714 2010-04-06  Cary Coutant  <ccoutant@google.com>
8715
8716         gcc PR lto/42757
8717         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8718         prevailing definitions of common symbols.
8719         * testsuite/plugin_test_6.sh: New test case.
8720         * testsuite/plugin_common_test_1.c: New test case.
8721         * testsuite/plugin_common_test_2.c: New test case.
8722         * testsuite/Makefile.am (plugin_test_6): New test case.
8723         * testsuite/Makefile.in: Regenerate.
8724
8725 2010-04-06  Nick Clifton  <nickc@redhat.com>
8726
8727         * po/vi.po: New Vietnamese translation.
8728
8729 2010-03-30  Doug Kwan  <dougkwan@google.com>
8730
8731         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8732
8733 2010-03-25  Doug Kwan  <dougkwan@google.com>
8734
8735         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8736         to avoid a conversion warning on a 32-bit host.
8737
8738 2010-03-24  Ian Lance Taylor  <iant@google.com>
8739
8740         * testsuite/script_test_3.t: Add a TLS segment.
8741         * testsuite/Makefile.am (check_PROGRAMS): Add
8742         tls_phdrs_script_test.
8743         (tls_phdrs_script_test_SOURCES): Define.
8744         (tls_phdrs_script_test_DEPENDENCIES): Define.
8745         (tls_phdrs_script_test_LDFLAGS): Define.
8746         (tls_phdrs_script_test_LDADD): Define.
8747         * testsuite/Makefile.in: Rebuild.
8748
8749 2010-03-23  Cary Coutant  <ccoutant@google.com>
8750
8751         * fileread.cc (find_or_make_view): Fix comment.
8752
8753 2010-03-23  Ian Lance Taylor  <iant@google.com>
8754
8755         * script-sections.cc (class Orphan_section_placement): Define
8756         PLACE_TLS and PLACE_TLS_BSS.
8757         (Orphan_section_placement::Orphan_section_placement): Initialize
8758         new places.
8759         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8760         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8761         (tls_script_test_SOURCES): Define.
8762         (tls_script_test_DEPENDENCIES): Define.
8763         (tls_script_test_LDFLAGS): Define.
8764         (tls_script_test_LDADD): Define.
8765         * testsuite/Makefile.in: Rebuild.
8766
8767 2010-03-22  Doug Kwan  <dougkwan@google.com>
8768
8769         * arm.cc (Arm_relocate_functions::abs8,
8770         Arm_relocate_functions::abs16): Use correct check for overflow
8771         specified in the ARM ELF specs.
8772         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8773         target of a BLX instruction specially.
8774         (Reloc_stub::stub_type_for_reloc): Ditto.
8775         (Relocate::relocate): Use symbolic names instead of numeric relocation
8776         codes to report error.
8777         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8778         workaround.
8779         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8780         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8781         thumb2_blx_out_of_range.stdout
8782         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8783         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8784         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8785         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8786         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8787         thumb2_blx_in_range, thumb2_blx_in_range.o,
8788         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8789         thumb2_blx_out_of_range.o): New rules.
8790         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8791         thumb2_blx_in_range and thumb2_blx_out_of_range.
8792         * testsuite/Makefile.in: Regenerate.
8793         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8794         * testsuite/thumb_blx_in_range.s: New file.
8795         * testsuite/thumb_blx_out_of_range.s: New file.
8796
8797 2010-03-22  Rafael Espindola  <espindola@google.com>
8798
8799         * archive.cc (Should_include): Move to archive.h.
8800         (should_include_member): Make it a member of Archive.
8801         (Lib_group): New.
8802         (Add_lib_group_symbols): New.
8803         * archive.h: Include options.h.
8804         (Archive_member): Moved from Archive.
8805         (Should_include): Moved from archive.cc.
8806         (Lib_group): New.
8807         (Add_lib_group_symbols): New.
8808         * dynobj.cc (do_should_include_member): New.
8809         * dynobj.h (do_should_include_member): New.
8810         * gold.cc (queue_initial_tasks): Update call to queue.
8811         * main.cc (main): Print lib group stats.
8812         * object.cc (do_should_include_member): New.
8813         * object.h: Include archive.h.
8814         (Object::should_include_member): New.
8815         (Object::do_should_include_member): New.
8816         (Sized_relobj::do_should_include_member): New.
8817         * options.cc (General_options::parse_start_lib): New.
8818         (General_options::parse_end_lib): New.
8819         (Input_arguments::add_file): Handle lib groups.
8820         (Input_arguments::start_group): Check we are not in a lib.
8821         (Input_arguments::start_lib): New.
8822         (Input_arguments::end_lib): New.
8823         * options.h (General_options): Add start_lib and end_lib.
8824         (Input_argument::lib_): New.
8825         (Input_argument::lib): New.
8826         (Input_argument::is_lib): New.
8827         (Input_file_lib): New.
8828         (Input_arguments::in_lib_): New.
8829         (Input_arguments::in_lib): New.
8830         (Input_arguments::start_lib): New.
8831         (Input_arguments::end_lib_): New.
8832         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8833         in unused members as preempted.
8834         (Sized_pluginobj::do_should_include_member): New.
8835         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8836         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8837         return the blocker.
8838         (Read_symbols::do_whole_lib_group): New.
8839         (Read_symbols::do_lib_group): New.
8840         (Read_symbols::do_read_symbols): Handle lib groups.
8841         (Read_symbols::get_name): Handle lib groups.
8842         * readsyms.h (Read_symbols): Add an archive member pointer.
8843         (Read_symbols::do_whole_lib_group): New.
8844         (Read_symbols::do_lib_group): New.
8845         (Read_symbols::member_): New.
8846         * script.cc (read_input_script): Update call to queue_soon.
8847
8848 2010-03-19  Doug Kwan  <dougkwan@google.com>
8849
8850         * arm.cc (Stub_table::Stub_table): Initialize new data members
8851         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8852         (Stub_table::add_reloc_stub): Assign stub offset and update
8853         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8854         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8855         New data members.
8856         (Stub_table::update_data_size_and_addralign): Use
8857         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8858         instead of going over all reloc stubs.
8859         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8860         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8861         Stringpool_template::offset_ to size of Stringpool_char.
8862         (Stringpool_template::new_key_offset): Remove code to initialize
8863         Stringpool_template::offset_.
8864         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8865         Stringpool_template::offset_ to zero.
8866
8867 2010-03-15  Doug Kwan  <dougkwan@google.com>
8868
8869         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8870         offset_.
8871         (Stringpool_template::new_key_offset): New method.
8872         (Stringpool_template::add_string): Assign offsets when adding new
8873         strings.
8874         (Stringpool_template::set_string_offsets): Do not set string offsets
8875         when not optimizing.
8876         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8877         member size_.
8878         (Chunked_vector::clear): Clear size_.
8879         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8880         (Chunked_vector::size): Return size_.
8881         (Chunked_vector::push_back): Use size_ to find insert position.
8882         (Chunked_vector::size_): New data member.
8883         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8884         (Stringpool_template::new_key_offset): New method declaration.
8885         (Stringpool_template::offset_): New data member.
8886
8887 2010-03-15   Rafael Espindola  <espindola@google.com>
8888
8889         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8890         Add_symbols' constructor.
8891         * readsyms.h (Add_symbols): Remove the input_group member.
8892
8893 2010-03-10  Ian Lance Taylor  <iant@google.com>
8894
8895         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8896         target to ask whether a reference to a symbol requires a stack
8897         split.
8898         * target.h (Target::is_call_to_non_split): New function.
8899         (Target::do_is_call_to_non_split): Declare virtual function.
8900         * target.cc: Include "symtab.h".
8901         (Target::do_is_call_to_non_split): New function.
8902         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8903
8904 2010-03-10  Cary Coutant  <ccoutant@google.com>
8905
8906         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8907         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8908         (File_read::open[2]): Add whole_file_view_ to list of views.
8909         (File_read::make_view): Remove test of whole_file_view_.
8910         (File_read::find_or_make_view): Create whole_file_view_ if
8911         necessary.
8912         (File_read::clear_views): Replace bool parameter with enum;
8913         adjust all callers.  Don't delete views with permanent data;
8914         do delete cached views and views from archives if
8915         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8916         if clearing the corresponding view.
8917         * fileread.h (File_read::Clear_views_mode): New enum.
8918         (File_read::View::is_permanent_view): New method.
8919         (File_read::clear_views): Replace bool parameter
8920         with enum; adjust all callers.
8921         * options.h (General_options): Change keep_files_mapped option;
8922         add map_whole_files.
8923         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8924         releasing the file.
8925         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8926         the file.
8927
8928 2010-03-10  David S. Miller  <davem@davemloft.net>
8929
8930         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8931
8932 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8933
8934         * icf.cc (get_section_contents): Add '@' marker after processing the
8935         merge reloc.
8936
8937 2010-03-08  Doug Kwan  <dougkwan@google.com>
8938
8939         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8940         due to a conversion warning.
8941         (Arm_relobj::update_output_local_symbol_count): Check for local
8942         symbol with unset output index.
8943
8944 2010-03-05  Ian Lance Taylor  <iant@google.com>
8945
8946         * options.h (class General_options): Add --spare-dynamic-tags.
8947         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8948         --spare-dynamic-tags.
8949
8950 2010-03-05  Ian Lance Taylor  <iant@google.com>
8951
8952         * incremental.cc: Include "libiberty.h".
8953
8954 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8955
8956         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8957         function, is_info_ member.
8958         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8959         (Versions::Versions): Update caller.
8960         (Versions::define_base_version): Likewise.
8961         (Versions::add_def): Likewise.
8962
8963 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8964
8965         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8966         (Scan::possible_function_pointer_reloc): New function.
8967         (Scan::local_reloc_may_be_function_pointer): Change to call
8968         possible_function_pointer_reloc.
8969         (Scan::global_reloc_may_be_function_pointer): Ditto.
8970         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8971         relocations in ".data.rel.ro._ZTV" section.
8972         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8973         * testsuite/icf_safe_so_test.cc: Ditto.
8974         * testsuite/icf_safe_test.cc: Ditto.
8975         * testsuite/icf_safe_test.sh: Ditto.
8976
8977 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8978             Ian Lance Taylor  <iant@google.com>
8979
8980         * target-reloc.h (relocate_section): Check the symbol table index
8981         for -1U before setting the local symbol index.
8982         (scan_relocatable_relocs): If copying the relocation, record that
8983         the local symbol is required.
8984         * object.h (Symbol_value::is_output_symtab_index_set): New
8985         function.
8986         (Symbol_value::may_be_discarded_from_output_symtab): New
8987         function.
8988         (Symbol_value::has_output_symtab_entry): New function.
8989         (Symbol_value::needs_output_symtab_entry): Remove.
8990         (Symbol_value::output_symtab_index): Make sure the symbol index is
8991         set.
8992         (Symbol_value::set_output_symtab_index): Make sure the symbol
8993         index is not set.  Make sure the new index is valid.
8994         (Symbol_value::set_must_have_output_symtab_entry): New function.
8995         (Symbol_value::has_output_dynsym_entry): New function.
8996         (Symbol_value::set_output_dynsym_index): Make sure the new index
8997         is valid.
8998         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8999         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9000         local symbol if permitted.
9001         (Sized_relobj::do_finalize_local_symbols): Call
9002         is_output_symtab_index_set rather than needs_output_symtab_entry.
9003         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9004         rather than needs_output_symtab_entry.  Call
9005         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9006         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9007         is_output_symtab_index_set rather than needs_output_symtab_entry.
9008         * testsuite/discard_locals_relocatable_test.c: New file.
9009         * testsuite/discard_locals_test.sh: Test -r.
9010         * testsuite/Makefile.am (check_DATA): Add
9011         discard_locals_relocatable_test1.syms,
9012         discard_local_relocatable_test2.syms.
9013         (MOSTLYCLEANFILES): Likewise.  Also add
9014         discard_locals_relocatable_test1.lout and
9015         discard_locals_relocatable_test2.out.
9016         (discard_locals_relocatable_test1.syms): New target.
9017         (discard_locals_relocatable_test.o): New target.
9018         (discard_locals_relocatable_test1.out): New target.
9019         (discard_locals_relocatable_test2.syms): New target.
9020         (discard_locals_relocatable_test2.out): New target.
9021         (various): Add missing ../ld-new dependencies.
9022         * testsuite/Makefile.in: Rebuild.
9023
9024 2010-03-03  Nick Clifton  <nickc@redhat.com>
9025
9026         * po/fi.po: New Finnish translation.
9027
9028 2010-03-01  Doug Kwan  <dougkwan@google.com>
9029
9030         * layout.cc (Layout::Layout): Force section types of .init_array*,
9031         .preinit_array* and .fini_array* sections.
9032         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9033         Fix check of return value of std::string::find.().
9034         (Output_section::Input_section_sort_compare::operator()): Remove
9035         comment about .init_array.
9036         (Output_section::Input_section_sort_init_fini_compare::operator()):
9037         New method.
9038         (Output_section::sort_attached_input_sections): Handle .init_array
9039         and .fini_array specially.
9040         * output.h (Output_section::Inut_section_sort_compare): Update
9041         comment.
9042         (Output_section::Input_section_sort_init_fini_compare): New struct.
9043
9044 2010-02-26  Doug Kwan  <dougkwan@google.com>
9045
9046         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9047         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9048         * testsuite/debug_msg.sh: Avoid matching source line number for
9049         use of global variable undef_int.
9050
9051 2010-02-26  Doug Kwan  <dougkwan@google.com>
9052
9053         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9054         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9055         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9056         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9057         * options.cc (General_options::General_options): Initialize member
9058         fix_v4bx_.
9059         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9060         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9061         and rm_no_fix_v4bx.stdout
9062         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9063         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9064         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9065         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9066         and arm_no_fix_v4bx.
9067         * Makefile.in: Regenerate.
9068         * testsuite/arm_fix_v4bx.s: New file.
9069         * testsuite/arm_fix_v4bx.sh: Ditto.
9070
9071 2010-02-24  Doug Kwan  <dougkwan@google.com>
9072
9073         * arm.cc (Target_arm::got_section): Make the .got section the first
9074         non RELRO section in the data segment.
9075         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9076         suffixes of section names.
9077
9078 2010-02-24  Doug Kwan  <dougkwan@google.com>
9079
9080         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9081         flags and attributes merging if an input file is a binary file.
9082         * fileread.cc (Input_file::open): Record format of original file.
9083         * fileread.h (Input_file::Format): New enum type.
9084         (Input_file::Input_file): Initialize data member format_.
9085         (Input_file::format): New method definition.
9086         (Input_file::format_):: New data member.
9087
9088 2010-02-24  Doug Kwan  <dougkwan@google.com>
9089
9090         * arm.cc (Arm_output_data_got): New class.
9091         (ARM_TCB_SIZE): New constant
9092         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9093         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9094         If user uses a script with a SECTIONS clause, issue only a warning
9095         for a misplaced EXIDX input section.  Otherwise, issue an error.
9096         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9097         garbage collection.
9098         (Target_arm::got_mode_index_entry): Handle static linking.
9099         (Target_arm::Scan::local): Ditto.
9100         (Target_arm::Scan::global): Ditto.
9101         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9102         all incorrectly implemented relocations.
9103         (Target_arm::fix_exidx_coverage): Pass layout to
9104         Arm_output_section::fix_exidx_coverage.
9105         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9106         from ".ARM.exidx." and ".ARM.extab.".
9107
9108 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9109
9110         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9111         section if it does not already exist.
9112         * attributes.cc (Attributes_section_data::Attributes_section_data):
9113         Don't crash if size is zero.
9114
9115 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9116             Ian Lance Taylor  <iant@google.com>
9117
9118         * gold.cc (queue_middle_tasks): If no input files were opened,
9119         exit.
9120         * workqueue.h (Task_function::Task_function): Assert that there is
9121         a blocker.
9122
9123 2010-02-22  Doug Kwan  <dougkwan@google.com>
9124
9125         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9126         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9127         types to avoid warnings due to different uint64_t implementations
9128         on different hosts.
9129
9130 2010-02-21  Doug Kwan  <dougkwan@google.com>
9131
9132         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9133         handling of the maximum backward branch offset.
9134         (Arm_relocate_functions::thumb_branch_common): Ditto.
9135         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9136         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9137         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9138         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9139         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9140         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9141         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9142         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9143         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9144         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9145         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9146         thumb2_bl_out_of_range.o): New rules.
9147         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9148         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9149         thumb2_bl_out_of_range
9150         * testsuite/Makefile.in: Regenerate.
9151         * testsuite/arm_bl_in_range.s: New file.
9152         * testsuite/arm_bl_out_of_range.s: Ditto.
9153         * testsuite/arm_branch_in_range.sh: Ditto.
9154         * testsuite/arm_branch_range.t: Ditto.
9155         * testsuite/thumb2_branch_range.t: Ditto.
9156         * testsuite/thumb_bl_in_range.s: Ditto.
9157         * testsuite/thumb_bl_out_of_range.s: Ditto.
9158         * testsuite/thumb_branch_range.t: Ditto.
9159
9160 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9161
9162         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9163         Add reloc offset information.
9164         * icf.cc (get_section_contents): Change iterators to point to the new
9165         vectors. Add reloc offset information to the contents.
9166         * icf.h (Icf::Sections_reachable_info): New typedef.
9167         (Icf::Sections_reachable_list): New typedef.
9168         (Icf::Offset_info): New typedef.
9169         (Icf::Reloc_info): New struct typedef.
9170         (Icf::Reloc_info_list): New typedef.
9171         (Icf::symbol_reloc_list): Delete method.
9172         (Icf::addend_reloc_list): Delete method.
9173         (Icf::section_reloc_list): Delete method.
9174         (Icf::reloc_info_list): New method.
9175         (Icf::reloc_info_list_): New member.
9176
9177 2010-02-19  Doug Kwan  <dougkwan@google.com>
9178
9179         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9180         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9181         * arm.cc (Arm_relocation_functions): New forward declaration.
9182         (Target_arm::Target_arm): Initialize new data members
9183         got_mod_index_offset_ and tls_base_symbol_defined_.
9184         (Target_arm::Relocate::relocate_tls): New method.
9185         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9186          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9187         New methods.
9188         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9189         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9190         (Target_arm::got_mod_index_offset_,
9191         Target_arm::tls_base_symbol_defined_): New data members.
9192         (Target_arm::Scan::local, Target::Scan::global,
9193         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9194         relocations.
9195
9196 2010-02-18  Doug Kwan  <dougkwan@google.com>
9197
9198         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9199         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9200         text section as a parameter becuase some broken tools may not set
9201         the link in section header.
9202         (Target_arm::has_got_section): New method.
9203         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9204         without any mapping symbol as data only.  Remove warning.
9205         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9206         link in its section header, try to discover the link by inspecting the
9207         REL31 relocation at the beginning of the section.
9208         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9209         in error message.
9210         (Target_arm::Scan::global): Treat any reference to the symbol
9211         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9212
9213 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9214
9215         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9216         (Scan::global_reloc_may_be_function_pointer): New function.
9217         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9218         (Scan::global_reloc_may_be_function_pointer): New function.
9219         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9220         (Scan::global_reloc_may_be_function_pointer): New function.
9221         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9222         (Scan::global_reloc_may_be_function_pointer): New function.
9223         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9224         (Scan::global_reloc_may_be_function_pointer): New function.
9225         (Scan::possible_function_pointer_reloc): New function.
9226         (Target_x86_64::can_check_for_function_pointers): New function.
9227         * gc.h (gc_process_relocs): Scan relocation types to determine if
9228         function pointers were taken for targets that support it.
9229         * icf.cc (Icf::find_identical_sections): Include functions for
9230         folding in safe ICF whose pointer is not taken.
9231         * icf.h (Secn_fptr_taken_set): New typedef.
9232         (fptr_section_id_): New member.
9233         (section_has_function_pointers): New function.
9234         (set_section_has_function_pointers): New function.
9235         (check_section_for_function_pointers): New function.
9236         * options.h: Fix comment for safe ICF option.
9237         * target.h (can_check_for_function_pointers): New function.
9238         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9239         Modify icf_safe_test for X86-64.
9240         * testsuite/Makefile.in: Regenerate.
9241         * testsuite/icf_safe_so_test.cc: New file.
9242         * testsuite/icf_safe_so_test.sh: New file.
9243         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9244         (main): Change to take pointer to function kept_func_3.
9245         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9246         folding is done correctly for X86-64.
9247
9248 2010-02-12  David S. Miller  <davem@davemloft.net>
9249
9250         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9251         is_symbolless parameter.
9252         (Output_reloc<SHT_REL>::is_symbolless): New.
9253         (Output_reloc<SHT_REL>::is_symbolless_): New.
9254         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9255         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9256         (Output_reloc<SHT_RELA>::is_symbolless): New.
9257         (Output_data_reloc::add_global): Handle is_symbolless.
9258         (Output_data_reloc::add_global_relative): Likewise.
9259         (Output_data_reloc::add_local): Likewise.
9260         (Output_data_reloc::add_local_relative): Likewise.
9261         (Output_data_reloc::add_symbolless_global_addend): New.
9262         (Output_data_reloc::add_symbolless_local_addend): New.
9263         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9264         is_symbolless.
9265         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9266         instead of ->is_relative_
9267         (Output_reloc::write): Likewise.
9268         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9269         (Output_reloc::write_rel): Simplify.
9270
9271         * sparc.cc (Target_sparc::Scan::local): Use
9272         ->add_symbolless_local_addend as needed.
9273         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9274         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9275         based upon relocation offset.
9276
9277 2010-02-11  Doug Kwan  <dougkwan@google.com>
9278
9279         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9280         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9281         beginning of function.
9282         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9283         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9284         parameter is_32bit in calls to should_apply_static_reloc.
9285         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9286         (check_DATA): Add arm_abs_global.stdout.
9287         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9288         arm_abs_global.stdout): New rules.
9289         (MOSTLLYCLEANFILES): Add arm_abs_global
9290         * Makefile.in: Regenerate.
9291         * testsuite/arm_abs_global.s: New file.
9292         * testsuite/arm_abs_global.sh: Ditto.
9293         * testsuite/arm_abs_lib.s: Ditto.
9294
9295 2010-02-11  Ian Lance Taylor  <iant@google.com>
9296
9297         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9298         Read_relocs task.
9299         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9300         Allocate_commons_task first.
9301         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9302         task, rather than symtab_lock_.
9303         (Gc_process_relocs::~Gc_process_relocs): New function.
9304         (Gc_process_relocs::is_runnable): Check this_blocker_.
9305         (Gc_process_relocs::locks): Use next_blocker_ rather than
9306         blocker_.
9307         (Scan_relocs::~Scan_relocs): New function.
9308         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9309         symtab_lock_.
9310         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9311         next_blocker_.
9312         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9313         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9314         constructor accordingly.
9315         (class Gc_process_relocs): Likewise.
9316         (class Scan_relocs): Likewise.
9317         * common.h (class Allocate_commons_task): Remove symtab_lock_
9318         field, and corresponding constructor parameter.
9319         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9320         symtab_lock_.
9321         (Allocate_commons_task::locks): Likewise.
9322
9323 2010-02-11  Ian Lance Taylor  <iant@google.com>
9324
9325         * gold-threads.h (class Once): Define.
9326         (class Initialize_lock): Rewrite as child of Once.
9327         * gold-threads.cc (class Once_initialize): Define.
9328         (once_pointer_control): New static variable.
9329         (once_pointer, once_arg): New static variables.
9330         (c_run_once): New static function.
9331         (Once::Once, Once::run_once, Once::internal_run): New functions.
9332         (class Initialize_lock_once): Remove.
9333         (initialize_lock_control): Remove.
9334         (initialize_lock_pointer): Remove.
9335         (initialize_lock_once): Remove.
9336         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9337         (Initialize_lock::initialize): Rewrite.
9338         (Initialize_lock::do_run_once): New function.
9339         * archive.cc (Archive::interpret_header): Only clear name if it is
9340         not already empty.
9341         * fileread.cc: Include "gold-threads.h"
9342         (file_counts_lock): New static variable.
9343         (file_counts_initialize_lock): Likewise.
9344         (File_read::release): Only increment counts when using --stats.
9345         Use a lock around the increment.
9346         * parameters.cc (class Set_parameters_target_once): Define.
9347         (set_parameters_target_once): New static variable.
9348         (Parameters::Parameters): Move here from parameters.h.
9349         (Parameters::set_target): Rewrite.
9350         (Parameters::set_target_once): New function.
9351         (Parameters::clear_target): Move here and rewrite.
9352         * parameters.h (class Parameters): Update declarations.  Add
9353         set_parameters_target_once_ field.
9354         (Parameters::Parameters): Move to parameters.cc.
9355         (Parameters::clear_target): Likewise.
9356         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9357         task.
9358         (Start_group::~Start_group): New function.
9359         (Start_group::is_runnable): New function.
9360         (Start_group::locks, Start_group::run): New functions.
9361         (Finish_group::run): Change saw_undefined to size_t.
9362         * readsyms.h (class Start_group): Define.
9363         (class Finish_group): Change saw_undefined_ field to size_t.
9364         (Finish_group::Finish_group): Remove saw_undefined and
9365         this_blocker parameters.  Change all callers.
9366         (Finish_group::set_saw_undefined): New function.
9367         (Finish_group::set_blocker): New function.
9368         * symtab.h (class Symbol_table): Change saw_undefined to return
9369         size_t.  Change saw_undefined_ field to size_t.
9370         * target-select.cc (Set_target_once::do_run_once): New function.
9371         (Target_selector::Target_selector): Initialize set_target_once_
9372         field.  Don't initialize lock_ and initialize_lock_ fields.
9373         (Target_selector::instantiate_target): Rewrite.
9374         (Target_selector::set_target): New function.
9375         * target-select.h (class Set_target_once): Define.
9376         (class Target_selector): Update declarations.  Make
9377         Set_target_once a friend.  Remove lock_ and initialize_lock_
9378         fields.  Add set_target_once_ field.
9379
9380 2010-02-10  Ian Lance Taylor  <iant@google.com>
9381
9382         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9383         queueing any tasks.
9384         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9385         (queue_middle_tasks): Add all blockers before queueing any tasks.
9386         (queue_final_tasks): Likewise.
9387         * token.h (Task_token::add_blockers): New function.
9388         * object.h (Input_objects::number_of_relobjs): New function.
9389
9390 2010-02-10  Ian Lance Taylor  <iant@google.com>
9391
9392         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9393         shared, not if not position independent.
9394         * x86_64.cc (Relocate::relocate_tls): Likewise.
9395         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9396         (tls_pie_pic_test): New target.
9397         * testsuite/Makefile.in: Rebuild.
9398
9399         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9400         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9401         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9402         * testsuite/Makefile.in: Rebuild.
9403
9404 2010-02-09  David S. Miller  <davem@davemloft.net>
9405
9406         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9407         R_SPARC_RELATIVE using ->add_local_relative().
9408         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9409
9410         * output.h (Output_data_dynamic::add_section_size): New method
9411         that takes two Output_data objects.
9412         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9413         entry param.  Handle it in initializers.
9414         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9415         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9416         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9417         arg.
9418         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9419         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9420         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9421         for dynrel_includes_plt.
9422         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9423         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9424         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9425         before .rela.plt
9426         (Target_sparc::do_finalize_sections): Update to pass true for
9427         dynrel_includes_plt.
9428         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9429         output before .rela.plt
9430         (Target_powerpc::do_finalize_sections): Update to pass true for
9431         dynrel_includes_plt when 32-bit.
9432
9433 2010-02-08  Doug Kwan  <dougkwan@google.com>
9434
9435         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9436         method.
9437         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9438         Arm_relobj::scan_section_for_cortex_a8_stubs,
9439         Arm_relobj::do_relocation_section): Instead of calling
9440         Output_section::output_address, use faster
9441         Arm_relobj::simple_input_section_output_address.
9442
9443 2010-02-08  David S. Miller  <davem@davemloft.net>
9444
9445         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9446         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9447         relocation helper function.
9448
9449         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9450         just like R_SPARC_GOT{10,13,22}.
9451         (Target_sparc::Scan::local): Likewise.
9452         (Target_sparc::Relocate:relocate): Likewise.
9453
9454 2010-02-06  Ian Lance Taylor  <iant@google.com>
9455
9456         * configure.ac: Rewrite targetobjs duplicate removal code to use
9457         only shell constructs.
9458         * configure: Rebuild.
9459
9460 2010-02-05  Doug Kwan  <dougkwan@google.com>
9461
9462         PR 11247
9463         * arm.cc (Arm_relobj::section_is_scannable): New method.
9464         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9465         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9466
9467 2010-02-04  Doug Kwan  <dougkwan@google.com>
9468
9469         PR 11247
9470         * arm-reloc-property.cc (cstdio): Include.
9471         * configure.ac (targetobjs): Remove duplicates.
9472         * configure: Regenerate.
9473         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9474         big and little endian version for a given address size.
9475
9476 2010-02-03  Doug Kwan  <dougkwan@google.com>
9477
9478         * arm-reloc-property.cc
9479         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9480         definition.
9481         * arm-reloc-property.h
9482         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9483         New method definition.
9484         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9485         declaration.
9486         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9487         overflow to N.
9488         (GOT_PREL): Change implemented to Y.
9489         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9490         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9491         (Arm_relocate_functions::movw_abs_nc): Remove method.
9492         (Arm_relocate_functions::movt_abs): Ditto.
9493         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9494         (Arm_relocate_functions::thm_movt_abs): Ditto.
9495         (Arm_relocate_functions::movw_rel_nc): Ditto.
9496         (Arm_relocate_functions::movw_rel): Ditto.
9497         (Arm_relocate_functions::movt_rel): Ditto.
9498         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9499         (Arm_relocate_functions:thm_movw_rel): Ditto.
9500         (Arm_relocate_functions:thm_movt_rel): Ditto.
9501         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9502         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9503         New method definitions.
9504         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9505         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9506         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9507         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9508         (Target_arm::Relocate::relocate): Check for non-static or
9509         unimplemented relocation code and exit early.  Change calls to
9510         Target_arm::reloc_uses_thumb_bit and
9511         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9512         instead.  Refactor code to handle similar relocations to increase
9513         code sharing.  Remove check for unsupported relocation code in switch
9514         statement.
9515         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9516         relocation property table to find out size.  Change error message to
9517         print out the name of a relocation code instead of the numeric value.
9518         (Target_arm::scan_reloc_for_stub): Use relocation property table
9519         instead of calling Target_arm::reloc_uses_thumb_bit().
9520
9521 2010-02-02  Doug Kwan  <dougkwan@google.com>
9522
9523         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9524         types of relaxed input section.
9525
9526 2010-02-02  Doug Kwan  <dougkwan@google.com>
9527
9528         * Makefile.am (HFILES): Add arm-reloc-property.h.
9529         (DEFFILES): New.
9530         (TARGETSOURCES): Add arm-reloc-property.cc
9531         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9532         (libgold_a_SOURCES): $(DEFFILES)
9533         * Makefile.in: Regenerate.
9534         * arm-reloc-property.cc: New file.
9535         * arm-reloc-property.h: New file.
9536         * arm-reloc.def: New file.
9537         * arm.cc: Update comments.
9538         (arm-reloc-property.h): New included header.
9539         (arm_reloc_property_table): New global variable.
9540         (Target_arm::do_select_as_default_target): New method definition.
9541         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9542         arm-reloc-property to targ_extra_obj.
9543         * parameters.cc (set_parameters_target): Call
9544         Target::select_as_default_target().
9545         * target.h (Target::select_as_default_target): New method definition.
9546         (Target::do_select_as_default_target): Same.
9547
9548 2010-02-01  Doug Kwan  <dougkwan@google.com>
9549
9550         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9551         first_output_text_section_.
9552         (Arm_exidx_fixup::first_output_text_section): New method definition.
9553         (Arm_exidx_fixup::first_output_text_section_): New data member.
9554         (Arm_exidx_fixup::process_exidx_section): Record the first text
9555         output section seen.
9556         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9557         and entsize in output section header.
9558
9559 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9560
9561         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9562         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9563         (Arm_relocate_functions::thm_alu11): New Method.
9564         (Arm_relocate_functions::thm_pc8): New Method.
9565         (Arm_relocate_functions::thm_pc12): New Method.
9566         (Target_arm::Scan::local): Handle the relocations.
9567         (Target_arm::Scan::global): Likewise.
9568         (Target_arm::Relocate::relocate): Likewise.
9569         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9570
9571 2010-01-29  Doug Kwan  <dougkwan@google.com>
9572
9573         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9574         of relocation types as ld.
9575
9576 2010-01-29  Doug Kwan  <dougkwan@google.com>
9577
9578         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9579         to public.
9580         (Arm_relocate_functions::thumb_branch_common): Ditto.
9581         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9582         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9583         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9584         Arm_relocate_functions::jump24): Remove.
9585         (Target_arm::Relocate::relocate): Adjust code to call
9586         Arm_relocation_functions::arm_branch_common and
9587         Arm_relocation_functions::thumb_branch_common instead of their removed
9588         wrappers.  Merge switch-cases together to reduce source code size.
9589
9590 2010-01-29  Doug Kwan  <dougkwan@google.com>
9591
9592         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9593         output_local_symbol_count_needs_update_.
9594         (Arm_relobj::output_local_symbol_count_needs_update,
9595          Arm_relobj::set_output_local_symbol_count_needs_update,
9596          Arm_relobj::update_output_local_symbol_count): New methods.
9597         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9598         member.
9599         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9600         of pointed function as in a R_ARM_PREL31 relocation.
9601         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9602         for output local symbol count updating.
9603         (Target_arm::do_relax): Update output local symbol counts in objects
9604         if necessary.
9605         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9606
9607 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9608
9609         * arm.cc: Added support for the ARM relocations:
9610         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9611         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9612         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9613         movw_prel_nc).
9614         (Arm_relocate_functions::movw_rel): New method.
9615         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9616         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9617         thm_movw_prel_nc).
9618         (Arm_relocate_functions::thm_movw_rel): New method.
9619         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9620         thm_movt_prel).
9621         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9622         relocations.
9623         (Target_arm::Scan::global): Likewise.
9624         (Target_arm::Relocate::relocate): Likewise.
9625         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9626         Likewise.
9627
9628 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9629
9630         * arm.cc: Added support for ARM group relocations.
9631         (Target_arm::reloc_needs_sym_origin): New method.
9632         (Arm_relocate_functions::calc_grp_kn): New method.
9633         (Arm_relocate_functions::calc_grp_residual): New method.
9634         (Arm_relocate_functions::calc_grp_gn): New method.
9635         (Arm_relocate_functions::arm_grp_alu): New Method.
9636         (Arm_relocate_functions::arm_grp_ldr): New Method.
9637         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9638         (Arm_relocate_functions::arm_grp_ldc): New Method.
9639         (Target_arm::Scan::local): Handle the ARM group relocations.
9640         (Target_arm::Scan::global): Likewise.
9641         (Target_arm::Relocate::relocate): Likewise.
9642         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9643         Likewise.
9644
9645 2010-01-26  Doug Kwan  <dougkwan@google.com>
9646
9647         * arm.cc (set): Include.
9648         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9649         pointer type.
9650         (Arm_output_section::Text_section_list): New type.
9651         (Arm_output_section::append_text_sections_to_list): New method.
9652         (Arm_output_section::fix_exidx_coverage): Ditto.
9653         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9654         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9655         Relobj::set_section_offset() instead of
9656         Sized_relobj::invalidate_section_offset().
9657         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9658         parameter for section headers. Ignore relocation sections for
9659         unallocated sections and EXIDX sections.
9660         (Target_arm::fix_exidx_coverage): New method.
9661         (Target_arm::output_section_address_less_than): New type.
9662         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9663         linked text section instead of the EXIDX section.
9664         (Arm_output_section::create_stub_group): Add an assertion to check
9665         that this is not an EXIDX output section.
9666         (Arm_output_section::append_text_sections_to_list): New method.
9667         (Arm_output_section::fix_exidx_coverage): Ditto.
9668         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9669         Arm_relobj::section_needs_reloc_stub_scanning.
9670         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9671         first pass.
9672         (Target_arm::fix_exidx_coverage): New method.
9673         * object.h (Relobj::set_output_section): New method.
9674         (Sized_relobj::invalidate_section_offset): Remove method.
9675         (Sized_relobj::do_invalidate_section_offset): Remove method.
9676         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9677
9678 2010-01-25  Doug Kwan  <dougkwan@google.com>
9679
9680         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9681         Fix warning due to signed and unsigned comparison on a 32-bit host.
9682
9683 2010-01-22  Doug Kwan  <dougkwan@google.com>
9684
9685         * arm.cc (Target_arm::do_relax): Record an output section for section
9686         offset adjustment it contains any stub table that has changed.
9687         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9688         offsets in an output section if necessary.
9689         * output.cc (Output_section::Output_section): Initialize
9690         section_offsets_need_adjustments_.
9691         (Output_section::add_input_section_for_script): Renamed to
9692         Output_section::add_simple_input_section.
9693         (Output_section::save_states): Add a comment.
9694         (Output_section::discard_states): New method defintion.
9695         (Output_section::adjust_section_offsets): Same.
9696         * output.h (Output_section::add_input_section_for_script): Renamed to
9697         Output_section::add_simple_input_section.
9698         (Output_section::discard_states): New method declaration.
9699         (Output_section::adjust_section_offsets): Same.
9700         (Output_section::section_offsets_need_adjustment,
9701         Output_section::set_section_offsets_need_adjustment): New method
9702         definitions.
9703         (Output_section::section_offsets_need_adjustment_): New data member.
9704         * script-sections.cc
9705         (Output_section_element_input::set_section_address): Adjust code for
9706         renaming of Output_section::add_input_section_for_script.
9707         (Orphan_output_section::set_section_address): Same.
9708
9709 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9710
9711         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9712         Fix_v4bx enum values .
9713         * gold/options.h (General_options): New option definitions.
9714         (General_options::fix_v4bx): New method.
9715         (General_options::Fix_v4bx): New enum.
9716         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9717         (General_options::parse_fix_v4bx_interworking): New method.
9718
9719 2010-01-22  Doug Kwan  <dougkwan@google.com>
9720
9721         * arm.cc (Arm_exidx_fixup): New class.
9722
9723 2010-01-21  Doug Kwan  <dougkwan@google.com>
9724
9725         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9726         classes.
9727         (Arm_exidx_section_offset_map): New type.
9728
9729 2010-01-21  Doug Kwan  <dougkwan@google.com>
9730
9731         * arm.cc (Arm_exidx_input_section): New class.
9732         (Arm_relobj::exidx_input_section_by_link,
9733         Arm_relobj::exidx_input_section_by_shndx,
9734         Arm_relobj::make_exidx_input_section): New methods.
9735         (read_arm_attributes_section): Remove.
9736         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9737         information about them.
9738         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9739         to here.
9740
9741 2010-01-20  Doug Kwan  <dougkwan@google.com>
9742
9743         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9744         Input_section_specifier to Section_id.
9745         (Target_arm::new_arm_input_section: Adjust code for change of key
9746         type.
9747         (Target_arm::find_arm_input_section): Ditto.
9748         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9749         (Section_id): Remove.
9750         (Garbage_collection::Section_id_hash): Remove.
9751         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9752         (Section_id): Remove.
9753         (Icf::Section_id_hash): Remove.
9754         * object.h (Section_id, Const_section_id, Section_id_hash,
9755         Const_section_id_hash): New type definitions.
9756         * output.cc (Output_section::add_relaxed_input_section): Change to
9757         use Const_section_id instead of Input_section_specifier as key type.
9758         (Output_section::add_merge_input_section): Ditto.
9759         (Output_section::build_relaxation_map): Change to use Section_id
9760         instead of Input_section_specifier as key type.
9761         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9762         Ditto.
9763         (Output_section::convert_input_sections_to_relaxed_sections): Change
9764         to use Const_section_id instead of Input_section_specifier as key type.
9765         (Output_section::find_merge_section): Ditto.
9766         (Output_section::find_relaxed_input_section): Ditto.
9767         * output.h (Input_section_specifier): Remove class.
9768         (Output_section::Output_section_data_by_input_section_map): Change
9769         key type to Const_section_id.
9770         (Output_section::Output_relaxed_input_section_by_input_section_map):
9771         Ditto.
9772         (Output_section::Relaxation_map): Change key type to Section_id.
9773
9774 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9775
9776         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9777         (class Arm_v4bx_stub): New class.
9778         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9779         (Stub_factory::make_arm_v4bx_stub): New method.
9780         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9781         (Stub_table::empty): Handle v4bx stubs.
9782         (Stub_table::add_arm_v4bx_stub): New method.
9783         (Stub_table::find_arm_v4bx_stub): New method.
9784         (Arm_relocate_functions::v4bx): New method.
9785         (Target_arm::fix_v4bx): New method.
9786         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9787         (Stub_table::relocate_stubs): Likewise.
9788         (Stub_table::do_write): Likewise.
9789         (Stub_table::update_data_size_and_addralign): Likewise.
9790         (Stub_table::finalize_stubs):  Likewise.
9791         (Target_arm::Scan::local): Likewise.
9792         (Target_arm::Scan::global): Likewise.
9793         (Target_arm::do_finalize_sections): Likewise.
9794         (Target_arm::Relocate::relocate): Likewise.
9795         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9796         Likewise.
9797         (Target_arm::scan_reloc_for_stub): Likewise.
9798         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9799
9800 2010-01-19  Ian Lance Taylor  <iant@google.com>
9801
9802         * output.cc (Output_section_headers::do_sized_write): Write large
9803         segment count to sh_info field.
9804         (Output_file_header::do_sized_write): For large segment count,
9805         write PN_XNUM to e_phnum field.
9806
9807 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9808
9809         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9810         (Arm_relocate_functions::thm_jump8): New function.
9811         (Arm_relocate_functions::thm_jump11): New function.
9812         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9813         R_ARM_THM_JUMP11.
9814         (Target_arm::Scan::global): Likewise.
9815         (Target_arm::Relocate::relocate): Likewise.
9816         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9817         Likewise.
9818
9819 2010-01-14  Doug Kwan  <dougkwan@google.com>
9820
9821         * arm.cc (map, utility): Include headers.
9822         (Target_arm::apply_cortex_a8_workaround): New method.
9823         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9824         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9825         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9826         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9827         the --[no-]fix-cortex-a8 command line options.
9828         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9829         (Target_arm::relocate_stub): Use addend in instruction template.
9830         * options.h (DEFINE_bool): Set the user-set flag.
9831         (General_options): Add --[no-]-fix-cortex options.
9832         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9833         : Update fast look-up map after conversion.
9834
9835 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9836
9837         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9838         in the first pass of do_layout.
9839
9840 2010-01-13  Doug Kwan  <dougkwan@google.com>
9841
9842         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9843         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9844         apparent compiler problem of not folding static constant integral
9845         data members of elfcpp::Elf_sizes<32>.
9846
9847 2010-01-13  Doug Kwan  <dougkwan@google.com>
9848
9849         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9850         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9851         Arm_relobj::scan_section_for_cortex_a8_erratum,
9852         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9853         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9854         sections to scan for relocation stubs into a new method
9855         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9856         relocation and Cortex-A8 stub scanning.
9857         (Target_arm::do_relax): Force stubs to be after stubbed sections
9858         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9859         the beginning of a new relaxation pass.  Update a comment.
9860         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9861
9862 2010-01-12  Ian Lance Taylor  <iant@google.com>
9863
9864         * target-reloc.h (visibility_error): New inline function.
9865         (relocate_section): Call visibility_error.
9866         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9867         (MOSTLYCLEANFILES): Likewise.
9868         (protected_4_pic.o, protected_3.err): New targets.
9869         * testsuite/protected_4.cc: New file.
9870
9871 2010-01-12  Doug Kwan  <dougkwan@google.com>
9872
9873         * arm.cc (Cortex_a8_reloc): New class.
9874         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9875         and cortex_a8_relocs_info_.
9876         (Target_arm::fix_cortex_a8): New method definition.
9877         (Target_arm::Cortex_a8_relocs_info): New type.
9878         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9879         New data member declarations.
9880         (Target_arm::scan_reloc_for_stub): Record information about
9881         relocations for THUMB branches that might be exempted from the
9882         Cortex-A8 workaround.
9883         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9884         at the beginning of a relaxation pass.
9885
9886 2010-01-12  Doug Kwan  <dougkwan@google.com>
9887
9888         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9889         (Arm_relobj::Mapping_symbol_position,
9890          Arm_reloj::Mapping_symbol_position_less,
9891          Arm_relobj::Mapping_symbols_info): New types.
9892         (Target_arm::is_mapping_symbol_name): New method definition.
9893         (Arm_relobj::do_count_local_symbols): Save information about mapping
9894         symbols.
9895
9896 2010-01-11  Doug Kwan  <dougkwan@google.com>
9897
9898         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9899         Arm_relocate_functions::thumb32_branch_upper,
9900         Arm_relocate_functions::thumb32_branch_lower,
9901         Arm_relocate_functions::thumb32_cond_branch_offset,
9902         Arm_relocate_functions::thumb32_cond_branch_upper,
9903         Arm_relocate_functions::thumb32_cond_branch_lower,
9904         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9905         branch offset encoding.
9906         (Arm_relocate_functions::thumb_branch_common): Use new branch
9907         offset encoding methods to avoid code duplication.
9908         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9909         (Stub_addend_reader::operator()): Use new branch encoding method
9910         to avoid code duplication.
9911
9912 2010-01-11  Doug Kwan  <dougkwan@google.com>
9913
9914         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9915         (Target_arm::do_finalize_sections): Define special EXIDX section
9916         symbols only if referenced.
9917         * gc.h (Garbage_collection::add_reference): New method.
9918         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9919         code duplication.
9920
9921 2010-01-11  Ian Lance Taylor  <iant@google.com>
9922
9923         * script.cc (Version_script_info::build_expression_list_lookup):
9924         Change complaing about duplicate wildcard match from error to
9925         warning.
9926
9927         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9928         of 2009-12-30.
9929         (Version_script_info::Version_script_info): Initialize globs_,
9930         default_version_, default_is_global_, and exact_.  Don't
9931         initialize globals_ or locals_.
9932         (Version_script_info::build_lookup_tables): Build local symbols
9933         first.
9934         (Version_script_info::unquote): New function.
9935         (Version_script_info::add_exact_match): New function.
9936         (Version_script_info::build_expression_list_lookup): Remove lookup
9937         parameter.  Add is_global parameter.  Change all callers.  Handle
9938         wildcard pattern specially.  Unquote pattern.  Call
9939         add_exact_match.
9940         (Version_script_info::get_name_to_match): New function.
9941         (Version_script_info::get_symbol_version): New function.
9942         (Version_script_info::get_symbol_version_helper): Remove.
9943         (Version_script_info::check_unmatched_names): Call unquote.
9944         * script.h (class Version_script_info): Change get_symbol_version
9945         to be non-inline and add is_global parameter; change all callers.
9946         Rewrite symbol_is_local.  Update declarations.  Define struct
9947         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9948         Remove globals_ and locals_ members.  Add exact_, globs_,
9949         default_version_, is_global_.
9950         (Version_script_info::Glob): Remove pattern, add expression and
9951         is_global.  Update constructor.  Change all callers.
9952         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9953         default version.
9954         (Versions::symbol_section_contents): If a symbol is undefined, or
9955         defined in a dynamic object, set the version index to
9956         VER_NDX_LOCAL.
9957         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9958         symbol_is_local.
9959         (Symbol_table::add_from_pluginobj): Likewise.
9960         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9961
9962 2010-01-11  Doug Kwan  <dougkwan@google.com>
9963
9964         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9965         (incremental_dump_LDADD): Add linking option for libintl.
9966         * Makefile.in: Regenerate.
9967
9968 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9969
9970         PR gold/11144
9971         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9972         instead of -Ds.
9973         * testsuite/Makefile.in: Regenerated.
9974
9975 2010-01-10  Doug Kwan  <dougkwan@google.com>
9976
9977         * options.h (DEFINE_var): Use parentheses around argument varname__
9978         in macro body to avoid any unintended subsequent substitutions.
9979
9980 2010-01-10  Ian Lance Taylor  <iant@google.com>
9981
9982         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9983         candidates before doing symbol resolution.
9984
9985         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9986         ODR candidates if only one is weak.
9987
9988 2010-01-08  Ian Lance Taylor  <iant@google.com>
9989
9990         * script.cc (Version_script_info::build_expression_list_lookup):
9991         Don't warn about ambiguous version, just record the ambiguity.
9992         (Version_script_info::get_symbol_version_helper): Give error if
9993         version is ambiguous.
9994
9995 2010-01-08  Doug Kwan  <dougkwan@google.com>
9996
9997         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9998         prev_data_size_ and prev_addralign_.  Remove initializer for
9999         deleted data member has_been_changed_.
10000         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10001         to determine if the table is empty.
10002         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10003         Remove.
10004         (Stub_table::add_reloc_stub): Define method in class definition
10005         instead of just declaring it there.
10006         (Stub_table::add_cortex_a8_stub): New method definition.
10007         (Stub_table::update_data_size_and_addralign): Ditto.
10008         (Stub_table::finalize_stubs): Ditto.
10009         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10010         (Stub_table::do_addralign_): Return address alignment in the
10011         (Stub_table::do_reset_address_and_file_offset): Define method in
10012         class definition instead of declaring it there.  Set current data
10013         size to be the data size of the previous pass.
10014         (Stub_table::set_final_data_size): Use current data size as the
10015         final data size.
10016         (Stub_table::relocate_stub): Change parameter type of stub from
10017         Reloc_stub pointer to Stub pointer.
10018         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10019         (Stub_table::Cortex_a8_stub_list): New typedef.
10020         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10021          Stub_table::prev_addralign_): New data member.
10022         (Arm_relobj::Arm_relobj): Initialize data member
10023         section_has_cortex_a8_workaround_.
10024         (Arm_relobj::section_has_cortex_a8_workaround,
10025          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10026          definitions.
10027         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10028         declarations.
10029         (Target_arm::relocate_stub): Change parameter type of stub from
10030         Reloc_stub pointer to Stub pointer.
10031         (Insn_template::size, Insn_template::alignment): Handle
10032         THUMB16_SPECIAL_TYPE.
10033         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10034          Stub_table::update_data_size_and_addralign,
10035          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10036         definitions.
10037         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10038         (Stub_table::do_write): Ditto.
10039         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10040
10041 2010-01-08  Ian Lance Taylor  <iant@google.com>
10042
10043         PR 11108
10044         * symtab.h (class Symbol): Remove fields is_target_special_ and
10045         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10046         (Symbol::is_defined_in_discarded_section): New function.
10047         (Symbol::set_is_defined_in_discarded_section): New function.
10048         (Symbol::has_plt_offset): Rewrite.
10049         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10050         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10051         Don't initialize is_target_special_ or has_plt_offset_.
10052         Initialize is_defined_in_discarded_section_.
10053         (Symbol_table::add_from_relobj): If appropriate, set
10054         is_defined_in_discarded_section.
10055         * resolve.cc (Symbol::override_base_with_special): Don't test
10056         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10057         * target-reloc.h (relocate_section): Do special handling for
10058         symbols defined in discarded sections for global symbols as well
10059         as local symbols.
10060
10061 2010-01-08  Ian Lance Taylor  <iant@google.com>
10062
10063         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10064         the SHT_SYMTAB case.
10065
10066 2010-01-08  Ian Lance Taylor  <iant@google.com>
10067
10068         * object.cc (Sized_relobj::do_layout): Don't get confused if
10069         layout_eh_frame returns NULL.
10070
10071 2010-01-08  Ian Lance Taylor  <iant@google.com>
10072
10073         PR 11084
10074         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10075         dynamic symbol table, use the normal symbol table.
10076         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10077         symbol table.
10078
10079 2010-01-08  Ian Lance Taylor  <iant@google.com>
10080
10081         PR 11072
10082         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10083         sections.
10084
10085 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10086
10087         * version.cc (print_version): Change to "Copyright 2010".
10088
10089 2010-01-08  Ian Lance Taylor  <iant@google.com>
10090
10091         PR 10287
10092         PR 11063
10093         * i386.cc (class Target_i386): Change return type of plt_section
10094         to be non-const.
10095         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10096         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10097         tls_desc_rel_ field.
10098         (Output_data_plt_i386::rel_tls_desc): New function.
10099         (Target_i386::rel_tls_desc_section): New function.
10100         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10101         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10102         R_386_TLS_DESC reloc in rel_tls_desc_section.
10103         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10104         Define struct Tlsdesc_info.
10105         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10106         (Target_x86_64::do_reloc_symbol_index): New function.
10107         (Target_x86_64::add_tlsdesc_info): New function.
10108         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10109         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10110         tlsdesc_rel_ field.
10111         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10112         all callers.
10113         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10114         (Target_x86_64::rela_tlsdesc_section): New function.
10115         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10116         handling.
10117         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10118         (Target_x86_64::do_reloc_addend): New function.
10119         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10120         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10121         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10122         (Output_reloc::type): New function.
10123         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10124         (Output_reloc::is_target_specific): New function.
10125         (Output_reloc::target_arg): New function.
10126         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10127         absolute relocs and target specific relocs.
10128         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10129         add_target_specific.
10130         (class Output_data_reloc) [SHT_RELA]: Likewise.
10131         * output.cc (Output_reloc::Output_reloc): Add four new versions
10132         for absolute relocs and target specific relocs.
10133         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10134         (Output_reloc::get_symbol_index): Likewise.
10135         (Output_reloc::local_section_offset): Check that local_sym_index_
10136         is not TARGET_CODE or 0.
10137         (Output_reloc::symbol_value): Likewise.
10138         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10139         reloc.
10140         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10141         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10142         functions.
10143         * layout.cc (add_target_dynamic_tags): Use output section for
10144         DT_PLTRELSZ and DT_JMPREL.
10145
10146 2010-01-07  Ian Lance Taylor  <iant@google.com>
10147
10148         PR 11061
10149         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10150         function.
10151         (class Output_data_reloc_generic): Define.
10152         (class Output_data_reloc_base): Change base class to
10153         Output_data_reloc_generic.  Change add() method to call
10154         bump_relative_reloc_count for a relative reloc.  Remove
10155         sort_relocs_ field.
10156         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10157         to sort_relocs().
10158         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10159         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10160         appropriate.
10161         * layout.h (class Layout): Update declaration.
10162
10163 2010-01-07  Ian Lance Taylor  <iant@google.com>
10164
10165         * output.h (class Output_data): Add const version of
10166         output_section and do_output_section.
10167         (class Output_section_data): Add const version of
10168         do_output_section.
10169         (class Output_section): Likewise.
10170         * layout.cc (Layout::add_target_dynamic_tags): New function.
10171         * layout.h (class Layout): Update declarations.
10172         * arm.cc (Target_arm::do_finalize_sections): Use
10173         add_target_dynamic_tags.
10174         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10175         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10176         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10177         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10178
10179 2010-01-07  Ian Lance Taylor  <iant@google.com>
10180
10181         PR 11042
10182         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10183         object as needed.
10184
10185 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10186             Ian Lance Taylor  <iant@google.com>
10187
10188         PR 11019
10189         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10190         Xindex::read_symtab_xindex.
10191
10192 2010-01-07  Doug Kwan  <dougkwan@google.com>
10193
10194         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10195         (Insn_template::thumb16_bcond_insn): New method declaration.
10196         (Insn_template): Fix spelling.
10197         (Stub::thumb16_special): New method declaration.
10198         (Stub::do_write): Define virtual method which was previously pure
10199         virtual.
10200         (Stub::do_thumb16_special): New method declaration.
10201         (Stub::do_fixed_endian_write): New template member.
10202         (Reloc_stub::do_write): Remove.
10203         (Reloc_stub::do_fixed_endian_write): Remove.
10204         (Cortex_a8_stub): New class definition.
10205         (Stub_factory::make_cortex_a8_stub): New method definition.
10206         (Stub_factory::Stub_factory): Add missing static storage class
10207         qualifier for elf32_arm_stub_a8_veneer_blx.
10208
10209 2010-01-07  Ian Lance Taylor  <iant@google.com>
10210
10211         PR 10980
10212         * options.h (class General_options): Add --warn-unresolved-symbols
10213         and --error-unresolved-symbols.
10214         * errors.cc (Errors::undefined_symbol): Implement
10215         --warn-unresolved-symbols.
10216
10217         * options.h (class General_options): Add -z text and -z textoff.
10218         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10219
10220 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10221
10222         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10223         (Garbage_collection::cident_sections): New function.
10224         (Garbage_collection::add_cident_section): New function.
10225         (Garbage_collection::cident_sections_): New member.
10226         (gc_process_relocs): Add references to sections whose names are C
10227         identifiers.
10228         * gold.h (cident_section_start_prefix): New constant.
10229         (cident_section_stop_prefix): New constant.
10230         (is_cident): New function.
10231         * layout.cc (Layout::define_section_symbols): Replace string constants
10232         with the newly defined constants.
10233         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10234         C identifiers.
10235         * testsuite/Makefile.am: Add gc_orphan_section_test.
10236         * testsuite/Makefile.in: Regenerate.
10237         * testsuite/gc_orphan_section_test.cc: New file.
10238         * testsuite/gc_orphan_section_test.sh: New file.
10239
10240 2010-01-06  Ian Lance Taylor  <iant@google.com>
10241
10242         PR 10980
10243         * options.h (class General_options): Add --warn-shared-textrel.
10244         * layout.cc (Layout::finish_dynamic_section): Implement
10245         --warn-shared-textrel.
10246
10247         PR 10980
10248         * options.h (class General_options): Add --warn-multiple-gp.
10249
10250 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10251
10252         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10253         $(THREADSLIB) and $(LIBDL).
10254         * Makefile.in: Rebuild.
10255
10256 2010-01-06  Ian Lance Taylor  <iant@google.com>
10257
10258         PR 10980
10259         * options.cc (General_options::parse_section_start): New function.
10260         (General_options::section_start): New function.
10261         (General_options::General_options): Initialize all members.
10262         * options.h: Include <map>
10263         (class General_options): Add --section-start.  Add section_starts_
10264         member.
10265         * layout.cc (Layout::attach_allocated_section_to_segment): If
10266         --section-start was used, set the address of the segment.  Remove
10267         local sort_sections.
10268         (Layout::relaxation_loop_body): If the address of the load segment
10269         has been set by --section-start, don't use it.
10270         * output.h (Output_segment::update_flags_for_output_section): New
10271         function.
10272         * output.cc (Output_segment::add_output_section): Call
10273         update_flags_for_output_section.
10274
10275 2010-01-05  Ian Lance Taylor  <iant@google.com>
10276
10277         PR 10980
10278         * options.h (class General_options): Add --undefined-version.
10279         * script.cc (struct Version_expression): Add was_matched_by_symbol
10280         field.
10281         (Version_script_info::matched_symbol): New function.
10282         (Version_script_info::get_symbol_version_helper): Call
10283         matched_symbol.
10284         (Version_script_info::check_unmatched_names): New function.
10285         * script.h (class Version_script_info): Update declarations.
10286         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10287
10288         * options.h (class General_options): Use DEFINE_bool_alias for
10289         allow_multiple_definition.
10290         * resolve.cc (Symbol_table::should_override): Don't test
10291         allow_multiple_definition.
10292
10293         PR 10980
10294         * options.h (class General_options): Add --cref.
10295         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10296         until after printing cref table.
10297         * cref.cc: Include "symtab.h".
10298         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10299         (Cref_table_compare::operator()): New function.
10300         (Cref_inputs::gather_cref): New function.
10301         (filecol): New static const.
10302         (Cref_inputs::print_cref): New function.
10303         (Cref::print_cref): New function.
10304         * cref.h: Include <cstdio>.
10305         (class Cref): Update declarations.
10306         * mapfile.h (Mapfile::file): New function.
10307         * object.h (class Object): Define Symbols.  Declare virtual
10308         do_get_global_symbols.
10309         (Object::get_global_symbols): New function.
10310         * object.cc (Input_objects::add_object): Pass object to cref_ if
10311         --cref.
10312         (Input_objects::archive_start): Likewise.
10313         (Input_objects::archive_stop): Likewise.
10314         (Input_objects::print_cref): New function.
10315         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10316         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10317         --cref.
10318         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10319         function.
10320         * plugin.h (class Sized_pluginobj): Update declarations.
10321
10322 2010-01-05  Ian Lance Taylor  <iant@google.com>
10323
10324         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10325         to is_default_version.  Rename insdef to insdefault.
10326         (Symbol_table::add_from_relobj): Rename def to is_default_version
10327         and local to is_forced_local.
10328         (Symbol_table::add_from_pluginobj): Likewise.
10329         (Symbol_table::add_from_dynobj): Likewise.
10330         (Symbol_table::define_special_symbol): Rename insdef to
10331         insdefault.
10332
10333 2010-01-04  Ian Lance Taylor  <iant@google.com>
10334
10335         PR 10980
10336         * options.h (class General_options): Add
10337         --allow-multiple-definition and -z muldefs.
10338         * resolve.cc (Symbol_table::should_override): Don't warn about a
10339         multiple symbol definition if --allow-multiple-definition or -z
10340         muldefs.
10341
10342         PR 10980
10343         * options.h (class General_options): Add --add-needed and
10344         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10345         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10346         error if --copy-dt-needed-entries aka --add-needed is used and
10347         would cause a change in behaviour.
10348
10349         PR 10980
10350         * options.h (class General_options): Add -G as a short version of
10351         --shared.  Add no-op options -assert, -g, and -i.
10352
10353 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10354
10355         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10356         check for .text or .gnu.linkonce.t sections.
10357         * icf.cc (Icf::find_identical_sections): Ditto.
10358         Change the detection for mangled function name within the section
10359         name.
10360         * icf.h (is_section_foldable_candidate): New function.
10361
10362 2009-12-30  Ian Lance Taylor  <iant@google.com>
10363
10364         PR 10980
10365         * options.h (class General_options): Permit two dashes with
10366         --retain-symbols-file.
10367
10368 2009-12-30  Ian Lance Taylor  <iant@google.com>
10369
10370         PR 10979
10371         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10372         don't put the file header and segment headers in the text
10373         segment.
10374
10375         PR 10979
10376         * common.cc (Sort_commons::operator()): Stabilize sort when both
10377         entries are NULL.
10378         (Symbol_table::do_allocate_commons_list): When allocating common
10379         symbols, skip a symbol which is no longer common.
10380         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10381         an object before checking its type.
10382         * testsuite/common_test_2.c: New file.
10383         * testsuite/common_test_3.c: New file.
10384         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10385         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10386         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10387         (common_test_2_pic.o, common_test_2.so): New targets.
10388         (common_test_3_pic.o, common_test_3.so): New targets.
10389         * testsuite/Makefile.in: Rebuild.
10390
10391         PR 10979
10392         * script.cc (read_input_script): If we see a new SECTIONS clause,
10393         and we have added an input section, give an error.
10394         * layout.h (class Layout): Add have_added_input_section function.
10395         Add have_added_input_section_ field.
10396         * layout.cc (Layout::Layout): Initialize
10397         have_added_input_section_.
10398         (Layout::layout): Set have_added_input_section_.
10399         (Layout::layout_eh_frame): Likewise.
10400
10401 2009-12-30  Ian Lance Taylor  <iant@google.com>
10402
10403         PR 10931
10404         * options.h (class General_options): Add --sort-common option.
10405         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10406         * common.cc (Sort_common): Add sort_order parameter to
10407         constructor.  Add sort_order_ field.
10408         (Sort_commons::operator): Check sort_order_.
10409         (Symbol_table::allocate_commons): Determine the sort order.
10410         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10411         Change all callers.
10412         (Symbol_table::do_allocate_commons_list): Likewise.
10413
10414 2009-12-30  Ian Lance Taylor  <iant@google.com>
10415
10416         PR 10916
10417         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10418         symbols from this object, don't change the visibility of an
10419         undefined symbol.
10420         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10421
10422 2009-12-30  Ian Lance Taylor  <iant@google.com>
10423
10424         PR 10861
10425         * script.h (class Version_script_info): Define Language enum.
10426         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10427         new fields globals_, locals_, and is_finalized_.
10428         * script.cc: Various formatting fixes.
10429         (class Parser_closure): Change language_stack_ from a vector of
10430         std::string to one of Version_script_info::Language.  Adjust all
10431         uses accordingly.
10432         (class Lazy_demangler): Remove.
10433         (struct Version_expression): Change language from std::string to
10434         Version_script_info::Language.
10435         (Version_script_info::Version_script_info): New function.
10436         (Version_script_info::~Version_script_info): Don't call clear.
10437         (Version_script_info::finalize): New function.
10438         (Version_script_info::build_lookup_tables): New function.
10439         (Version_script_info::build_expression_list_lookup): New
10440         function.
10441         (Version_script_info::get_symbol_version_helper): Rewrite to use
10442         lookup tables.
10443         (Version_script_info::print_expression_list): Adjust to use
10444         Version_script_info::Language.
10445         (script_push_lex_into_version_mode): Check that the version script
10446         has not been finalized.
10447         (version_script_push_lang): Change language string to
10448         Version_script_info::Language.
10449         * options.cc (Command_line::version_script): New function.
10450         * options.h (class General_options): Add finalize_dynamic_list
10451         function.  Change version_script from declaration to definition.
10452         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10453         * testsuite/version_script.map: Remove duplicate def of foo.
10454         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10455         version_script.map.
10456         * testsuite/Makefile.in: Rebuild.
10457
10458 2009-12-30  Ian Lance Taylor  <iant@google.com>
10459
10460         PR 10843
10461         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10462         if the input symbol index is 0, make the output symbol index 0.
10463
10464 2009-12-30  Ian Lance Taylor  <iant@google.com>
10465
10466         PR 10670
10467         * options.h (class General_options): Add -x/--discard-all.
10468         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10469         --discard-all.  If the local symbol needs a dynamic entry, check
10470         that before handling --discard-locals.
10471
10472 2009-12-30  Ian Lance Taylor  <iant@google.com>
10473
10474         PR 10450
10475         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10476         flags to PF_R.
10477         (Output_segment::add_output_section): Don't change the flags if
10478         the type is PT_TLS.
10479
10480         PR 10450
10481         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10482         GNU hash table if they need a dynamic value.  Otherwise, don't add
10483         them if they are defined in a dynamic object or are forced local.
10484
10485 2009-12-29  Ian Lance Taylor  <iant@google.com>
10486
10487         PR 10450
10488         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10489         .gnu.hash table for a 32-bit target.
10490
10491         PR 10450
10492         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10493         regular and a dynamic object only needs a dynamic symbol table
10494         entry if it is externally visible.
10495
10496         PR 10450
10497         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10498         constructor.  Add global_offset_table_ field.
10499         (Target_i386::got_section): Set global_offset_table_.
10500         (Target_i386::do_finalize_sections): Set global_offset_table_
10501         size.
10502         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10503         in constructor.  Add global_offset_table_ field.
10504         (Target_x86_64::got_section): Set global_offset_table_.
10505         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10506         size.
10507
10508         * layout.cc (Layout::Layout): Initialize increase_relro_.
10509         (Layout::get_output_section): Add is_relro, is_last_relro, and
10510         is_first_non_relro parameters.  Change all callers.
10511         (Layout::choose_output_section): Likewise.
10512         (Layout::add_output_section_data): Likewise.
10513         (Layout::make_output_section): Likewise.
10514         (Layout::set_segment_offsets): Clear increase_relro when using a
10515         linker script.
10516         * layout.h (class Layout): Add increase_relro method.  Add
10517         increase_relro_ field.  Update declarations.
10518         * output.cc (Output_section::Output_section): Initialize
10519         is_last_relro_ and is_first_non_relro_.
10520         (Output_segment::add_output_section): Group relro sections is
10521         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10522         (Output_segment::maximum_alignment): Remove relro handling.
10523         (Output_segment::set_section_addresses): Add increase_relro
10524         parameter.  Change all callers.  Add initial alignment to align
10525         relro sections on separate page.  Remove old relro handling.
10526         (Output_segment::set_section_list_addresses): Remove in_relro
10527         parameter.  Change all callers.
10528         (Output_segment::set_offset): Add increase parameter.  Change all
10529         callers.  Remove old relro handling.
10530         * output.h (class Output_section): Add new methods: is_last_relro,
10531         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10532         Add is_last_relro_ and is_first_non_relro_ fields.
10533         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10534         Create separate .got.plt section.  Call increase_relro.
10535         * x86_64.cc (Target_x86_64::got_section): Likewise.
10536         * testsuite/relro_script_test.t: Add .got.plt.
10537
10538         PR 10450
10539         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10540         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10541         (Layout::finalize): Call set_dynamic_symbol_size.
10542         (Layout::set_dynamic_symbol_size): New function.
10543         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10544         set_dynamic_symbol_size.
10545
10546         PR 10450
10547         * output.h (class Output_section): Add is_entsize_zero_ field.
10548         * output.cc (Output_section::Output_section): Initialize
10549         is_entsize_zero_.
10550         (Output_section::set_entsize): If two different entsizes are
10551         requested, force it to zero.
10552         (Output_section::add_input_section): Set flags for .debug_str
10553         before updating section flags.  Set entsize.
10554         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10555         and SHF_STRING if all input sections have those flags.
10556
10557 2009-12-29   Rafael Espindola  <espindola@google.com>
10558
10559         * main.cc (main): Fix the sys time reporting.
10560         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10561         reporting.
10562
10563 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10564
10565         * options.cc (General_options::parse_version): Allow -v to exit
10566         without an error if there is nothing to link.
10567
10568 2009-12-29  Ian Lance Taylor  <iant@google.com>
10569
10570         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10571         using a version of gcc before 4.1.
10572         * configure: Rebuild.
10573
10574 2009-12-28  Chris Demetriou  <cgd@google.com>
10575
10576         * attributes.cc (Output_attributes_section_data::do_write): Use
10577         std::vector::front rather than std::vector::data.
10578
10579 2009-12-28  Ian Lance Taylor  <iant@google.com>
10580
10581         * symtab.h (class Symbol_table): Add enum Defined.
10582         * resolve.cc (Symbol_table::should_override): Add defined
10583         parameter.  Change all callers.  Test whether object is NULL
10584         before calling a method on it.
10585         (Symbol_table::report_resolve_problem): Add defined parameter.
10586         Change all callers.
10587         (Symbol_table::should_override_with_special): Likewise.
10588         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10589         parameter.  Change all callers.
10590         (Symbol_table::do_define_in_output_data): Likewise.
10591         (Symbol_table::define_in_output_segment): Likewise.
10592         (Symbol_table::do_define_in_output_segment): Likewise.
10593         (Symbol_table::define_as_constant): Likewise.
10594         (Symbol_table::do_define_as_constant): Likewise.
10595         * script.h (class Symbol_assignment): Add is_defsym parameter to
10596         constructor; change all callers.
10597         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10598         parameter.  Change all callers.  Add is_defsym_ field.
10599         (class Parser_closure): Add parsing_defsym parameter to
10600         constructor; change all callers.  Add parsing_defsym accessor
10601         function.  Add parsing_defsym_ field.
10602
10603 2009-12-28  Ian Lance Taylor  <iant@google.com>
10604
10605         * gold.cc (queue_middle_tasks): Fix formatting.
10606         * object.cc (Relobj::is_section_name_included): Likewise.
10607
10608 2009-12-23  Ian Lance Taylor  <iant@google.com>
10609
10610         * i386.cc (Target_i386::do_calls_non_split): Recognize
10611         -fsplit-stack prologue for a function with a static chain.
10612         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10613         -fsplit-stack prologue when using %r11.
10614
10615 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10616
10617         * options.cc (General_options::parse_version): Make -v continue and do
10618         the link like GNU ld does.
10619
10620 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10621
10622         * Makefile.am (CCFILES): Add timer.cc.
10623         (HFILES): Add timer.h.
10624         * configure.ac: Check for sysconf and times.
10625         * main.cc: include timer.h.
10626         (main): Use Timer instead of get_run_time.
10627         * timer.cc: New.
10628         * timer.h: New.
10629         * workqueue.cc: include timer.h.
10630         (Workqueue::find_and_run_task):
10631         Report user, sys and wall time.
10632         * Makefile.in: Regenerate.
10633         * config.in: Regenerate.
10634         * configure: Regenerate.
10635
10636 2009-12-16  Doug Kwan  <dougkwan@google.com>
10637
10638         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10639         sections.
10640         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10641         relaxed input sections.
10642         * output.cc (Output_section::find_relaxed_input_section): Change
10643         return type to Output_relaxed_input_section pointer.  Adjust code
10644         for new type of relaxed_input_section_map_.
10645         * output.h (Output_section::find_relaxed_input_section): Change
10646         return type to Output_relaxed_input_section pointer.
10647         (Output_section::Output_relaxed_input_section_by_input_section_map):
10648         New type.
10649         (Output_section::relaxed_input_section_map_): Change type to
10650         Output_section::Output_relaxed_input_section_by_input_section_map.
10651         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10652         input section.
10653
10654 2009-12-15  Ian Lance Taylor  <iant@google.com>
10655
10656         * layout.cc (Layout::create_shstrtab): Only write out after input
10657         sections if we are compressing debug sections.
10658
10659 2009-12-15  Ian Lance Taylor  <iant@google.com>
10660
10661         * archive.cc (Archive::add_symbols): Only look up a symbol without
10662         a version if there is, in fact, a version.
10663
10664 2009-12-14  Ian Lance Taylor  <iant@google.com>
10665
10666         Revert -Wshadow changes, all changes from:
10667         2009-12-11  Doug Kwan  <dougkwan@google.com>
10668         2009-12-11  Nick Clifton  <nickc@redhat.com>
10669         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10670
10671 2009-12-11  Doug Kwan  <dougkwan@google.com>
10672
10673         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10674         due to -Wshadow.
10675         * attributes.cc (Object_attribute::size): Ditto.
10676         (Attributes_section_data::size): Ditto.
10677         (Attributes_section_data::Attributes_section_data): Ditto.
10678         (Output_attributes_section_data::do_write): Ditto.
10679         * attributes.h (Object_attribute::set_type): Ditto.
10680         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10681
10682 2009-12-11  Nick Clifton  <nickc@redhat.com>
10683
10684         * archive.cc: Fix shadowed variable warnings.
10685         * arm.cc: Likewise.
10686         * compressed_output.cc: Likewise.
10687         * compressed_output.h: Likewise.
10688         * configure: Likewise.
10689         * dwarf_reader.cc: Likewise.
10690         * dynobj.cc: Likewise.
10691         * dynobj.h: Likewise.
10692         * ehframe.cc: Likewise.
10693         * ehframe.h: Likewise.
10694         * errors.cc: Likewise.
10695         * expression.cc: Likewise.
10696         * fileread.cc: Likewise.
10697         * fileread.h: Likewise.
10698         * freebsd.h: Likewise.
10699         * i386.cc: Likewise.
10700         * icf.cc: Likewise.
10701         * incremental.h: Likewise.
10702         * layout.cc: Likewise.
10703         * layout.h: Likewise.
10704         * mapfile.cc: Likewise.
10705         * merge.cc: Likewise.
10706         * merge.h: Likewise.
10707         * object.cc: Likewise.
10708         * object.h: Likewise.
10709         * options.h: Likewise.
10710         * output.cc: Likewise.
10711         * output.h: Likewise.
10712         * parameters.cc: Likewise.
10713         * plugin.cc: Likewise.
10714         * powerpc.cc: Likewise.
10715         * reduced_debug_output.cc: Likewise.
10716         * reduced_debug_output.h: Likewise.
10717         * reloc.cc: Likewise.
10718         * reloc.h: Likewise.
10719         * resolve.cc: Likewise.
10720         * script-sections.cc: Likewise.
10721         * script.cc: Likewise.
10722         * script.h: Likewise.
10723         * sparc.cc: Likewise.
10724         * symtab.cc: Likewise.
10725         * symtab.h: Likewise.
10726         * target-select.cc: Likewise.
10727         * target-select.h: Likewise.
10728         * token.h: Likewise.
10729         * workqueue.cc: Likewise.
10730         * workqueue.h: Likewise.
10731         * x86_64.cc: Likewise.
10732
10733 2009-12-10  Doug Kwan  <dougkwan@google.com>
10734
10735         * arm.cc (attributes.h): New include.
10736         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10737         (Arm_relobj::~Arm_relobj): Delete object pointed by
10738         attributes_section_data_.
10739         (Arm_relobj::attributes_section_data): New method definition.
10740         (Arm_relobj::attributes_section_data_): New data member declaration.
10741         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10742         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10743         attributes_section_data_.
10744         (Arm_dynobj::attributes_section_data): New method definition.
10745         (Arm_dynobj::attributes_section_data_): New data member declaration.
10746         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10747         initialization value of may_use_blx_ to false.
10748         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10749         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10750         object attributes to compute results instead of hard-coding.
10751         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10752         Target_arm::get_secondary_compatible_arch,
10753         Target_arm::set_secondary_compatible_arch
10754         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10755         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10756         New method declarations.
10757         (Target_arm::get_aeabi_object_attribute): New method definition.
10758         (Target_arm::attributes_section_data_): New data member declaration.
10759         (read_arm_attributes_section): New template definition.
10760         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10761         (Arm_dynobj::do_read_symbols): Ditto.
10762         (Target_arm::do_finalize_sections): Merge attributes sections from
10763         input.  Check for BLX use after attributes section merging.
10764         Fix __exidx_start and __exidx_end visibility.  Create an
10765         .ARM.attributes section if necessary.
10766         (Target_arm::get_secondary_compatible_arch,
10767         Target_arm::set_secondary_compatible_arch,
10768         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10769         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10770         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10771         New method definitions.
10772
10773 2009-12-09  Ian Lance Taylor  <iant@google.com>
10774
10775         * plugin.cc (Plugin::load): Don't cast from void* to a function
10776         pointer.
10777
10778 2009-12-09  Ian Lance Taylor  <iant@google.com>
10779
10780         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10781         information fields.
10782
10783 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10784
10785         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10786         Replace two_file_shared_1.so with two_file_shared_2.so.
10787         * testsuite/Makefile.in: Regenerated.
10788
10789 2009-12-08  Doug Kwan  <dougkwan@google.com>
10790
10791         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10792         (HFILES): Add attributes.h and int_encoding.h.
10793         * Makefile.in: Regenerate.
10794         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10795         function definitions to int_encoding.cc
10796         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10797         prototypes to int_encoding.h
10798         * reduced_debug_output.cc (int_encoding.h): New include.
10799         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10800         function definitions to int_encoding.cc
10801         (insert_into_vector, read_from_pointer): Move template definitions to
10802         int_encoding.h
10803         * attributes.cc: New file.
10804         * attributes.h: New file.
10805         * int_encoding.cc: New file.
10806         * int_encoding.h: New file.
10807
10808 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10809
10810         PR gold/11055
10811         * incremental-dump.cc (dump_incremental_inputs): New.
10812         (main): Use dump_incremental_inputs.
10813
10814 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10815
10816         PR gold/10893
10817         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10818         checking elfcpp::STT_FUNC.
10819         (Target_i386::Relocate::relocate): Likewise.
10820         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10821
10822         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10823         symbols from shared libraries into normal FUNC symbols.
10824
10825         * symtab.h (Symbol): Add is_func and use it.
10826
10827 2009-12-05  Doug Kwan  <dougkwan@google.com>
10828
10829         * arm.cc (Target_arm::arm_info): Initialize new fields
10830         attributes_section and attributes_vendor.
10831         * i386.cc (Target_i386::i386_info): Same.
10832         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10833         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10834         fields attributes_section and attributes_vendor.
10835         * sparc.cc (Target_sparc::sparc_info): Same.
10836         * target.h (Target::attributes_section, Target::attributes_vendor,
10837         Target::is_attributes_section, Target::attribute_arg_type,
10838         Target::attributes_order): New method definitions.
10839         (Target::Target_info::attributes_section,
10840         Target::Target_info::attributes_vendor): New fields.
10841         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10842         virtual method definitions.
10843         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10844         attributes_section and attributes_vendor.
10845         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10846
10847 2009-12-05  Doug Kwan  <dougkwan@google.com>
10848
10849         * arm.cc: Update comments about interworking and stub generation.
10850         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10851         considered as non-PIC.
10852         (Arm_relocate_functions::base_abs): Fix formatting.
10853         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10854         of function to use GOT entry address instead of offset.
10855         (Target_arm::Scan::global): Issue an error if a symbol would need a
10856         PLT does not get one because it is untyped.  Remove code to create
10857         dynamic symbols for relative branches.
10858         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10859         takes unsigned integer instead of boolean.
10860
10861 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10862
10863         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10864         (two_file_test_LDADD): Likewise.
10865         (common_test_1_LDADD): Likewise.
10866         (exception_test_LDADD) Likewise.
10867         (weak_test_LDADD): Likewise.
10868         (many_sections_test_LDADD): Likewise.
10869         (initpri1_LDADD): Likewise.
10870         (script_test_1_LDADD): Likewise.
10871         (script_test_2_LDADD): Likewise.
10872         (justsyms_LDADD): Likewise.
10873         (binary_test_LDADD): Likewise.
10874         (large_LDADD): Likewise.
10875         * testsuite/Makefile.in: Regenerated.
10876
10877 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10878
10879         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10880         (Symbol_table::override_with_special): Likewise.
10881         (Symbol_table::add_from_object): Likewise.
10882
10883 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10884
10885         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10886         Don't set the data_offset twice.
10887
10888 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10889
10890         * testsuite/Makefile.in: Regenerate.
10891
10892 2009-12-03  Doug Kwan  <dougkwan@google.com>
10893
10894         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10895         (Target_arm::do_finalize_sections): Add parameter for symbol table
10896         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10897         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10898         parameter for symbol table pointer.
10899         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10900         an additional parameter for a pointer to symbol table.
10901         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10902         parameter for a symbol table pointer.
10903         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10904         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10905         Ditto.
10906         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10907         parameter for a symbol table pointer.
10908
10909 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10910
10911         * incremental.cc (Incremental_inputs_header)
10912         (Incremental_inputs_header_write, Incremental_inputs_entry)
10913         (Incremental_inputs_entry_write): Move ...
10914         * incremental.h (Incremental_inputs_header)
10915         (Incremental_inputs_header_write, Incremental_inputs_entry)
10916         (Incremental_inputs_entry_write): here.
10917
10918 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10919
10920         * incremental.cc (make_sized_incremental_binary): Set the target.
10921         Error if it is incompatible.
10922         * output.h (Output_file): Add filename method.
10923
10924 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10925
10926         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10927         from the get_* methods.
10928
10929 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10930
10931         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10932         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10933         Write 0 for the data_offset of scripts.
10934
10935 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10936
10937         * testsuite/Makefile.am: Add the incremental_test.sh test.
10938         * testsuite/incremental_test.sh: New.
10939         * testsuite/incremental_test_1.c: New.
10940         * testsuite/incremental_test_2.c: New.
10941
10942 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10943
10944         * incremental-dump.cc (main): Fix typos.
10945
10946 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10947
10948         PR gold/11025
10949         * incremental-dump.cc (main): Use llu to print 64 bit values.
10950
10951 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10952             H.J. Lu  <hongjiu.lu@intel.com>
10953
10954         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10955         $(LIBDL).
10956         (incremental_dump_LDADD): Likewise.
10957         * Makefile.in: Regenerated.
10958
10959 2009-11-25  Doug Kwan  <dougkwan@google.com>
10960
10961         Revert:
10962
10963         2009-11-25  Doug Kwan  <dougkwan@google.com>
10964
10965                 * arm.cc (Target_arm::Target_arm): Move method definition
10966                 outside of class definition.  Add code to handle
10967                 --target1-rel, --target1-abs and --target2= options.
10968                 (Target_arm::get_reloc_reloc_type): Change method to be
10969                 non-static and const.
10970                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10971                 New data member declaration.
10972                 (Target_arm::Scan::local, Target_arm::Scan::global,
10973                 Target_arm::Relocate::relocate,
10974                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10975                 Adjust call to Target_arm::get_real_reloc_type.
10976                 (Target_arm::get_real_reloc_type): Use command line options
10977                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10978                 * options.h (--target1-rel, --target1-abs, --target2): New
10979                 ARM-only options.
10980
10981 2009-11-25  Doug Kwan  <dougkwan@google.com>
10982
10983         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10984         class definition.  Add code to handle --target1-rel, --target1-abs
10985         and --target2= options.
10986         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10987         and const.
10988         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10989         member declaration.
10990         (Target_arm::Scan::local, Target_arm::Scan::global,
10991         Target_arm::Relocate::relocate,
10992         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10993         call to Target_arm::get_real_reloc_type.
10994         (Target_arm::get_real_reloc_type): Use command line options to
10995         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10996         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10997         options.
10998
10999 2009-11-25  Doug Kwan  <dougkwan@google.com>
11000
11001         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11002         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11003         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11004         formatting.
11005         (Arm_relocate_functions::thm_call): Replace body with a call to
11006         Arm_relocate_functions::thumb_branch_common.
11007         (Arm_relocate_functions::thm_jump24,
11008         Arm_relocate_functions::thm_xpc22): New method definitions.
11009         (Arm_relocate_functions::thumb_branch_common): New method definition.
11010         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11011         operator.
11012         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11013         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11014
11015 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11016
11017         * Makefile.am: Build incremental-dump
11018         * Makefile.in: Regenerate.
11019         * incremental-dump.cc: New.
11020         * incremental.cc (Incremental_inputs_header_data,
11021         Incremental_inputs_entry_data): Move to incremental.h
11022         * incremental.h: (Incremental_inputs_header_data,
11023         Incremental_inputs_entry_data): Move from incremental.cc
11024
11025 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11026
11027         * incremental.cc (Incremental_inputs_header,
11028         Incremental_inputs_header_write, Incremental_inputs_entry,
11029         Incremental_inputs_entry_write): Add a typedef with the data type.
11030
11031 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11032
11033         * incremental.cc (Incremental_inputs_header,
11034         Incremental_inputs_header_write, Incremental_inputs_entry,
11035         Incremental_inputs_entry_write): Update comment about which
11036         type has the filed descriptions.
11037
11038 2009-11-15  Doug Kwan  <dougkwan@google.com>
11039
11040         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11041         (Arm_relocate_functions::arm_branch_common): Change method defintion
11042         in class definition to a method declaration and update list of formal
11043         parameters.
11044         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11045         Arm_relocation_functions::jump24): Adjust call to
11046         Arm_relocate_functions::arm_branch_common.  Update list of formal
11047         parameters.
11048         (Arm_relocate_functions::xpc25): New method definition.
11049         (Arm_relocate_functions::arm_branch_common): Move method defintion
11050         out from class definition.  Use stubs for mode-switching and extending
11051         branch ranges.
11052         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11053         specially.  Change code to enable use of stubs in ARM branches.
11054
11055 2009-11-10  Doug Kwan  <dougkwan@google.com>
11056
11057         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11058         in method declaration.
11059         (Target_arm::relocate_stub): New method declaration.
11060         (Target_arm::default_target): Change to return a pointer instead of
11061         a const reference.
11062         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11063         Target_arm::default_target.
11064         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11065         method definition.
11066         (Target_arm::relocate_section): Adjust view.
11067         (Target_arm::relocate_stub): New method definition.
11068
11069 2009-11-10  Doug Kwan  <dougkwan@google.com>
11070
11071         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11072         a format warning.
11073         * incremental.cc (open_incremental_binary): Initialized local
11074         variables to avoid warnings.
11075         * object.cc (make_elf_object): Ditto.
11076         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11077         a format warning.
11078
11079 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11080
11081         PR gold/10930
11082         * testsuite/plugin_test.c: Include "config.h".
11083
11084 2009-11-09  Doug Kwan  <dougkwan@google.com>
11085
11086         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11087         (arm_symbol_value): Remove.
11088         (Arm_relocate_functions::arm_branch_common,
11089         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11090         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11091         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11092         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11093         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11094         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11095         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11096         Arm_relocate_functions::thm_mobw_abs_nc,
11097         Arm_relocate_functions::thm_mov_abs,
11098         Arm_relocate_functions::movw_prel_nc,
11099         Arm_relocate_functions::thm_movt_abs,
11100         Arm_relocate_functions::movt_prel,
11101         Arm_relocate_functions::thm_movw_prel_nc,
11102         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11103         (Target_arm::Relocate::relocate): Only decompose address into two
11104         parts if relocation type uses the thumb-bit and pass the actual
11105         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11106         calls to methods in Arm_relocate_functions for this change.
11107
11108 2009-11-08  Ian Lance Taylor  <iant@google.com>
11109
11110         PR 10925
11111         * reloc.cc: Instantiate
11112         Sized_relobj::initialize_input_to_output_maps and
11113         Sized_relobj:free_input_to_output_maps.
11114
11115 2009-11-06  Ian Lance Taylor  <iant@google.com>
11116
11117         PR 10876
11118         * defstd.cc (in_segment): Set only_if_ref true for "end".
11119
11120 2009-11-06  Doug Kwan  <dougkwan@google.com>
11121
11122         * arm.cc (class Reloc_stub): Correct a comment.
11123         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11124         (Target_arm::scan_section_for_stubs): New method declaration.
11125         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11126         Change methods from private to protected.
11127         (Target_arm::do_may_relax): New method definition.
11128         (Target_arm::do_relax, Target_arm::group_sections,
11129         Target_arm::scan_reloc_for_stub,
11130         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11131         (Target_arm::arm_input_section_map_): New data member declaration.
11132         (Target_arm::scan_reloc_for_stub,
11133         Target_arm::scan_reloc_section_for_stubs,
11134         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11135         Target_arm::do_relax): New method definitions.
11136
11137 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11138
11139         * configure.ac: Check for (struct stat)::st_mtim
11140         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11141         * config.in: Regenerate.
11142         * configure: Regenerate.
11143
11144 2009-11-05  Ian Lance Taylor  <iant@google.com>
11145
11146         PR 10910
11147         * output.cc (Output_segment::add_output_section): Add missing
11148         return statement.
11149
11150 2009-11-04  Ian Lance Taylor  <iant@google.com>
11151
11152         PR 10880
11153         * object.h (class Object): Add is_needed and set_is_needed
11154         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11155         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11156         defined in a dynamic object and referenced by a regular object,
11157         set is_needed for the dynamic object.
11158         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11159         if the file is marked with as_needed and it is not needed.
11160
11161 2009-11-04  Ian Lance Taylor  <iant@google.com>
11162
11163         PR 10887
11164         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11165         tags if data is discarded by linker script.
11166         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11167         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11168         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11169         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11170
11171 2009-11-04  Ian Lance Taylor  <iant@google.com>
11172
11173         * layout.cc (Layout::get_output_section): Add is_interp and
11174         is_dynamic_linker_section parameters.  Change all callers.
11175         (Layout::choose_output_section): Likewise.
11176         (Layout::make_output_section): Likewise.
11177         (Layout::add_output_section_data): Add is_dynamic_linker_section
11178         parameter.  Change all callers.
11179         * layout.h (class Layout): Update declarations.
11180         * output.h (class Output_section): Add is_interp, set_is_interp,
11181         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11182         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11183         generate_code_fills_at_write_ to a bitfield.
11184         * output.cc (Output_section::Output_sections): Initialize new
11185         fields.
11186         (Output_segment::add_output_section): Add do_sort parameter.
11187         Change all callers.
11188
11189 2009-11-03  Ian Lance Taylor  <iant@google.com>
11190
11191         PR 10860
11192         * options.h (class General_options): Add --warn-common.
11193         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11194         merging two common symbols.
11195         (Symbol_table::should_override): Handle --warn-common when merging
11196         a common symbol with a defined symbol.  Use report_resolve_problem
11197         for multiple definitions.
11198         (Symbol_table::report_resolve_problem): New function.
11199         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11200
11201 2009-11-03  Doug Kwan  <dougkwan@google.com>
11202
11203         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11204         stub_factory_.
11205         (Target_arm::stub_factory): New method definition.
11206         (Target_arm::new_arm_input_section,
11207         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11208         Target_arm::reloc_uses_thumb_bit): New method declarations.
11209         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11210         New type definitions.
11211         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11212         member declarations.
11213         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11214         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11215         New method definitions.
11216
11217 2009-11-03  Ian Lance Taylor  <iant@google.com>
11218
11219         * options.h (class General_options): Add --warn_constructors.
11220
11221 2009-11-03  Ian Lance Taylor  <iant@google.com>
11222
11223         PR 10893
11224         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11225         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11226
11227 2009-11-03  Ian Lance Taylor  <iant@google.com>
11228
11229         PR 10895
11230         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11231         --msgid-bugs-address.
11232         (install-pdf): New target.
11233         (install-data_yes): Look up one directory to find mkinstalldirs.
11234
11235 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11236
11237         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11238         tree.
11239
11240 2009-10-30  Doug Kwan  <dougkwan@google.com>
11241
11242         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11243
11244 2009-10-30  Doug Kwan  <dougkwan@google.com>
11245
11246         * arm.cc (Stub_addend_reader): New struct template definition
11247         and partial specializations.
11248         (Stub_addend_reader::operator()): New method definition for a
11249         partially specialized template.
11250
11251 2009-10-30  Doug Kwan  <dougkwan@google.com>
11252
11253         * arm.cc (Arm_relobj::processor_specific_flags): New method
11254         definition.
11255         (Arm_relobj::do_read_symbols): New method declaration.
11256         (Arm_relobj::processor_specific_flags_): New data member declaration.
11257         (Arm_dynobj): New class definition.
11258         (Target_arm::do_finalize_sections): Add input_objects parameter.
11259         (Target_arm::do_adjust_elf_header): New method declaration.
11260         (Target_arm::are_eabi_versions_compatible,
11261         (Target_arm::merge_processor_specific_flags): New method declaration.
11262         (Target_arm::do_make_elf_object): New overloaded method definitions
11263         and declaration.
11264         (Arm_relobj::do_read_symbols): New method definition.
11265         (Arm_dynobj::do_read_symbols): Ditto.
11266         (Target_arm::do_finalize_sections): Add input_objects parameters.
11267         Merge processor-specific flags from all input objects.
11268         (Target_arm::are_eabi_versions_compatible,
11269         Target_arm::merge_processor_specific_flags,
11270         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11271         New method definitions.
11272         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11273         Input_objects pointer type parameter.
11274         * layout.cc (Layout::finalize): Pass input objects to target's.
11275         finalize_sections function.
11276         * output.cc (Output_file_header::do_sized_write): Set ELF file
11277         header's processor-specific flags.
11278         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11279         Input_objects pointer type parameter.
11280         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11281         * target.h (Input_objects): New forward class declaration.
11282         (Target::processor_specific_flags,
11283         Target::are_processor_specific_flags_sect): New method definitions.
11284         (Target::finalize_sections): Add input_objects parameter.
11285         (Target::Target): Initialize processor_specific_flags_ and
11286         are_processor_specific_flags_set_.
11287         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11288         parameter.
11289         (Target::set_processor_specific_flags): New method definition.
11290         (Target::processor_specific_flags_,
11291         Target::are_processor_specific_flags_set_): New data member
11292         declarations.
11293         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11294         Input_objects pointer type parameter.
11295
11296 2009-10-30  Doug Kwan  <dougkwan@google.com>
11297
11298         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11299
11300 2009-10-28  Ian Lance Taylor  <iant@google.com>
11301
11302         * object.h (class Relobj): Drop options parameter from
11303         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11304         do_scan_relocs, do_relocate.  Change all callers.
11305         (class Sized_relobj): Drop options parameters from
11306         do_gc_process_relocs, do_scan_relocs, do_relocate,
11307         do_relocate_sections, relocate_sections, emit_relocs_scan,
11308         emit_relocs_scan_reltype.  Change all callers.
11309         (struct Relocate_info): Remove options field and all references to
11310         it.
11311         * reloc.h (class Read_relocs): Remove options constructor
11312         parameter and options_ field.  Change all callers.
11313         (class Gc_process_relocs, class Scan_relocs): Likewise.
11314         (class Relocate_task): Likewise.
11315         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11316         all callers.
11317         (scan_relocatable_relocs): Likewise.
11318         * target.h (class Sized_target): Remove options parameter from
11319         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11320         all callers.
11321         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11322         callers.
11323         * arm.cc: Update functions to remove options parameters.
11324         * i386.cc: Likewise.
11325         * powerpc.cc: Likewise.
11326         * sparc.cc: Likewise.
11327         * x86_64.cc: Likewise.
11328         * testsuite/testfile.cc: Likewise.
11329
11330 2009-10-28  Doug Kwan  <dougkwan@google.com>
11331
11332         * arm.cc (Arm_relobj): New class definition.
11333         (Arm_relobj::scan_sections_for_stubs,
11334         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11335         New method definitions.
11336
11337 2009-10-28  Cary Coutant  <ccoutant@google.com>
11338
11339         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11340         (Plugin::cleanup_done_): New member.
11341         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11342         (Plugin_manager::cleanup_done_): Remove.
11343         (Plugin_manager::add_input_file): Edit error message.
11344         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11345         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11346
11347 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11348
11349         * fileread.cc: (File_read::View::~View): Use the new
11350         data_ownership_ filed.
11351         (File_read::~File_read): Dispose the new whole_file_view_.
11352         (File_read::open): Mmap the whole file if needed.
11353         (File_read::open): Use whole_file_view_ instead of contents_.
11354         (File_read::find_view): Use whole_file_view_ if applicable.
11355         (File_read::do_read): Use whole_file_view_ instead of contents_.
11356         (File_read::make_view): Use whole_file_view_ instead of contents_,
11357         update File_read::View::View call.
11358         (File_read::find_or_make_view): Update File_read::View::View
11359         call.
11360         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11361         remove contents_
11362         (File_read::View::Data_ownership): New enum.
11363         (File_read::View::View): Replace bool mapped_ with Data_ownership
11364         argument.
11365         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11366         (File_read::View::data_ownership_): New field.
11367         (File_read::contents_): Remove (replaced by whole_file_view_).
11368         (File_read::whole_file_view_): New field.
11369         * options.h (class General_options): Add --keep-files-mapped.
11370
11371 2009-10-27  Cary Coutant  <ccoutant@google.com>
11372
11373         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11374         * testsuite/Makefile.am (plugin_test_5): New test case.
11375         * testsuite/Makefile.in: Regenerate.
11376
11377 2009-10-25  Doug Kwan  <dougkwan@google.com>
11378
11379         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11380         from private to protected to allow access by child class.
11381         (Sized_relobj::do_relocate_sections): New method declaration.
11382         (Sized_relobj::relocate_sections): Virtualize.
11383         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11384         Sized_relobj::relocate_sections.  Instantiate template explicitly
11385         for different target sizes and endianity.
11386
11387 2009-10-24  Doug Kwan  <dougkwan@google.com>
11388
11389         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11390         (Arm_input_section::as_arm_input_section): New method.
11391         (Arm_output_section): New class definition.
11392         (Arm_output_section::create_stub_group,
11393         Arm_output_section::group_sections): New method definitions.
11394
11395 2009-10-22  Doug Kwan  <dougkwan@google.com>
11396
11397         * arm.cc (Arm_input_section): New class definition.
11398         (Arm_input_section::init, Arm_input_section:do_write,
11399         Arm_input_section::set_final_data_size,
11400         Arm_input_section::do_reset_address_and_file_offset): New method
11401         definitions.
11402
11403 2009-10-21  Doug Kwan  <dougkwan@google.com>
11404
11405         * arm.cc (Stub_table, Arm_input_section): New forward class
11406         declarations.
11407         (Stub_table): New class defintion.
11408         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11409         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11410         New method definition.
11411
11412 2009-10-21  Doug Kwan  <dougkwan@google.com>
11413
11414         * arm.cc: Update copyright comments.
11415         (Target_arm): New forward class template declaration.
11416         (Arm_address): New type.
11417         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11418         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11419         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11420         constants.
11421         (Insn_template): Same.
11422         (DEF_STUBS): New macro.
11423         (Stub_type): New enum type.
11424         (Stub_template): New class definition.
11425         (Stub): Same.
11426         (Reloc_stub): Same.
11427         (Stub_factory): Same.
11428         (Target_arm::Target_arm): Initialize may_use_blx_ and
11429         should_force_pic_veneer_.
11430         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11431         Target_arm::should_force_pic_veneer,
11432         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11433         Target_arm::using_thumb_only, Target_arm:;default_target): New
11434         method defintions.
11435         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11436         New data member declarations.
11437         (Insn_template::size, Insn_template::alignment): New method defintions.
11438         (Stub_template::Stub_template): New method definition.
11439         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11440         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11441         (Stub_factory::Stub_factory): New method definition.
11442         * gold.h (string_hash): New template.
11443         * output.h (Input_section_specifier::hash_value): Use
11444         gold::string_hash.
11445         (Input_section_specifier::string_hash): Remove.
11446         * stringpool.cc (Stringpool_template::string_hash): Use
11447         gold::string_hash.
11448
11449 2009-10-20  Doug Kwan  <dougkwan@google.com>
11450
11451         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11452         symbols of relaxed input sections.
11453         * output.h (Output_section::find_relaxed_input_section): Make
11454         method public.
11455
11456 2009-10-16  Doug Kwan  <dougkwan@google.com>
11457
11458         * dynobj.cc (Versions::Versions): Initialize version_script_.
11459         Only insert base version symbol definition for a shared object
11460         if version script defines any version versions.
11461         (Versions::define_base_version): New method definition.
11462         (Versions::add_def): Check that base version is not needed.
11463         (Versions::add_need): Define base version lazily.
11464         * dynobj.h (Versions::define_base_version): New method declaration.
11465         (Versions::needs_base_version_): New data member declaration.
11466         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11467         (check_DATA): Add no_version_test.stdout.
11468         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11469         New make rules.
11470         * testsuite/Makefile.in: Regenerate.
11471         * testsuite/no_version_test.c: New file.
11472         * testsuite/no_version_test.sh: Ditto.
11473
11474 2009-10-16  Doug Kwan  <dougkwan@google.com>
11475
11476         * expression.cc (class Segment_start_expression): New class definition.
11477         (Segment_start_expression::value): New method definition.
11478         (script_exp_function_segment_start): Return a new
11479         Segment_start_expression.
11480         * gold/script-c.h (script_saw_segment_start_expression): New function
11481         prototype.
11482         * script-sections.cc (Script_sections::Script_sections): Initialize
11483         SAW_SEGMENT_START_EXPRESSION_ to false.
11484         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11485         and -Tbbs options to specify section addresses if given in
11486         command line and no SEGMENT_START expression is seen in a script.
11487         * script-sections.h (Script_sections::saw_segment_start_expression,
11488         Script_sections::set_saw_segment_start_expression): New method
11489         definition.
11490         (Script_sections::saw_segment_start_expression_): New data member
11491         declaration.
11492         * script.cc (script_saw_segment_start_expression): New function.
11493         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11494         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11495         script_test_7.sh and script_test_8.sh.
11496         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11497         script_test_8.stdout.
11498         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11499         (script_test_6, script_test_6.stdout, script_test_7,
11500         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11501         * Makefile.in: Regenerate.
11502         * testsuite/script_test_6.sh: New file.
11503         * testsuite/script_test_6.t: Same.
11504         * testsuite/script_test_7.sh: Same.
11505         * testsuite/script_test_7.t: Same.
11506         * testsuite/script_test_8.sh: Same.
11507
11508 2009-10-16  Doug Kwan  <dougkwan@google.com>
11509
11510         * output.cc (Output_segment::set_section_list_address): Cast
11511         expressions to unsigned long long type to avoid format warnings.
11512
11513 2009-10-15  Ian Lance Taylor  <iant@google.com>
11514
11515         * script.cc (Script_options::add_symbol_assignment): Always add a
11516         dot assignment to script_sections_.
11517         * script-sections.cc (Script_sections::add_dot_assignment):
11518         Initialize if necessary.
11519
11520         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11521         program headers with no load segment if there is a linker script.
11522
11523         * layout.cc (Layout::set_segment_offsets): Align the file offset
11524         to the segment aligment for -N or -n with no load segment.
11525         * output.cc (Output_segment::add_output_section): Don't crash if
11526         the first section is a TLS section.
11527         (Output_segment::set_section_list_addresses): Print an error
11528         message if the address moves backward in a linker script.
11529         * script-sections.cc
11530         (Output_section_element_input::set_section_addresses): Don't
11531         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11532         (Orphan_output_section::set_section_addresses): Likewise.
11533
11534 2009-10-15  Doug Kwan  <dougkwan@google.com>
11535
11536         * layout.cc (Layout::finish_dynamic_section): Generate tags
11537         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11538         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11539         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11540
11541 2009-10-14  Ian Lance Taylor  <iant@google.com>
11542
11543         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11544         fields.
11545         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11546         data_shdr fields of relinfo.
11547         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11548         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11549         R_386_TLS_LDO_32, adjust based on section flags.
11550         (Target_i386::Relocate::fix_up_ldo): Remove.
11551
11552 2009-10-13  Ian Lance Taylor  <iant@google.com>
11553
11554         Add support for -pie.
11555         * options.h (class General_options): Add -pie and
11556         --pic-executable.
11557         (General_options::output_is_position_independent): Test -pie.
11558         (General_options::output_is_executable): Return true if not shared
11559         and not relocatable.
11560         (General_options::output_is_pie): Remove.
11561         * options.cc (General_options::finalize): Reject incompatible uses
11562         of -pie.
11563         * gold.cc (queue_middle_tasks): A -pie link is not static.
11564         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11565         * symtab.cc (Symbol::final_value_is_known): Return false if
11566         output_is_position_independent.
11567         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11568         output_is_position_independent.
11569         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11570         output_is_position_independent.
11571         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11572         output_is_position_independent.
11573         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11574         two_file_pie_test.
11575         (basic_pie_test.o, basic_pie_test): New targets.
11576         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11577         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11578         (two_file_pie_test): New target.
11579         * testsuite/Makefile.in: Rebuild.
11580         * README: Remove note saying that -pie is not supported.
11581
11582 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11583
11584         * options.h (class General_options): Add -init and -fini.
11585         * layout.cc (Layout::finish_dynamic_section): Emit
11586         given init and fini functions.
11587
11588 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11589
11590         * gc.h (gc_process_relocs): Check if icf is enabled using new
11591         function.
11592         * gold.cc (queue_initial_tasks): Likewise.
11593         (queue_middle_tasks): Likewise.
11594         * object.cc (do_layout): Likewise.
11595         * symtab.cc (is_section_folded): Likewise.
11596         * main.cc (main): Likewise.
11597         * reloc.cc (Read_relocs::run): Likewise.
11598         (Sized_relobj::do_scan_relocs): Likewise.
11599         * icf.cc (is_function_ctor_or_dtor): New function.
11600         (Icf::find_identical_sections): Check if function is ctor or dtor when
11601         safe icf is chosen.
11602         * options.h (General_options::icf): Change option to be an enum.
11603         (Icf_status): New enum.
11604         (icf_enabled): New method.
11605         (icf_safe_folding): New method.
11606         (set_icf_status): New method.
11607         (icf_status_): New variable.
11608         * (options.cc) (General_options::finalize): Set icf_status_.
11609         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11610         icf_test and icf_keep_unique_test to use the --icf enum flag.
11611         * testsuite/icf_safe_test.sh: New file.
11612         * testsuite/icf_safe_test.cc: New file.
11613
11614 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11615
11616         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11617         includes to gc.h and icf.h.
11618         * arm.cc: Include gc.h.
11619         * gold.cc: Likewise.
11620         * i386.cc: Likewise.
11621         * powerpc.cc: Likewise.
11622         * sparc.cc: Likewise.
11623         * x86_64.cc: Likewise.
11624         * gc.h: Include icf.h.
11625
11626 2009-10-11  Ian Lance Taylor  <iant@google.com>
11627
11628         * plugin.cc: Include "gold.h" before other header files.
11629
11630 2009-10-10  Chris Demetriou  <cgd@google.com>
11631
11632         * options.h (Input_file_argument::Input_file_type): New enum.
11633         (Input_file_argument::is_lib_): Replace with...
11634         (Input_file_argument::type_): New member.
11635         (Input_file_argument::Input_file_argument): Take Input_file_type
11636         'type' rather than boolean 'is_lib' as second argument.
11637         (Input_file_argument::is_lib): Use type_.
11638         (Input_file_argument::is_searched_file): New function.
11639         (Input_file_argument::may_need_search): Handle is_searched_file.
11640         * options.cc (General_options::parse_library): Support -l:filename.
11641         (General_options::parse_just_symbols): Update for Input_file_argument
11642         changes.
11643         (Command_line::process): Likewise.
11644         * archive.cc (Archive::get_file_and_offset): Likewise.
11645         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11646         * script.cc (read_script_file, script_add_file): Likewise.
11647         * fileread.cc (Input_file::Input_file): Likewise.
11648         (Input_file::will_search_for): Handle is_searched_file.
11649         (Input_file::open): Likewise.
11650         * readsyms.cc (Read_symbols::get_name): Likewise.
11651         * testsuite/Makefile.am (searched_file_test): New test.
11652         * testsuite/Makefile.in: Regenerate.
11653         * testsuite/searched_file_test.cc: New file.
11654         * testsuite/searched_file_test_lib.cc: New file.
11655
11656 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11657             Ian Lance Taylor  <iant@google.com>
11658
11659         * descriptor.cc: Include <cstdio> and "binary-io.h".
11660         (Descriptors::open): Open the files in binary mode always.
11661         * script.cc (Lex::get_token): Treat \r as whitespace.
11662
11663 2009-10-09  Ian Lance Taylor  <iant@google.com>
11664
11665         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11666
11667 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11668             Ian Lance Taylor  <iant@google.com>
11669
11670         * configure.ac: Check for readv function also.
11671         * fileread.cc (readv): Define if not HAVE_READV.
11672         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11673         does not exist.
11674         * config.in: Regenerate.
11675         * configure: Regenerate.
11676
11677 2009-10-09  Doug Kwan  <dougkwan@google.com>
11678
11679         * layout.cc (Layout::make_output_section): Call target hook to make
11680         ordinary output section.
11681         (Layout::finalize): Adjust parameter list of call the
11682         Target::may_relax().
11683         * layout.h (class Layout::section_list): New method.
11684         * merge.h (Output_merge_base::entsize): Change visibility to public.
11685         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11686         New methods.
11687         (Output_merge_string::do_is_string): New method.
11688         * object.cc (Sized_relobj::do_setup): renamed from
11689         Sized_relobj::set_up.
11690         * object.h (Sized_relobj::adjust_shndx,
11691         Sized_relobj::initializ_input_to_output_maps,
11692         Sized_relobj::free_input_to_output_maps): Change visibilities to
11693         protected.
11694         (Sized_relobj::setup): Virtualize.
11695         (Sized_relobj::do_setup): New method declaration.
11696         (Sized_relobj::invalidate_section_offset,
11697         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11698         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11699         * options.cc (parse_int): New function.
11700         * options.h (parse_int): New declaration.
11701         (DEFINE_int): New macro.
11702         (stub_group_size): New option.
11703         * output.cc (Output_section::Output_section): Initialize memebers
11704         merge_section_map_, merge_section_by_properties_map_,
11705         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11706         (Output_section::add_input_section): Handled deferred code-fill
11707         generation and remove an old comment.
11708         (Output_section::add_relaxed_input_section): New method definition.
11709         (Output_section::add_merge_input_section): Use merge section by
11710         properties map to speed to search.  Update merge section maps
11711         as appropriate.
11712         (Output_section::build_relaxation_map): New method definition.
11713         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11714         Same.
11715         (Output_section::relax_input_section): Renamed to
11716         Output_section::convert_input_sections_to_relaxed_sections and change
11717         interface to take a vector of pointers to relaxed sections.
11718         (Output_section::find_merge_section,
11719         Output_section::find_relaxed_input_section): New method definitions.
11720         (Output_section::is_input_address_mapped,
11721         Output_section::output_offset, Output_section::output_address):
11722         Use output section data maps to speed up searching.
11723         (Output_section::find_starting_output_address): Add comments.
11724         (Output_section::do_write,
11725         Output_section::write_to_postprocessing_buffer): Do code-fill
11726         generation as appropriate.
11727         (Output_section::get_input_sections): Invalidate relaxed input section
11728         map.
11729         (Output_section::restore_states): Adjust type of checkpoint .
11730         Invalidate relaxed input section map.
11731         * output.h (Output_merge_base): New class declaration.
11732         (Input_section_specifier): New class defintion.
11733         (class Output_relaxed_input_section) Change base class to
11734         Output_section_data_build.
11735         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11736         base class initializer.
11737         (Output_section::add_relaxed_input_section): New method declaration.
11738         (Output_section::Input_section): Change visibility to protected.
11739         (Output_section::Input_section::relobj,
11740         Output_section::Input_section::shndx): Handle relaxed input sections.
11741         Output_section::input_sections) Change visibility to protected.  Also
11742         define overload to return a non-const pointer.
11743         (Output_section::Merge_section_properties): New class defintion.
11744         (Output_section::Merge_section_by_properties_map,
11745         Output_section::Output_section_data_by_input_section_map,
11746         Output_section::Relaxation_map): New types.
11747         (Output_section::relax_input_section): Rename method to
11748         Output_section::convert_input_sections_to_relaxed_sections and change
11749         interface to take a vector of relaxed section pointers.
11750         (Output_section::find_merge_section,
11751         Output_section::find_relaxed_input_section,
11752         Output_section::build_relaxation_map,
11753         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11754         New method declarations.
11755         (Output_section::merge_section_map_
11756         Output_section::merge_section_by_properties_map_,
11757         Output_section::relaxed_input_section_map_,
11758         Output_section::is_relaxed_input_section_map_valid_,
11759         Output_section::generate_code_fills_at_write_): New data members.
11760         * script-sections.cc
11761         (Output_section_element_input::set_section_addresses): Call
11762         current_data_size and addralign methods of relaxed input sections.
11763         (Orphan_output_section::set_section_addresses): Call current_data_size
11764         and addralign methods of relaxed input sections.
11765         * symtab.cc (Symbol_table::compute_final_value): Extract template
11766         from the body of Symbol_table::sized_finalize_symbol.
11767         (Symbol_table::sized_finalized_symbol): Call
11768         Symbol_table::compute_final_value.
11769         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11770         (Symbol_table::compute_final_value): New templated method declaration.
11771         * target.cc (Target::do_make_output_section): New method defintion.
11772         * target.h (Target::make_output_section): New method declaration.
11773         (Target::relax): Add more parameters for input objects, symbol table
11774         and layout.  Adjust call to do_relax.
11775         (Target::do_make_output_section): New method declaration.
11776         (Target::do_relax): Add parameters for input objects, symbol table
11777         and layout.
11778
11779 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11780
11781         * pread.c: Include stdio.h.
11782
11783 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11784
11785         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11786         defined.
11787
11788 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11789
11790         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11791         Change read_shndx type to unsigned int.
11792         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11793         int.
11794         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11795         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11796         Change read_shndx type to unsigned int.
11797         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11798         int.
11799         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11800         * layout.cc (Layout::create_symtab_sections): Cast the result of
11801         local_symcount * symsize to off_t in the gold_assert.
11802
11803 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11804
11805         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11806         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11807         R_ARM_BASE_ABS.
11808         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11809         (Arm_relocate_functions::thm_abs5): New function.
11810         (Arm_relocate_functions::abs12): New function.
11811         (Arm_relocate_functions::abs16): New function.
11812         (Arm_relocate_functions::base_abs): New function.
11813         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11814         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11815         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11816         R_ARM_BASE_ABS.
11817         (Scan::global): Likewise.
11818         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11819         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11820         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11821         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11822         R_ARM_BASE_ABS.
11823
11824 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11825
11826         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11827         (Arm_relocate_functions::movt_prel): New function.
11828         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11829         (Arm_relocate_functions::thm_movt_prel): New function.
11830         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11831         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11832         (Scan::global, Relocate::relocate): Likewise.
11833         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11834
11835 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11836
11837         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11838         Incremental_checker.
11839         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11840         unsigned int.
11841         (class Incremental_inputs_header): New class.
11842         (Incremental_inputs_header_writer): Edit comment.
11843         (Incremental_inputs_entry): New class.
11844         (Incremental_inputs_entry_writer): Edit comment.
11845         (Sized_incremental_binary::do_find_incremental_inputs_section):
11846         Add *strtab_shndx parameter, fill it.
11847         (Sized_incremental_binary::do_check_inputs): New method.
11848         (Incremental_checker::can_incrementally_link_output_file): Use
11849         Sized_incremental_binary::check_inputs.
11850         (Incremental_inputs::report_command_line): Save command line in
11851         command_line_.
11852         * incremental.h:
11853         (Incremental_binary::find_incremental_inputs_section): New
11854         method.
11855         (Incremental_binary::do_find_incremental_inputs_section): Add
11856         strtab_shndx parameter.
11857         (Incremental_binary::do_check_inputs): New pure virtual method.
11858         (Sized_incremental_binary::do_check_inputs): Declare.
11859         (Incremental_checker::Incremental_checker): Add incremental_inputs
11860         parameter, use it to initialize incremental_inputs_.
11861         (Incremental_checker::incremental_inputs_): New field.
11862         (Incremental_checker::command_line): New method.
11863         (Incremental_checker::inputs): New method.
11864         (Incremental_checker::command_line_): New field.
11865
11866 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11867
11868         * incremental.cc: Include <cstdarg> and "target-select.h".
11869         (vexplain_no_incremental): New function.
11870         (explain_no_incremental): New function.
11871         (Incremental_binary::error): New method.
11872         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11873         method.
11874         (make_sized_incremental_binary): New function.
11875         (open_incremental_binary): New function.
11876         (can_incrementally_link_file): Add checks if output is ELF and has
11877         inputs section.
11878         * incremental.h: Include "elfcpp_file.h" and "output.h".
11879         (Incremental_binary): New class.
11880         (Sized_incremental_binary): New class.
11881         (open_incremental_binary): Declare.
11882         * object.cc (is_elf_object): Use
11883         elfcpp::Elf_recognizer::is_elf_file.
11884         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11885         * output.h (Output_file::filesize): New method.
11886
11887 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11888
11889         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11890         New function.
11891         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11892         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11893         function.
11894         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11895         function.
11896         (Arm_relocate_functions::movw_abs_nc): New function.
11897         (Arm_relocate_functions::movt_abs): New function.
11898         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11899         (Arm_relocate_functions::thm_movt_abs): New function.
11900         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11901         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11902         (Scan::global): Likewise.
11903         (Relocate::relocate): Likewise.
11904         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11905
11906 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11907
11908         * arm.cc (Arm_relocate_functions::got_prel) New function.
11909         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11910         (Relocate::relocate): Likewise.
11911         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11912
11913 2009-10-06  Ian Lance Taylor  <iant@google.com>
11914
11915         * options.h (class General_options): Define
11916         split_stack_adjust_size parameter.
11917         * object.h (class Object): Add uses_split_stack_ and
11918         has_no_split_stack_ fields.  Add uses_split_stack and
11919         has_no_split_stack accessor functions.  Declare
11920         handle_split_stack_section.
11921         (class Reloc_symbol_changes): Define.
11922         (class Sized_relobj): Define Function_offsets.  Declare
11923         split_stack_adjust, split_stack_adjust_reltype, and
11924         find_functions.
11925         * object.cc (Object::handle_split_stack_section): New function.
11926         (Sized_relobj::do_layout): Call handle_split_stack_section.
11927         * dynobj.cc (Sized_dynobj::do_layout): Call
11928         handle_split_stack_section.
11929         * reloc.cc (Sized_relobj::relocate_sections): Call
11930         split_stack_adjust for executable sections in split_stack
11931         objects.  Pass reloc_map to relocate_section.
11932         (Sized_relobj::split_stack_adjust): New function.
11933         (Sized_relobj::split_stack_adjust_reltype): New function.
11934         (Sized_relobj::find_functions): New function.
11935         * target-reloc.h: Include "object.h".
11936         (relocate_section): Add reloc_symbol_changes parameter.  Change
11937         all callers.
11938         * target.h (class Target): Add calls_non_split method.  Declare
11939         do_calls_non_split virtual method.  Declare match_view and
11940         set_view_to_nop.
11941         * target.cc: Include "elfcpp.h".
11942         (Target::do_calls_non_split): New function.
11943         (Target::match_view): New function.
11944         (Target::set_view_to_nop): New function.
11945         * gold.cc (queue_middle_tasks): Give an error if mixing
11946         split-stack and non-split-stack objects with -r.
11947         * i386.cc (Target_i386::relocate_section): Add
11948         reloc_symbol_changes parameter.
11949         (Target_i386::do_calls_non_split): New function.
11950         * x86_64.cc (Target_x86_64::relocate_section): Add
11951         reloc_symbol_changes parameter.
11952         (Target_x86_64::do_calls_non_split): New function.
11953         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11954         parameter.
11955         * powerpc.cc (Target_powerpc::relocate_section): Add
11956         reloc_symbol_changes parameter.
11957         * sparc.cc (Target_sparc::relocate_section): Add
11958         reloc_symbol_changes parameter.
11959         * configure.ac: Call AM_CONDITIONAL for the default target.
11960         * configure: Rebuild.
11961         * testsuite/Makefile.am (TEST_AS): New variable.
11962         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11963         (check_DATA): Add split_i386 and split_x86_64 files.
11964         (SPLIT_DEFSYMS): Define.
11965         (split_i386_[1234n].o): New targets.
11966         (split_i386_[124]): New targets.
11967         (split_i386_[1234r].stdout): New targets.
11968         (split_x86_64_[1234n].o): New targets.
11969         (split_x86_64_[124]): New targets.
11970         (split_x86_64_[1234r].stdout): New targets.
11971         (MOSTLYCLEANFILES): Add new executables.
11972         * testsuite/split_i386.sh: New file.
11973         * testsuite/split_x86_64.sh: New file.
11974         * testsuite/split_i386_1.s: New file.
11975         * testsuite/split_i386_2.s: New file.
11976         * testsuite/split_i386_3.s: New file.
11977         * testsuite/split_i386_4.s: New file.
11978         * testsuite/split_i386_n.s: New file.
11979         * testsuite/split_x86_64_1.s: New file.
11980         * testsuite/split_x86_64_2.s: New file.
11981         * testsuite/split_x86_64_3.s: New file.
11982         * testsuite/split_x86_64_4.s: New file.
11983         * testsuite/split_x86_64_n.s: New file.
11984         * testsuite/testfile.cc (Target_test): Update relocation_section
11985         function.
11986         * testsuite/Makefile.in: Rebuild.
11987
11988 2009-10-06  Ian Lance Taylor  <iant@google.com>
11989
11990         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11991         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11992         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11993         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11994         the address on ldo_addrs_.
11995         (Target_i386::Relocate::fix_up_ldo): New function.
11996
11997 2009-10-06   Rafael Espindola  <espindola@google.com>
11998
11999         * plugin.cc (add_input_library): New.
12000         (Plugin::load): Add add_input_library to tv.
12001         (Plugin_manager::add_input_file): Add the is_lib argument.
12002         (add_input_file): Update call to Plugin_manager::add_input_file.
12003         (add_input_library): New.
12004         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12005
12006 2009-09-30  Doug Kwan  <dougkwan@google.com>
12007
12008         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12009         symbol and call Symbol::may_need_copy_reloc to determine if
12010         a copy reloc is needed.
12011         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12012         nocopyreloc is given in command line.
12013         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12014         given in command line.
12015         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12016         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12017         of the removed Target_i386::may_need_copy_reloc.
12018         * options.h (copyreloc): New option with default value false.
12019         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12020         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12021         instead of the removed Target_powerpc::may_need_copy_reloc.
12022         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12023         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12024         instead of the removed Target_sparc::may_need_copy_reloc.
12025         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12026         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12027         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12028         instead of the removed Target_x86_64::may_need_copy_reloc.
12029
12030 2009-09-30  Ian Lance Taylor  <iant@google.com>
12031
12032         * object.h (class Object): Remove target_ field, and target,
12033         sized_target, and set_target methods.
12034         (Object::sized_target): Remove.
12035         (class Sized_relobj): Update declarations.  Remove sized_target.
12036         * object.cc (Sized_relobj::setup): Remove target parameter.
12037         Change all callers.
12038         (Input_objects::add_object): Don't do anything with the target.
12039         (make_elf_sized_object): Add punconfigured parameter.  Change all
12040         callers.  Set or test parameter target.
12041         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12042         Change all callers.
12043         * parameters.cc (Parameters::set_target): Change parameter type to
12044         be non-const.
12045         (Parameters::default_target): Remove.
12046         (set_parameters_target): Change parameter type to be non-const.
12047         (parameters_force_valid_target): New function.
12048         (parameters_clear_target): New function.
12049         * parameters.h (class Parameters): Update declarations.  Remove
12050         default_target method.  Add sized_target and clear_target
12051         methods.  Change target_ to be non-const.
12052         (set_parameters_target): Update declaration.
12053         (parameters_force_valid_target): Declare.
12054         (parameters_clear_target): Declare.
12055         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12056         as NULL if we aren't searching.
12057         (Add_symbols::run): Don't check for compatible target.
12058         * fileread.cc (Input_file::open_binary): Call
12059         parameters_force_valid_target.
12060         * gold.cc (queue_middle_tasks): Likewise.
12061         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12062         set_target on object.
12063         * dynobj.h (class Sized_dynobj): Update declarations.
12064         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12065         make_elf_object returns NULL.
12066         (Archive::include_member): Don't check whether object target is
12067         compatible.
12068         * output.cc (Output_section::add_input_section): Get target from
12069         parameters.
12070         (Output_section::relax_input_section): Likewise.
12071         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12072         parameters.
12073         (Sized_relobj::do_scan_relocs): Likewise.
12074         (Sized_relobj::relocate_sections): Likewise.
12075         * resolve.cc (Symbol_table::resolve): Likewise.
12076         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12077         parameter.  Change all callers.
12078         (Symbol_table::add_from_object): Get target from parameters.
12079         (Symbol_table::add_from_relobj): Don't check object target.
12080         (Symbol_table::add_from_dynobj): Likewise.
12081         (Symbol_table::define_special_symbol): Get target from
12082         parameters.
12083         * symtab.h (class Symbol_table): Update declaration.
12084         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12085         parameter.  Change all callers.  Clear parameter target.
12086         (Binary_test): Test target here.
12087         * testsuite/object_unittest.cc (gold_testsuite): Remove
12088         target_test_pointer parameter.  Change all callers.
12089         (Object_test): Test target here.
12090
12091 2009-09-26  Ian Lance Taylor  <iant@google.com>
12092
12093         * testsuite/initpri1.c: Don't try to use constructor priorities if
12094         compiling with gcc before 4.3.
12095
12096 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12097
12098         * testsuite/retain_symbols_file_test.sh (check_present): Change
12099         output file name to retain_symbols_file_test.stdout.
12100         (check_absent): Likewise.
12101
12102 2009-09-18  Craig Silverstein  <csilvers@google.com>
12103
12104         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12105         * options.cc: Include <cerrno> and <fstream>.
12106         (General_options::finalize): Parse -retain-symbols-file tag.
12107         * options.h: New flag.
12108         (General_options): New method should_retain_symbol, new
12109         variable symbols_to_retain.
12110         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12111         should_retain_symbol map.
12112         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12113         * testsuite/Makefile.in: Regenerate.
12114         * testsuite/retain_symbols_file_test.sh: New file.
12115
12116 2009-09-18  Nick Clifton  <nickc@redhat.com>
12117
12118         * po/es.po: Updated Spanish translation.
12119
12120 2009-09-17  Doug Kwan  <dougkwan@google.com>
12121
12122         * debug.h (DEBUG_RELAXATION): New constant.
12123         (DEBUG_ALL): Add DEBUG_RELAXATION.
12124         (debug_string_to_enum): Add relaxation debug option.
12125         * layout.cc
12126         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12127         Layout::Relaxation_debug_check::read_sections,
12128         Layout::Relaxation_debug_check::read_sections): New method definitions.
12129         (Layout::Layout): Initialize data members
12130         record_output_section_data_from_scrips_,
12131         script_output_section_data_list_ and relaxation_debug_check_.
12132         (Layout::save_segments, Layout::restore_segments,
12133         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12134         Layout::relaxation_loop_body): New method definitions.
12135         (Layout::finalize): Support relaxation.  Move section layout code to
12136         Layout::relaxation_loop_body.
12137         (Layout::set_asection_address_from_script): Move code for orphan
12138         section placement out.
12139         (Layout::place_orphan_sections_in_script): New method definition.
12140         * layout.h (Output_segment_headers, Output_file_header):
12141         New forward class declarations.
12142         (Layout::~Layout): Define.
12143         (Layout::new_output_section_data_from_script): New method definition.
12144         (Layout::place_orphan_sections_in_script): New method declaration.
12145         (Layout::Segment_states): New type declaration.
12146         (Layout::save_segments, Layout::restore_segments,
12147         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12148         Layout::relaxation_loop_body): New method declarations.
12149         (Layout::Output_section_data_list): New type declaration.
12150         (Layout::Relaxation_debug_check): New class definition.
12151         (Layout::record_output_section_data_from_script_,
12152         Layout::script_output_section_data_list_, Layout::segment_states_,
12153         Layout::relaxation_debug_check_): New data members.
12154         * output.cc: (Output_section_headers::do_size): New method definition.
12155         (Output_section_headers::Output_section_headers): Move size
12156         computation to Output_section_headers::do_size.
12157         (Output_segment_headers::do_size): New method definition.
12158         (Output_file_header::Output_file_header): Move size computation to
12159         Output_file_header::do_size and call it.
12160         (Output_file_header::do_size): New method definition.
12161         (Output_data_group::Output_data_group): Adjust call to
12162         Output_section_data.
12163         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12164         (Output_symtab_xindex::do_write): Add array bound check.
12165         (Output_section::Input_section::print_to_mapfile): Handle
12166         RELAXED_INPUT_SECTION_CODE.
12167         (Output_section::Output_section): Initialize data member checkpoint_.
12168         (Output_section::~Output_section): Delete checkpoint object pointed
12169         by checkpoint_.
12170         (Output_section::add_input_section): Always add an Input_section if
12171         relaxing.
12172         (Output_section::add_merge_input_section): Add assert.
12173         (Output_section::relax_input_section): New method definition.
12174         (Output_section::set_final_data_size): Set load address to zero for
12175         an unallocated section.
12176         (Output_section::do_address_and_file_offset_have_reset_values):
12177         New method definition.
12178         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12179         Handle relaxed input section.
12180         (Output_section::sort_attached_input_sections): Checkpoint input
12181         section list lazily.
12182         (Output_section::get_input_sections): Change type of input_sections to
12183         list of Simple_input_section pointers.  Checkpoint input section list
12184         lazily.  Also handle relaxed input sections.
12185         (Output_section::add_input_section_for_script): Take a reference to
12186         a Simple_input_section object instead of Relobj pointer and section
12187         index as parameter.  Handle relaxed input sections.
12188         (Output_section::save_states, Output_section::restore_states): New
12189         method definitions.
12190         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12191         (Output_data::is_data_size_fixed): New method definition.
12192         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12193         if it is fixed.
12194         (Output_data::address_and_file_offset_have_reset_values): New method
12195         definition.
12196         (Output_data::do_address_and_file_offset_have_reset_values): New method
12197         definition.
12198         (Output_data::set_data_size): Check that data size is not fixed.
12199         (Output_data::fix_data_size): New method definition.
12200         (Output_data::is_data_size_fixed_): New data member.
12201         (Output_section_headers::set_final_data_size): New method definition.
12202         (Output_section_headers::do_size): New method declaration.
12203         (Output_segment_headers::set_final_data_size): New method definition.
12204         (Output_segment_headers::do_size): New method declaration.
12205         (Output_file_header::set_final_data_size)::New method definition.
12206         (Output_file_header::do_size)::New method declaration.
12207         (Output_section_data::Output_section_data): Add new parameter
12208         is_data_size_fixed and use it to fix data size.
12209         (Output_data_const::Output_data_const): Adjust call to base class
12210         constructor and fix data size.
12211         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12212         base class constructor and fix data size.
12213         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12214         base class constructor and fix data size.
12215         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12216         class constructor and fix data size.
12217         (Output_data_group::set_final_data_size): New method definition.
12218         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12219         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12220         class constructor and fix data size.
12221         (Output_relaxed_input_section): New class definition.
12222         (Output_section::Simple_input_section): New class definition.
12223         (Output_section::get_input_sections): Adjust parameter list.
12224         (Output_section::add_input_section_for_script): Same.
12225         (Output_section::save_states, Output_section::restore_states,
12226         Output_section::do_address_and_file_offset_have_reset_values,
12227         (Output_section::Input_section::Input_section): Handle
12228         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12229         Output_relaxed_input_section.
12230         (Output_section::Input_section::is_input_section,
12231         Output_section::Input_section::set_output_section): Handle relaxed
12232         input section.
12233         (Output_section::Input_section::is_relaxed_input_section,
12234         Output_section::Input_section::output_section_data,
12235         Output_section::Input_section::relaxed_input_section): New method
12236         definitions.
12237         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12238         value.
12239         (Output_section::Input_section::u1_): Update comments.
12240         (Output_section::Input_section::u2_): Add new union member poris.
12241         (Output_section::Checkpoint_output_section): New classs definition.
12242         (Output_section::relax_input_section): New method declaration.
12243         (Output_section::checkpoint_): New data member.
12244         (Output_segment): Update comments.
12245         (Output_segment::Output_segment): Un-privatize copy constructor.
12246         (Output_segment::operator=): Un-privatize.
12247         * script-sections.cc (Output_section_element::Input_section_list):
12248         Change element type to Output_section::Simple_input_section.
12249         (Output_section_element_dot_assignment::set_section_addresses):
12250         Register output section data for relaxation clean up.
12251         (Output_data_exression::Output_data_expression): Adjust call to base
12252         constructor to fix data size.
12253         (Output_section_element_data::set_section_addresses): Register
12254         Output_data_expression object for relaxation clean up.
12255         (struct Input_section_info): Replace Relobj pointer and section index
12256         pair with Output_section::Simple_input_section and Convert struct to a
12257         class.
12258         (Input_section_sorter::operator()): Adjust access to
12259         Input_section_info data member to use accessors.
12260         (Output_section_element_input::set_section_addresses): Use layout
12261         parameter.  Adjust code to use Output_section::Simple_input_section
12262         and Input_secction_info classes.  Register filler for relaxation
12263         clean up.
12264         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12265         and section index pair with Output_section::Simple_input_section
12266         class.  Adjust code accordingly.
12267         (Phdrs_element::release_segment): New method definition.
12268         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12269         segment list.
12270         (Script_sections::release_segments): New method definition.
12271         * gold/script-sections.h (Script_sections::release_segments): New
12272         method declaration.
12273         * gold/target.h (Target::may_relax, Target::relax,
12274         Target::do_may_relax, Target::do_relax): New method definitions.
12275
12276 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12277
12278         * arm.cc (has_signed_unsigned_overflow): New function.
12279         (Arm_relocate_functions::abs8): New function.
12280         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12281         (Target_arm::Scan::global): Likewise.
12282         (Target_arm::relocate::relocate): Likewise.
12283         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12284         Likewise.
12285
12286 2009-09-16  Cary Coutant  <ccoutant@google.com>
12287
12288         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12289         * testsuite/Makefile.in: Regenerate.
12290
12291 2009-09-11  Nick Clifton  <nickc@redhat.com>
12292
12293         * po/gold.pot: Updated by the Translation project.
12294
12295 2009-09-08  Cary Coutant  <ccoutant@google.com>
12296
12297         * output.cc (Output_file::open): Add execute permission to empty file.
12298         * testsuite/Makefile.am (permission_test): New test.
12299         * testsuite/Makefile.in: Regenerate.
12300
12301 2009-09-02  Ian Lance Taylor  <iant@google.com>
12302
12303         * output.cc (Output_file::resize): Call map_no_anonymous rather
12304         than map.
12305
12306 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12307
12308         * gold.cc: Include "incremental.h".
12309         (queue_initial_tasks): Call Incremental_checker methods.
12310         * incremental.cc: Include "output.h".
12311         (Incremental_checker::can_incrementally_link_output_file): New
12312         method.
12313         * incremental.h (Incremental_checker): New class.
12314
12315         * output.cc (Output_file::open_for_modification): New method.
12316         (Output_file::map_anonymous): Changed return type to bool.  Record
12317         map in base_ field.
12318         (Output_file::map_no_anonymous): New method, broken out of map.
12319         (Output_file::map): Use map_no_anonymous and map_anonymous.
12320         * output.h (class Output_file): Update declarations.
12321
12322 2009-08-24  Cary Coutant  <ccoutant@google.com>
12323
12324         * options.h (Command_line::Pre_options): New class.
12325         (Command_line::pre_options): New member.
12326         * options.cc (gold::options::ready_to_register): New variable.
12327         (One_option::register_option): Do nothing if not registering options.
12328         Assert if same short option registered twice.
12329         (General_options::General_options): Turn off option registration when
12330         done constructing.
12331         (Command_line::Pre_options::Pre_options): New constructor.
12332
12333 2009-08-24  Cary Coutant  <ccoutant@google.com>
12334
12335         * options.h (General_options::no_keep_memory): Remove incorrect
12336         short option.
12337
12338 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12339
12340         * Makefile.am (am__skiplex, am__skipyacc): New.
12341         * Makefile.in: Regenerate.
12342
12343 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12344
12345         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12346         (INCLUDES): ... this.
12347         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12348         (AM_CPPFLAGS): Renamed from ...
12349         (INCLUDE): ... this.
12350         * Makefile.in, testsuite/Makefile.in: Regenerate.
12351
12352         * Makefile.in: Regenerate.
12353         * aclocal.m4: Likewise.
12354         * config.in: Likewise.
12355         * configure: Likewise.
12356         * testsuite/Makefile.in: Likewise.
12357
12358         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12359         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12360         * Makefile.in: Regenerate.
12361         * testsuite/Makefile.in: Regenerate.
12362
12363 2009-08-19  Cary Coutant  <ccoutant@google.com>
12364
12365         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12366         symbols in shared libraries overridden by hidden or internal symbols
12367         in the main program.
12368
12369 2009-08-19  Chris Demetriou  <cgd@google.com>
12370
12371         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12372         checking source file names in error messages.
12373
12374 2009-08-18  Doug Kwan  <dougkwan@google.com>
12375
12376         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12377         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12378         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12379         an elfcpp::Ehdr as parameter.
12380         * object.cc (Object::set_target): Remove the version that looks up
12381         a target and sets it.
12382         (Sized_relobj::setup): Take a Target object instead of
12383         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12384         (make_elf_sized_object): Find target and ask target to
12385         make an ELF object.
12386         * object.h: (Object::set_target): Remove the version that looks up
12387         a target and sets it.
12388         (Sized_relobj::setup): Take a Target object instead of
12389         an elfcpp:Ehdr as parameter.
12390         * target.cc: Include dynobj.h.
12391         (Target::do_make_elf_object_implementation): New.
12392         (Target::do_make_elf_object): New.
12393         * target.h (Target::make_elf_object): New template declaration.
12394         (Target::do_make_elf_object): New method declarations.
12395         (Target::do_make_elf_object_implementation): New template declaration.
12396
12397 2009-08-14  Ian Lance Taylor  <iant@google.com>
12398
12399         * gold.h (FUNCTION_NAME): Define.
12400         (gold_unreachable): Use FUNCTION_NAME.
12401
12402 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12403
12404         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12405         symbol in the --keep-unique list is not found.
12406
12407 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12408
12409         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12410         been maked as --keep-unique.
12411         (Icf::unfold_section): New function.
12412         * icf.h (Icf::unfold_section): New function.
12413         * options.h (General_options::keep_unique): New option.
12414         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12415         * testsuite/Makefile.in: Regenerate.
12416         * testsuite/icf_keep_unique_test.sh: New file.
12417         * testsuite/icf_keep_unique_test.cc: New file.
12418
12419 2009-08-12  Cary Coutant  <ccoutant@google.com>
12420
12421         PR 10471
12422         * resolve.cc (Symbol_table::resolve): Check for references from
12423         dynamic objects to hidden and internal symbols.
12424         * testsuite/Makefile.am (hidden_test.sh): New test.
12425         * testsuite/Makefile.in: Regenerate.
12426         * testsuite/hidden_test.sh: New script.
12427         * testsuite/hidden_test_1.c: New test source.
12428         * testsuite/hidden_test_main.c: New test source.
12429
12430 2009-08-11  Doug Kwan  <dougkwan@google.com>
12431
12432         * arm.cc: Update comments.
12433         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12434         segment to locate the .ARM.exidx section if present.
12435
12436 2009-08-09  Doug Kwan  <dougkwan@google.com>
12437
12438         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12439         patch.
12440
12441 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12442         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12443         compiler warnings.
12444
12445 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12446
12447         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12448         valid tls_segment only for non-debug-section relocations.
12449         * testsuite/Makefile.am: Add gc_tls_test.
12450         * testsuite/Makefile.in: Regenerate.
12451         * testsuite/gc_tls_test.cc: New file.
12452         * testsuite/gc_tls_test.sh: New file.
12453
12454 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12455
12456         * icf.cc: New file.
12457         * icf.h: New file.
12458         * Makefile.am (CCFILES): Add icf.cc.
12459         (HFILES): Add icf.h
12460         * Makefile.in: Regenerate.
12461         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12462         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12463         section, symbol and addend information for the relocs.
12464         * gold.cc (queue_middle_tasks): Call identical code folding.
12465         * gold.h: Add defines for multimap.
12466         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12467         to the call of finalize_local_symbols.
12468         * main.cc (main): Create object of class Icf.
12469         * object.cc (Sized_relobj::do_layout): Allow this function to be
12470         called twice during icf.
12471         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12472         to sections marked as identical by icf.
12473         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12474         when available.
12475         (Sized_relobj::do_section_entsize): New function.
12476         * object.h (Object::section_entsize): New function.
12477         (Object::do_section_entsize): New pure virtual function.
12478         (Relobj::finalize_local_symbols): Add new parameter.
12479         (Relobj::do_section_entsize): New function.
12480         * options.h (General_options::icf): New option.
12481         (General_options::icf_iterations): New option.
12482         (General_options::print_icf_sections): New option.
12483         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12484         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12485         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12486         icf.
12487         * symtab.cc (Symbol_table::is_section_folded): New function.
12488         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12489         to sections marked as identical by icf.
12490         * symtab.h (Symbol_table::set_icf): New function.
12491         (Symbol_table::icf): New function.
12492         (Symbol_table::is_section_folded): New function.
12493         (Symbol_table::icf_): New data member.
12494         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12495         * testsuite/Makefile.am: Add commands to build icf_test.
12496         * testsuite/Makefile.in: Regenerate.
12497         * testsuite/icf_test.sh: New file.
12498         * testsuite/icf_test.cc: New file.
12499
12500 2009-07-24  Chris Demetriou  <cgd@google.com>
12501
12502         * layout.cc (is_compressible_debug_section): Fix incorrect
12503         comment about compressed section names.
12504
12505 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12506
12507         PR 10419
12508         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12509
12510 2009-07-16  Ian Lance Taylor  <iant@google.com>
12511
12512         PR 10400
12513         * layout.h: #include <map>.
12514         (class Kept_section): Change from struct to class.  Add accessors
12515         and setters.  Add section size to Comdat_group mapping.  Change
12516         Comdat_group to std::map.  Add is_comdat_ field.  Add
12517         linkonce_size field in union.
12518         (class Layout): Update declaration of find_or_add_kept_section.
12519         Don't declare find_kept_object.
12520         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12521         parameter.  Add object, shndx, is_comdat, and is_group_name
12522         parameters.  Change all callers.  Adjust for new Kept_section.
12523         (Layout::find_kept_object): Remove.
12524         * object.cc (Sized_relobj::include_section_group): Update use of
12525         Kept_section.  Rename secnum to shndx.  Only record
12526         Kept_comdat_section if sections are the same size.
12527         (Sized_relobj::include_linkonce_section): Update use of
12528         Kept_section.  Only record Kept_comdat_section if sections are the
12529         same size.  Set size of linkonce section.
12530         (Sized_relobj::map_to_kept_section): Update call to
12531         get_kept_comdat_section.
12532         * object.h (class Sized_relobj): Rename fields in
12533         Kept_comdat_section to drop trailing underscores; change object
12534         field to Relobj*.  Change Kept_comdat_section_table to store
12535         struct rather than pointer.
12536         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12537         Add kept_object and kept_shndx parameters.  Change all callers.
12538         (Sized_relobj::get_kept_comdat_section): Change return type to
12539         bool.  Add kept_object and kept_shndx parameters.  Change all
12540         callers.
12541         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12542         Layout::find_or_add_kept_section.
12543
12544 2009-07-09  Ian Lance Taylor  <iant@google.com>
12545
12546         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12547         Reserve space in the hash table.
12548
12549 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12550
12551         * fileread.cc (File_read::get_mtime): New method.
12552         * fileread.h (Timespec): New structure.
12553         (File_read::get_mtime): New method.
12554         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12555         Renamed from timestamp_nsec.
12556         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12557         Elf_Xword.
12558         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12559         timestamp_nsec.
12560         (Incremental_inputs::report_archive): Save mtime; style fix.
12561         (Incremental_inputs::report_obejct): Save mtime; style fix.
12562         (Incremental_inputs::report_script): Save mtime; style fix.
12563         (Incremental_inputs::finalize_inputs): Style fix.
12564         (Incremental_inputs::finalize): Style fix.
12565         (Incremental_inputs::create_input_section_data): Store inputs
12566         mtime.
12567         * incremental.h (Incremental_inputs::report_script): Add mtime
12568         argument.
12569         (Incremental_inputs::Input_info::Input_info): Intialize only one
12570         union member.
12571         (Incremental_inputs::Input_info::archive): Move to nameless
12572         union.
12573         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12574         (Incremental_inputs::Input_info::script): Move to nameless union.
12575         (Incremental_inputs::mtime): New field.
12576         * script.cc (read_input_script): Pass file mtime to
12577         Incremental_input.
12578         * script.h (Script_info::inputs): Style fix.
12579
12580 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12581
12582         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12583         instead of 32.
12584
12585 2009-06-24  Ian Lance Taylor  <iant@google.com>
12586
12587         PR 10156
12588         * layout.cc (Layout::choose_output_section): If we find an
12589         existing section, update the flags.
12590         (Layout::create_notes): New function, broken out of
12591         Layout::finalize.
12592         (Layout::finalize): Don't create note sections.
12593         (Layout::create_note): Don't crash if linker script discards
12594         section.
12595         (Layout::create_gold_note): Likewise.
12596         (Layout::create_build_id): Likewise.  Don't set
12597         after_input_sections on the section.
12598         (Layout::create_executable_stack_info): Remove target parameter.
12599         Change caller.
12600         * layout.h (class Layout): Declare create_notes.  Update
12601         declaration of create_executable_stack_info.
12602         * gold.cc (queue_middle_tasks): Call create_notes.
12603         * output.cc (Output_section::update_flags_for_input_section): Move
12604         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12605         invalid.
12606         * output.h (Output_data::mark_address_invalid): New function.
12607         (class Output_section): Only declare, not define,
12608         update_flags_for_input_section.  Remove set_flags.
12609
12610 2009-06-24  Ian Lance Taylor  <iant@google.com>
12611
12612         * script-sections.cc (Output_section_definition::
12613         set_section_addresses): Rename shadowing local load_address to
12614         laddr.
12615
12616 2009-06-24  Ian Lance Taylor  <iant@google.com>
12617
12618         PR 10244
12619         * reloc.cc (relocate_sections): Skip empty relocation sections.
12620
12621 2009-06-23  Ian Lance Taylor  <iant@google.com>
12622
12623         PR 10156
12624         * layout.cc (Layout::create_note): Use choose_output_section
12625         rather than make_output_section.
12626
12627 2009-06-23  Ian Lance Taylor  <iant@google.com>
12628
12629         PR 10237
12630         * options.cc (General_options::parse_V): Set printed_version_.
12631         (General_options::General_options): Initialize printed_version_.
12632         * options.h (class General_options): Add printed_version_ field.
12633         * gold.cc (queue_initial_tasks): If there are no input files,
12634         don't give a fatal error if we printed the version information.
12635         (queue_middle_tasks): If using -r with a shared object, give a
12636         fatal error rather than an ordinary error.
12637
12638 2009-06-23  Ian Lance Taylor  <iant@google.com>
12639
12640         PR 10219
12641         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12642         (Layout::make_output_section): Set have_stabstr_section_ if we see
12643         a .stab*str section.
12644         (Layout::finalize): Call link_stabs_sections.
12645         (Layout::link_stabs_sections): New file.
12646         * layout.h (class Layout): Add have_stabstr_section_ field.
12647         Declare link_stabs_sections.
12648
12649 2009-06-23  Doug Kwan  <dougkwan@google.com>
12650
12651         * Makefile.am (libgold_a_LIBADD): New.
12652         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12653         * Makefile.in: Regenerate.
12654         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12655         * configure: Regenerate.
12656         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12657         * fileread.cc: Include sys/state.h
12658         * gold.h: Declare memmem and strndup if found missing.
12659         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12660
12661 2009-06-23  Ian Lance Taylor  <iant@google.com>
12662
12663         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12664         * configure: Rebuild.
12665
12666 2009-06-23  Ian Lance Taylor  <iant@google.com>
12667
12668         PR 10147
12669         * object.cc (Object::section_contents): Don't try to get a view if
12670         the section has length zero.
12671         (Object::handle_gnu_warning_section): If the section is empty, use
12672         the name of the section as the warning.
12673
12674 2009-06-23  Ian Lance Taylor  <iant@google.com>
12675
12676         PR 10133
12677         * stringpool.h (class Stringpool_template): Add optimize_ field.
12678         (Stringpool_template::set_optimize): New function.
12679         * stringpool.cc (Stringpool_template::Stringpool_template):
12680         Initialize optimize_ field.
12681         (Stringpool_template::set_string_offsets): Test local optimize
12682         fild rather than parameter.
12683         * layout.cc (Layout::Layout): Call set_optimize on the section
12684         name stringpool.
12685
12686 2009-06-22  Ian Lance Taylor  <iant@google.com>
12687
12688         PR 10030
12689         * yyscript.y: Parse TARGET.
12690         * script.cc (script_set_target): New function.
12691         * script-c.h (script_set_target): Declare.
12692         * options.cc (General_options::string_to_object_format): Rename
12693         from string_to_object_format in anonymous namespace.  Change
12694         callers.
12695         * options.h (class General_options): Declare
12696         string_to_object_format.
12697
12698 2009-06-22  Ian Lance Taylor  <iant@google.com>
12699
12700         * script-sections.cc (Script_sections::create_segments): Don't put
12701         program headers in a PT_LOAD segment if -n or -N.
12702
12703 2009-06-22  Ian Lance Taylor  <iant@google.com>
12704
12705         PR 10141
12706         * options.h (class General_options): Add -z lazy and -z now.  Sort
12707         -z options into alphabetical order.
12708         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12709
12710 2009-06-21  Ian Lance Taylor  <iant@google.com>
12711
12712         * layout.cc (Layout::make_output_section): Call
12713         Target::new_output_section.
12714         (Layout::attach_allocated_section_to_segment): Put large section
12715         sections in a separate load segment with the large segment flag
12716         set.
12717         (Layout::segment_precedes): Sort large data segments after other
12718         load segments.
12719         (align_file_offset): New static function.
12720         (Layout::set_segment_offsets): Use align_file_offset.
12721         * output.h (class Output_section): Add is_small_section_ and
12722         is_large_section_ fields.
12723         (Output_section::is_small_section): New function.
12724         (Output_section::set_is_small_section):  New function.
12725         (Output_section::is_large_section): New function.
12726         (Output_section::set_is_large_section): New function.
12727         (Output_section::is_large_data_section): New function.
12728         (class Output_segment): Add is_large_data_segment_ field.
12729         (Output_segment::is_large_data_segment): New function.
12730         (Output_segment::set_is_large_data_segment): New function.
12731         * output.cc (Output_section::Output_section): Initialize new
12732         fields.
12733         (Output_segment::Output_segment): Likewise.
12734         (Output_segment::add_output_section): Add assertion that large
12735         data sections always go in large data segments.  Force small data
12736         sections to the end of the list of data sections.  Force small BSS
12737         sections to the start of the list of BSS sections.  For large BSS
12738         sections to the end of the list of BSS sections.
12739         * symtab.h (class Symbol): Declare is_common_shndx.
12740         (Symbol::is_defined): Check Symbol::is_common_shndx.
12741         (Symbol::is_common): Likewise.
12742         (class Symbol_table): Define enum Commons_section_type.  Update
12743         declarations.  Add small_commons_ and large_commons_ fields.
12744         * symtab.cc (Symbol::is_common_shndx): New function.
12745         (Symbol_table::Symbol_table): Initialize new fields.
12746         (Symbol_table::add_from_object): Put small and large common
12747         symbols in the right list.
12748         (Symbol_table::sized_finalized_symbol): Check
12749         Symbol::is_common_shndx.
12750         (Symbol_table::sized_write_globals): Likewise.
12751         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12752         common symbol lists.  Don't call do_allocate_commons_list if the
12753         list is empty.
12754         (Symbol_table::do_allocate_commons_list): Remove is_tls
12755         parameter.  Add comons_section_type parameter.  Change all
12756         callers.  Handle small and large common symbols.
12757         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12758         Symbol::is_common_shndx.
12759         * resolve.cc (symbol_to_bits): Likewise.
12760         * target.h (Target::small_common_shndx): New function.
12761         (Target::small_common_section_flags): New function.
12762         (Target::large_common_shndx): New function.
12763         (Target::large_common_section_flags): New function.
12764         (Target::new_output_section): New function.
12765         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12766         small_common_section_flags, and large_common_section_flags
12767         fields.
12768         (Target::do_new_output_section): New virtual function.
12769         * arm.cc (Target_arm::arm_info): Initialize new fields.
12770         * i386.cc (Target_i386::i386_info): Likewise.
12771         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12772         Likewise.
12773         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12774         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12775         (Target_x86_64::do_new_output_section): New function.
12776         * configure.ac: Define conditional MCMODEL_MEDIUM.
12777         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12778         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12779         (large_LDFLAGS): Define.
12780         * testsuite/large.c: New file.
12781         * testsuite/testfile.cc (Target_test::test_target_info):
12782         Initialize new fields.
12783         * configure, testsuite/Makefile.in: Rebuild.
12784
12785 2009-06-05  Doug Kwan  <dougkwan@google.com>
12786
12787         * Makefile.am (CCFILES): Add target.cc.
12788         * Makefile.in: Regenerate.
12789         * i386.cc (class Target_i386): Define new virtual method to
12790         override do_is_local_label_name in parent.
12791         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12792         local symbols if --discard-locals or -X is given.
12793         * options.h (class General_options): Declare new options
12794         '--discard-locals' and '-X' for discarding locals.
12795         * target.h (class Target): Define new methods is_local_label_name.
12796         Declare new virtual method do_is_local_label_name.
12797         * target.cc: New file.
12798         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12799         (check_SCRIPTS): Add discard_locals_test.sh.
12800         (check_DATA): Add discard_local_tests.syms.
12801         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12802         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12803         * testsuite/Makefile.in: Regenerate.
12804         * testsuite/discard_locals_test.c: New file.
12805         * testsuite/discard_locals_test.sh: Same.
12806
12807 2009-06-05  Doug Kwan  <dougkwan@google.com>
12808
12809         * object.cc (Sized_relobj::Sized_relobj): Initialize
12810         discarded_eh_frame_shndx_ to -1U.
12811         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12812         section.
12813         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12814         a discarded .eh_frame section.
12815         (Sized_relobj::do_finalize_local_symbols): Ditto.
12816         * object.h (class Sized_relobj): Declare new member
12817         discarded_eh_frame_shndx_.
12818         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12819         (local_labels_test.o, local_labels_test): New rules.
12820         * testsuite/Makefile.in: Regenerate.
12821
12822 2009-06-04  Doug Kwan  <dougkwan@google.com>
12823
12824         * layout.cc (Layout::section_name_mapping): Add mapping for
12825         special ARM sections.
12826
12827 2009-06-03  Doug Kwan  <dougkwan@google.com>
12828
12829         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12830         (utils::has_overflow): Same.
12831
12832 2009-06-03  Ian Lance Taylor  <iant@google.com>
12833
12834         * layout.cc (Layout::section_name_mapping): New array, replacing
12835         Layout::linkonce_mapping.
12836         (Layout::section_name_mapping_count): New variable, replacing
12837         Layout::linkonce_mapping_count.
12838         (Layout::linkonce_output_name): Remove.
12839         (Layout::output_section_name): Rewrite.
12840         * layout.h (class Layout): Rename Linkonce_mapping to
12841         Section_name_mapping, linkonce_mapping to section_name_mapping,
12842         linkonce_mapping_count to section_name_mapping_count.  Don't
12843         declare linkonce_output_name.
12844
12845 2009-06-03  Doug Kwan  <dougkwan@google.com>
12846
12847         * gold/arm.cc (namespace utils): New.
12848         (Target_arm::reloc_is_non_pic): Define new method.
12849         (class Arm_relocate_functions): New.
12850         (Target_arm::Relocate::relocate): Handle relocation types used by
12851         Android.
12852
12853 2009-06-03  Ian Lance Taylor  <iant@google.com>
12854
12855         * arm.cc (Target_arm::scan::global): Use || instead of |.
12856
12857 2009-06-02  Doug Kwan  <dougkwan@google.com>
12858
12859         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12860         issued_non_pic_error_.
12861         (class Target_arm::Scan): Declare new method check_non_pic.
12862         Define new method symbol_needs_plt_entry.
12863         Declare new data member issued_non_pic_error_.
12864         (class Target_arm::Relocate): Declare new method
12865         should_apply_static_reloc.
12866         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12867         (Target_arm::Scan::check_non_pic): Define new method.
12868         (Target_arm::Scan::local): Handle a small subset of reloc types used
12869         by Android.
12870         (Target_arm::Scan::local): Same.
12871         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12872
12873 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12874
12875         * incremental.cc (Incremental_inputs::report_command_line): Filter
12876         out --incremental-* options.
12877
12878 2009-05-29  Doug Kwan  <dougkwan@google.com>
12879
12880         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12881         template class.
12882         (class Target_arm): Update comment.
12883         (Target_arm::Target_arm): Initialize new data members GOT_,
12884         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12885         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12886         and Target_arm::rel_dyn_section.
12887         Declare new_enum Target_arm::Got_type.
12888         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12889         and DYNBSS_.
12890         Update commments for member do_dynsym_value.
12891         (Target_arm::got_size, Target_arm::plt_section,
12892         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12893         new methods inside class defintion.
12894         (Target_arm::got_section): Define new method.
12895         (Target_arm::rel_dyn_section): Same.
12896         (Output_data_plt_arm): New template class.
12897         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12898         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12899         (Output_data_plt_arm::add_entry): Same.
12900         (Output_data_plt_arm::first_plt_entry): Define new
12901         static data member for PLT instruction template.
12902         (Output_data_plt_arm::plt_entry): Same.
12903         (Output_data_plt_arm::do_write): Define new method.
12904         (Target_arm::make_plt_entry): Same.
12905         (Target_arm::do_finalize_sections): Same.
12906         (Target_arm::do_dynsym_value): Same.
12907
12908 2009-05-28  Doug Kwan  <dougkwan@google.com>
12909
12910         * Makefile.am (TARGETSOURCES): Add arm.cc.
12911         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12912         * Makefile.in: Regenerate.
12913         * arm.cc: New file.
12914         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12915
12916 2009-05-26  Doug Kwan  <dougkwan@google.com>
12917
12918         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12919         (General_options::check_excluded_libs): Strip off directories in
12920         archive name before matching like GNU ld does.
12921         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12922         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12923         (exclude_libs_test_LDFLAGS): Add linker option
12924         -Wl,--exclude-libs,libexclude_libs_test_3
12925         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12926         an explicit archive without using -l.
12927         (alt/libexclude_libs_test_3.a): New make rule.
12928         * testsuite/Makefile.in: Regenerate.
12929         * testsuite/exclude_libs_test.c : Declare lib3_default().
12930         (main): Call it.
12931         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12932         * exclude_libs_test_3.c: New file.
12933
12934 2009-05-26  Nick Clifton  <nickc@redhat.com>
12935
12936         * po/id.po: New Indonesian translation.
12937         * po/gold.pot: Updated template file.
12938
12939 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12940
12941         * testsuite/Makefile.am: Add -ffunction-sections to compile
12942         gc_comdat_test files.  Add -Wl,--gc-sections to build
12943         gc_comdat_test.
12944         * testsuite/Makefile.in: Regenerate.
12945         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12946
12947 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12948
12949         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12950         kept comdat section was garbage collected.
12951         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12952         * testsuite/Makefile.in: Regenerate.
12953         * testsuite/gc_comdat_test.sh: New file.
12954         * testsuite/gc_comdat_test_1.cc: New file.
12955         * testsuite/gc_comdat_test_2.cc: New file.
12956
12957 2009-05-19  Doug Kwan  <dougkwan@google.com>
12958
12959         * archive.cc (Archive::Archive): Move constructor from archive.h
12960         to here.  Initialize no_export_.
12961         (Archive::get_elf_object_for_member): Set no_export flag of object.
12962         * archive.h (Archive::Archive): Move constructor body to
12963         archive.cc.
12964         (Archive::no_export): New method.
12965         (Archive::no_export_): New field.
12966         * object.h (Object::Object): Initialize no_export_ to false.
12967         (Object::no_export, Object::set_no_export): New methods.
12968         (Object::no_export_): New field.
12969         * options.cc (General_options::parse_exclude_libs): New method.
12970         (General_options::check_excluded_libs) Same.
12971         * options.h (exclude_libs): New option.
12972         (General_options::check_excluded_libs): New method declaration.
12973         (General_options::excluded_libs_): New field.
12974         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12975         default or protected visibility if an object has no-export flag set.
12976         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12977         (check_SCRIPTS): Add exclude_libs_test.sh.
12978         (check_DATA): Add exclude_libs_test.syms.
12979         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12980         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12981         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12982         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12983         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12984         libexclude_libs_test_2.a): New rules.
12985         * testsuite/Makefile.in: Regenerate.
12986         * testsuite/exclude_libs_test.c: New file.
12987         * testsuite/exclude_libs_test.sh: Ditto.
12988         * testsuite/exclude_libs_test_1.c: Ditto.
12989         * testsuite/exclude_libs_test_2.c: Ditto.
12990
12991 2009-05-15  Ian Lance Taylor  <iant@google.com>
12992
12993         * configure.ac: Check for declarations for cases where libiberty.h
12994         checks HAVE_DECL_xxx.
12995         * configure, config.in: Rebuild.
12996
12997 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12998
12999         * gold.h (Incremental_argument_list): Remove (invalid) forward
13000         declaration.
13001         * incremental.cc (Incremental_inputs::report_achive): New method.
13002         (Incremental_inputs::report_object): New method.
13003         (Incremental_inputs::report_script): New method.
13004         (Incremental_inputs::finalize_inputs): New method.
13005         (Incremental_inputs::finalize): Call finalize_inputs().
13006         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13007         Create inputs entries.
13008         * incremental.h (Incremental_input_type): New enum.
13009         (Incremental_inputs::Incremental_input): Initialize new fields.
13010         (Incremental_inputs::report_inputs): New method.
13011         (Incremental_inputs::report_achive): New method.
13012         (Incremental_inputs::report_object): New method.
13013         (Incremental_inputs::report_script): New method.
13014         (Incremental_inputs::finalize_inputs): New method.
13015         (Incremental_inputs::Input_info): New struct.
13016         (Incremental_inputs::Input_info_map): New typedef.
13017         (Incremental_inputs::lock_): New field.
13018         (Incremental_inputs::Inputs_): New field.
13019         (Incremental_inputs::Inputs_map): New field.
13020         * main.cc (main): Call Incremental_input::report_inputs.
13021         * options.h (Input_argument_list): Typedef moved from
13022         Input_arguments.
13023         (Input_file_group::Files): Remove, use ::Input_argument_list.
13024         (Input_file_group::Input_argument_list): Remove, use
13025         ::Input_argument_list.
13026         * plugin.cc (Plugin_manager::add_input_file): Add error in
13027         incremental build.
13028         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13029         functions.
13030         * script.cc (read_input_script): Call
13031         Incremental_input::report_script.
13032         * script.h (Script_info): New class.
13033
13034 2009-04-27  Ian Lance Taylor  <iant@google.com>
13035
13036         * x86_64.cc (do_adjust_output_section): Set entsize to
13037         plt_entry_size.
13038
13039 2009-04-23  Elliott Hughes  <enh@google.com>
13040
13041         * output.cc (Output_file::close): After short writes, continue
13042         writing from the correct offset in the buffer being written.
13043
13044 2009-04-23  Chris Demetriou  <cgd@google.com>
13045
13046         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13047         * configure: Regenerate.
13048         * config.in: Regenerate.
13049         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13050         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13051
13052 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13053
13054         * incremental.cc (Incremental_inputs_header_data): Renamed from
13055         Incremental_input_header_data.
13056         (Incremental_inputs_header_data::data_size): New field.
13057         (Incremental_inputs_header_data::put_input_file_count): Renamed
13058         from input_file_count.
13059         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13060         from command_line_offset.
13061         (Incremental_inputs_header_data::put_reserved): Renamed from
13062         put_reserved.
13063         (Incremental_inputs_entry_data): Renamed from
13064         Incremental_input_entry_data.
13065         (Incremental_inputs_entry_data::data_size): New field.
13066         (Incremental_inputs::report_command_line): New method.
13067         (Incremental_inputs::finalize): New method.
13068         (Incremental_inputs::create_incremental_inputs_data): New method.
13069         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13070         * incremental.h: New file.
13071         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13072         (Layout::finalize): Create incremental inputs section in
13073         incremental builds.
13074         (Layout::create_incremental_info_sections): New method.
13075         * layout.h (Layout::incremental_inputs): New method.
13076         (Layout::create_incremental_info_sections): New method.
13077         (Layout::incremental_inputs_): New field.
13078         * main.cc (main): Notify Incremental_input of the command line.
13079
13080 2009-04-01  Ian Lance Taylor  <iant@google.com>
13081             Mikolaj Zalewski  <mikolajz@google.com>
13082
13083         * gold.h (reserve_unordered_map): Define, three versions, one for
13084         each version of Unordered_map.
13085         * layout.cc (Layout::Layout): Remove options parameter.  Add
13086         number_of_input_files parameter.  Don't initialize options_.
13087         Initialize number_of_input_files_ and resized_signatures_.  Move
13088         sections_are_attached_.
13089         (Layout::layout_group): Reserve space for group_signatures_.
13090         (Layout::find_or_add_kept_section): Change name parameter to be a
13091         reference.  Resize signatures_ map when it gets large enough.
13092         (Layout::layout_eh_frame): Use parameters->options() instead of
13093         this->options_.
13094         (Layout::make_output_section): Likewise.
13095         (Layout::attach_allocated_section_to_segment): Likewise.
13096         (Layout::finalize, Layout::create_executable_stack): Likewise.
13097         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13098         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13099         * layout.h (class Layout): Update declarations.  Remove options_
13100         field.  Add number_of_input_files_ and resized_signatures_
13101         fields.  Move sections_are_attached_ field.
13102         * main.cc (main): Pass number of input files to Layout
13103         constructor.  Don't pass options.
13104
13105 2009-03-30  Ian Lance Taylor  <iant@google.com>
13106
13107         * ffsll.c (ffsll): Correct implementation.
13108
13109 2009-03-27  Ian Lance Taylor  <iant@google.com>
13110
13111         * ffsll.c: New file.
13112         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13113         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13114         * ftruncate.c (ftruncate): Declare before definition.
13115         * mremap.c (mremap): Likewise.
13116         * pread.c (pread): Likewise.
13117         * configure, Makefile.in, config.in: Rebuild.
13118
13119         * mremap.c: New file.
13120         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13121         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13122         (mremap): Declare if HAVE_MREMAP is not defined.
13123         * configure, Makefile.in, config.in: Rebuild.
13124
13125 2009-03-27  Cary Coutant  <ccoutant@google.com>
13126
13127         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13128         position independent.
13129         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13130         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13131
13132 2009-03-24  Cary Coutant  <ccoutant@google.com>
13133
13134         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13135         an executable.
13136         (needs_dynamic_reloc): Likewise.
13137
13138 2009-03-24  Ian Lance Taylor  <iant@google.com>
13139
13140         * yyscript.y (file_cmd): Recognize EXTERN.
13141         (extern_name_list, extern_name_list_body): New nonterminals.
13142         * script.cc (script_add_extern): Define.
13143         * script-c.h (script_add_extern): Declare.
13144
13145 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13146
13147         * object.cc (is_elf_object): Define.
13148         * object.h (is_elf_object): Declare.
13149         * archive.cc (Archive::get_elf_object_for_member): Call
13150         is_elf_object.
13151         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13152
13153 2009-03-24  Elliott Hughes  <enh@google.com>
13154
13155         * output.cc (Output_file::map_anonymous): Define.
13156         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13157         try an anonymous one.  Report the size if the mmap fails.
13158         * output.h (class Output_file): Declare map_anonymous.
13159
13160 2009-03-24  Ian Lance Taylor  <iant@google.com>
13161
13162         * target-select.cc (instantiate_target): Don't acquire the lock if
13163         the instantiated_target_ field has already been set.
13164
13165 2009-03-23  Ian Lance Taylor  <iant@google.com>
13166
13167         * gold-threads.h (class Initialize_lock): Define.
13168         * gold-threads.cc (class Initialize_lock_once): Define.
13169         (initialize_lock_control): New static variable.
13170         (initialize_lock_pointer): New static variable.
13171         (initialize_lock_once): New static function.
13172         (Initialize_lock::Initialize_lock): Define.
13173         (Initialize_lock::initialize): Define.
13174         * target-select.h: Include "gold-threads.h".
13175         (class Target_selector): Add lock_ and initialize_lock_ fields.
13176         Don't define instantiate_target, just declare it.
13177         * target-select.cc (Target_selector::Target_selector): Initialize
13178         new fields.
13179         (Target_selector::instantiate_target): Define.
13180         * descriptors.h: Include "gold-threads.h".
13181         (class Descriptors): Add initialize_lock_ field.
13182         * descriptors.cc (Descriptors::Descriptors): Initialize new
13183         field.
13184         (Descriptors::open): Use initialize_lock_ field
13185         * errors.h (class Errors): Add initialize_lock_ field.
13186         * errors.cc (Errors::Errors): Initialize new field.
13187         (Errors::initialize_lock): Use initialize_lock_ field.
13188         * powerpc.cc (class Target_selector_powerpc): Remove
13189         instantiated_target_ field.  In do_recognize call
13190         instantiate_target rather than do_instantiate_target.  In
13191         do_instantiate_target just allocate a new target.
13192         * sparc.cc (class Target_selector_sparc): Likewise.
13193
13194         * freebsd.h: New file.
13195         * i386.cc: Include "freebsd.h".
13196         (Target_i386): Derive from Target_freebsd rather than
13197         Sized_target.
13198         (Target_selector_i386): Derive from Target_selector_freebsd rather
13199         than Target_selector.
13200         * x86_64.cc: Include "freebsd.h".
13201         (Target_x86_64): Derive from Target_freebsd rather than
13202         Sized_target.
13203         (Target_selector_x86_64): Derive from Target_selector_freebsd
13204         rather than Target_selector.
13205         * target.h (class Target): Add adjust_elf_header and
13206         do_adjust_elf_header.
13207         * output.cc (Output_file_header:: do_sized_write): Call target
13208         adjust_elf_header routine.
13209         * configure.tgt: Set targ_osabi.
13210         * configure.ac: Define GOLD_DEFAULT_OSABI.
13211         * parameters.cc (Parameters::default_target): Pass
13212         GOLD_DEFAULT_OSABI to select_target.
13213         * target-select.h (class Target_selector): Make instantiate_target
13214         protected rather than private.
13215         * Makefile.am (HFILES): Add freebsd.h.
13216         * configure, Makefile.in, config.in: Rebuild.
13217
13218         * merge.cc (do_add_input_section): Correct pend value.  Change
13219         message about last entry not being null terminated from error to
13220         warning.
13221
13222 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13223
13224         * incremental.cc: New file.
13225         * Makefile.am (CCFILES): Add incremental.cc.
13226         * Makefile.in: Rebuild.
13227
13228 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13229
13230         * layout.cc (Layout::output_section_name): Preserve names
13231         of '.note.' sections.
13232
13233 2009-03-19  Ian Lance Taylor  <iant@google.com>
13234
13235         * descriptors.cc (Descriptors::open): Check that the options are
13236         valid before using them.
13237
13238 2009-03-18  Ian Lance Taylor  <iant@google.com>
13239
13240         * script-sections.h: Include <list>.
13241         (class Script_sections): Change Sections_elements from std::vector
13242         to std::list.  Typedef public Elements_iterator.  Add
13243         orphan_section_placement_, data_segment_align_start_, and
13244         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13245         field.
13246         * script-sections.cc (class Orphan_section_placement): New class.
13247         (class Sections_element): Add virtual functions is_relro and
13248         orphan_section_init.  Remove virtual function place_orphan_here.
13249         (class Output_section_definition): Add is_relro and
13250         orphan_section_init.  Remove place_orphan_here.
13251         (class Orphan_output_section): Likewise.
13252         (Script_sections::Script_sections): Update for field changes.
13253         (Script_sections::data_segment_align): Set saw_data_segment_align_
13254         and data_segment_align_start_, not data_segment_align_index.
13255         (Script_sections::data_segment_relro_end): Check
13256         saw_data_segment_align_.  Use data_segment_align_start_ rather
13257         than data_segment_align_index_.
13258         (Script_sections::place_orphan): Rewrite to use
13259         Orphan_section_placement.
13260
13261 2009-03-17  Ian Lance Taylor  <iant@google.com>
13262
13263         * archive.cc (Archive::add_symbols): Check for a version attached
13264         to the symbol name in the archive map.
13265         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13266         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13267         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13268         (ver_test_11.a): New target.
13269         * testsuite/Makefile.in: Rebuild.
13270
13271         * configure.ac: Check for chsize and posix_fallocate.  Replace
13272         ftruncate.
13273         * ftruncate.c: New file, from gnulib.
13274         * output.cc (posix_fallocate): Define dummy version if not
13275         HAVE_POSIX_FALLOCATE.
13276         (Output_file::map): Call posix_fallocate rather than lseek and
13277         write.
13278         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13279         * configure, Makefile.in, config.in: Rebuild.
13280
13281 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13282
13283         * layout.h (Layout::create_note): Add section_name parameter.
13284         * layout.cc (Layout::create_note): Likewise.
13285         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13286
13287 2009-03-17  Ian Lance Taylor  <iant@google.com>
13288
13289         * descriptors.cc: Include "options.h".
13290         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13291         (Descriptors::open): Always use O_CLOEXEC when opening a new
13292         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13293         then set FD_CLOEXEC.
13294
13295         * sparc.cc (class Target_sparc): Add has_got_section.
13296         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13297         make sure we have a GOT section.
13298
13299         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13300         (Target_sparc::Scan::local): Likewise.
13301         (Target_sparc::Scan::global): Likewise.
13302         (Target_sparc::Relocate::relocate): Likewise.
13303         (Target_sparc::Relocate::relocate_tls): Likewise.
13304
13305         * symtab.cc (Symbol_table::define_default_version): New function,
13306         broken out of add_from_object.
13307         (Symbol_table::add_from_object): Call define_default_version.
13308         (Symbol_table::define_special_symbol): Add resolve_oldsym
13309         parameter.  Change all callers.  If the version for a symbol comes
13310         from a version script, resolve it with the symbol with the same
13311         name with no version.  Also add the symbol without a version if
13312         appropriate.
13313         (do_define_in_output_data): If resolving with oldsym, don't delete
13314         sym.
13315         (do_define_in_output_segment): Likewise.
13316         (do_define_as_constant): Likewise.
13317         * symtab.h (class Symbol_table): Update declarations.
13318
13319 2009-03-13  Ian Lance Taylor  <iant@google.com>
13320
13321         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13322         (Read_symbols::requeue): New function.
13323         (Read_symbols::do_read_symbols): If make_elf_object fails because
13324         the target type is not configured, and the file was searched for,
13325         issue a warning and retry with the next directory.
13326         (Add_symbols::run): If the file has an incompatible format, and
13327         it was searched for, requeue the Read_symbols task.  On error,
13328         release the object.
13329         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13330         dirindex parameter to constructor.  Change all callers.  Declare
13331         incompatible_warning and requeue.
13332         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13333         input_argument_ and input_group_ fields.  Add them to
13334         constructor.  Change all callers.
13335         (class Read_script): Add dirindex_ field.  Add it to constructor.
13336         Change all callers.
13337         * archive.cc (Archive::setup): Remove input_objects parameter.
13338         Change all callers.
13339         (Archive::get_file_and_offset): Likewise.
13340         (Archive::read_all_symbols): Likewise.
13341         (Archive::read_symbols): Likewise.
13342         (Archive::get_elf_object_for_member): Remove input_objects
13343         parameter.  Add punconfigured parameter.  Change all callers.
13344         (Archive::add_symbols): Change return type to bool.  Check return
13345         value of include_member.
13346         (Archive::include_all_members): Likewise.
13347         (Archive::include_member): Change return type to bool.  Return
13348         false if first included object has incompatible target.  Set
13349         included_member_ field.
13350         (Add_archive_symbols::run): If add_symbols returns false, requeue
13351         Read_symbols task.
13352         * archive.h (class Archive): Add included_member_ field.
13353         Initialize it in constructor.  Add input_file and searched_for
13354         methods.  Update declarations.
13355         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13356         input_argument_ fields.  Add them to constructor.  Change all
13357         callers.
13358         * script.cc: Include "target-select.h".
13359         (class Parser_closure): Add skip_on_incompatible_target_ and
13360         found_incompatible_target_ fields.  Add
13361         skip_on_incompatible_target parameter to constructor.  Change all
13362         callers.  Add methods skip_on_incompatible_target,
13363         clear_skip_on_incompatible_target, found_incompatible_target, and
13364         set_found_incompatible_target.
13365         (read_input_script): Add dirindex parameter.  Change all callers.
13366         If parser finds an incompatible target, requeue Read_symbols
13367         task.
13368         (script_set_symbol): Clear skip_on_incompatible_target in
13369         closure.
13370         (script_add_assertion, script_parse_option): Likewise.
13371         (script_start_sections, script_add_phdr): Likewise.
13372         (script_check_output_format): New function.
13373         * script.h (read_input_script): Update declaration.
13374         * script-c.h (script_check_output_format): Declare.
13375         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13376         (ignore_cmd): Remove OUTPUT_FORMAT.
13377         * fileread.cc (Input_file::Input_file): Add explicit this.
13378         (Input_file::will_search_for): New function.
13379         (Input_file::open): Add pindex parameter.  Change all callers.
13380         * fileread.h (class Input_file): Add input_file_argument method.
13381         Declare will_search_for.  Update declarations.
13382         * object.cc (make_elf_object): Add punconfigured parameter.
13383         Change all callers.
13384         * object.h (class Object): Make input_file public.  Add
13385         searched_for method.
13386         (make_elf_object): Update declaration.
13387         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13388         restart search.
13389         * dirsearch.h (class Dirsearch): Update declaration.
13390         * options.h (class General_options): Add --warn-search-mismatch.
13391         * parameters.cc (Parameters::is_compatible_target): New function.
13392         * parameters.h (class Parameters): Declare is_compatible_target.
13393         * workqueue.cc (Workqueue::add_blocker): New function.
13394         * workqueue.h (class Workqueue): Declare add_blocker.
13395
13396         * fileread.cc (Input_file::open): Remove options parameter.
13397         Change all callers.
13398         (Input_file::open_binary): Likewise.
13399         * script.cc (read_input_script): Likewise.
13400         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13401         options parameter from constructor.  Change all callers.
13402         (class Read_script): Likewise.
13403         * fileread.h (class Input_file): Update declarations.
13404         * script.h (read_input_script): Update declaration.
13405
13406 2009-03-10  Nick Clifton  <nickc@redhat.com>
13407
13408         * po/es.po: New Spanish translation.
13409
13410 2009-03-06  Cary Coutant  <ccoutant@google.com>
13411
13412         * options.cc (parse_short_option): Keep dash_z from registering itself.
13413
13414 2009-03-03  Ian Lance Taylor  <iant@google.com>
13415
13416         PR 9918
13417         * target-reloc.h (relocate_section): Pass output_section to
13418         relocate.
13419         * i386.cc (Target_i386::should_apply_static_reloc): Add
13420         output_section parameter.  Change all callers.
13421         (Target_i386::Relocate::relocate): Add output_section parameter.
13422         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13423         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13424         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13425         * testsuite/two_file_shared.sh: New script.
13426         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13427         (check_DATA): Add two_file_shared.dbg.
13428         (two_file_shared.dbg): New target.
13429         * testsuite/Makefile.in: Rebuild.
13430
13431 2009-03-01  Ian Lance Taylor  <iant@google.com>
13432
13433         * configure.ac: Check for byteswap.h.
13434         * configure: Rebuild.
13435         * config.in: Rebuild.
13436
13437 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13438
13439         * layout.cc (Layout::find_or_add_kept_section): New function.
13440         (Layout::add_comdat): Removed.
13441         * layout.h (struct Kept_section): Move out of class Layout.
13442         Remove trailing underscores from field names.  Add group_sections
13443         field.  Rename group_ field to is_group.  Change all uses.
13444         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13445         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13446         comdat_groups_ field.
13447         (Sized_relobj::include_section_group): Use
13448         find_or_add_kept_section and Kept_section::group_sections.
13449         (Sized_relobj::include_linkonce_section): Likewise.
13450         * object.cc (class Sized_relobj): Don't define Comdat_group or
13451         Comdat_group_table.  Remove find_comdat_group and
13452         add_comdat_group.  Remove comdat_groups_ field.
13453         * plugin.cc (include_comdat_group): Use
13454         Layout::find_or_add_kept_section.
13455
13456 2009-02-28  Ian Lance Taylor  <iant@google.com>
13457
13458         * README: --gc-sections and map files are now supported.  Document
13459         some build requirements.
13460
13461         PR 6992
13462         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13463         relocatable link set the value of the section symbol to zero.
13464         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13465         relocatable link don't include the section address in the local
13466         symbol value.
13467
13468 2009-02-27  Ian Lance Taylor  <iant@google.com>
13469
13470         PR 6811
13471         * options.h (class Search_directory): Add is_system_directory.
13472         (class General_options): Declare is_in_system_directory.
13473         * options.cc (get_relative_sysroot): Make static.
13474         (get_default_sysroot): Make static.
13475         (General_optoins::is_in_system_directory): New function.
13476         * fileread.cc (Input_file::is_in_system_directory): New function.
13477         * fileread.h (class Input_file): Declare is_in_system_directory.
13478         * object.h (class Object): Add is_in_system_directory.
13479         (class Input_objects): Remove system_library_directory_ field.
13480         * object.cc (Input_objects::add_object): Don't set
13481         system_library_directory_.
13482         (input_objects::found_in_system_library_directory): Remove.
13483         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13484         parameter.  Change all callers.
13485         (Symbol_table::sized_write_globals): Likewise.
13486         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13487         Call Object::is_in_system_directory.
13488         * symtab.h (class Symbol_table): Update declarations.
13489
13490         PR 5990
13491         * descriptors.h (Open_descriptor): Add is_on_stack field.
13492         * descriptors.cc (Descriptors::open): If the descriptor is on the
13493         top of the stack, remove it.  Initialize is_on_stack field.
13494         (Descriptors::release): Only add pod to stack if it is not on the
13495         stack already.
13496         (Descriptors::close_some_descriptor): Clear stack_next and
13497         is_on_stack fields.
13498
13499         PR 7091
13500         * output.cc (Output_section::find_starting_output_address): Rename
13501         from starting_output_address; add PADDR parameter; change return
13502         type.
13503         * output.h (class Output_section): Declare
13504         find_starting_output_address instead of starting_output_address.
13505         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13506         section symbol for which we can't find a merge section.
13507
13508         PR 9836
13509         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13510         hidden or internal, force the symbol to be local.
13511         * resolve.cc (Symbol::override_visibility): Define.
13512         (Symbol::override_base): Use override_visibility.
13513         (Symbol_table::resolve): Likewise.
13514         (Symbol::override_base_with_special): Likewise.
13515         (Symbol_table::override_with_special): If the visibility is hidden
13516         or internal, force the symbol to be local.
13517         * symtab.h (class Symbol): Add set_visibility and
13518         override_visibility.
13519         * testsuite/ver_test_1.sh: New file.
13520         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13521         (check_DATA): Add ver_test_1.syms.
13522         (ver_test_1.syms): New target.
13523         * testsuite/Makefile.in: Rebuild.
13524
13525 2009-02-25  Cary Coutant  <ccoutant@google.com>
13526
13527         * layout.cc (Layout::choose_output_section): Don't rename sections
13528         when using a linker script that has a SECTIONS clause.
13529         * Makefile.in: Regenerate.
13530
13531         * testsuite/Makefile.am (script_test_5.sh): New test case.
13532         * testsuite/Makefile.in: Regenerate.
13533         * testsuite/script_test_5.cc: New file.
13534         * testsuite/script_test_5.sh: New file.
13535         * testsuite/script_test_5.t: New file.
13536
13537 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13538
13539         * archive.cc (Archive::include_member): Update calls to add_symbols.
13540         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13541         the Layout argument.
13542         * dynobj.h (do_add_symbols): Add the Layout argument.
13543         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13544         Layout argument.
13545         * object.h (Object::add_symbols): Add the Layout argument.
13546         (Object::do_add_symbols): Add the Layout argument.
13547         (Sized_relobj::do_add_symbols): Add the Layout argument.
13548         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13549         Unify the two versions.
13550         (Add_plugin_symbols): Remove.
13551         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13552         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13553         (Add_plugin_symbols): Remove.
13554         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13555         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13556         (Add_symbols::run): Make it work with Pulginobj.
13557
13558 2009-02-06  Ian Lance Taylor  <iant@google.com>
13559
13560         * object.cc (Sized_relobj::do_layout): Make info message start
13561         with lower case letter.
13562
13563 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13564
13565         * binary.cc: Fix file comment.
13566
13567         * options.h (enum Incremental_disposition): Define.
13568         (class General_options): Add new options: --incremental,
13569         --incremental_changed, --incremental_unchanged,
13570         --incremental_unknown.  Add incremental_disposition_ and
13571         implicit_incremental_ fields.
13572         (General_options::incremental_disposition): New function.
13573         (class Position_dependent_options): Add incremental_disposition
13574         option.
13575         (Position_dependent_options::copy_from_options): Set incremental
13576         dispositions.
13577         * options.cc (General_options::parse_incremental_changed): New
13578         function.
13579         (General_options::parse_incremental_unchanged): New function.
13580         (General_options::parse_incremental_unknown): New function.
13581         (General_options::General_options): Initialize new fields
13582         incremental_disposition_ and implicit_incremental_.
13583         (General_options::finalize): Check for uasge of --incremental-*
13584         without --incremental.
13585
13586 2009-02-06  Chris Demetriou  <cgd@google.com>
13587
13588         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13589         pointer and to report location as the file name associated with
13590         the symbol.
13591         (gold_undefined_symbol_at_location): New function to replace the
13592         old gold_undefined_symbol functionality.
13593         * target-reloc.h (relocate_section): Update to use
13594         gold_undefined_symbol_at_location.
13595         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13596         Call gold_undefined_symbol function rather than gold_error.
13597         * errors.h (Errors::undefined_symbol): Take location as a
13598         string, rather than calculating it from a relocation.
13599         * errors.cc (Errors::fatal): Print "fatal error:" before the
13600         formatted message.
13601         (Errors::error, Errors::error_at_location): Print "error: "
13602         before the formatted message.
13603         (Errors::undefined_symbol): Take location as a string, rather
13604         than calculating it from a relocation.
13605         (gold_undefined_symbol_at_location): New function akin to
13606         old gold_undefined_symbol, calculates location from relocation.
13607         (gold_undefined_symbol): Change to take only a Symbol pointer
13608         and to report location as the file name associated with the symbol.
13609         * testsuite/debug_msg.sh: Update for changed error messages.
13610         * testsuite/undef_symbol.sh: Likewise.
13611
13612 2009-02-04  Duncan Sands  <baldrick@free.fr>
13613
13614         PR 9812
13615         * reduced_debug_output.h
13616         (Output_reduced_debug_abbrev_section::failed): Use format for
13617         gold_warning.
13618         (Output_reduced_debug_info_section::faild): Likewise.
13619
13620 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13621
13622         * script.cc (Lazy_demangler): New class.
13623         (Version_script_info::get_symbol_version_helper): Demangle a
13624         symbol only once.
13625
13626 2009-01-29  Cary Coutant  <ccoutant@google.com>
13627
13628         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13629         to __tls_get_addr.
13630         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13631
13632 2009-01-28  Ian Lance Taylor  <iant@google.com>
13633
13634         * version.cc (version_string): Bump to 1.9.
13635
13636         * gold.h: Include <cstring> and <stdint.h>.
13637         * version.cc: Include <cstdio>.
13638         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13639         warning.
13640         * reduced_debug_output.cc (insert_into_vector): Rename from
13641         Insert_into_vector; change all callers.  Use Swap_unaligned to
13642         avoid aliasing issue; remove union since it is unnecessary.
13643
13644 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13645
13646         * Makefile.am (CCFILES): Add gc.cc.
13647         (HFILES): Add gc.h.
13648         * Makefile.in: Regenerate.
13649         * gold.cc (Gc_runner): New class.
13650         (queue_initial_tasks): Call garbage collection related tasks
13651         when corresponding options are invoked.
13652         (queue_middle_gc_tasks): New function.
13653         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13654         processed early before laying out sections during garbage collection.
13655         * gold.h (queue_middle_gc_tasks): New function.
13656         (is_prefix_of): Move from "layout.cc".
13657         * i386.cc (Target_i386::gc_process_relocs): New function.
13658         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13659         * main.cc (main): Create object of class "Garbage_collection".
13660         * object.cc (Relobj::copy_symbols_data): New function.
13661         (Relobj::is_section_name_included): New function.
13662         (Sized_relobj::do_layout): Allow this function to be called twice
13663         during garbage collection and defer layout of section during the
13664         first call.
13665         * object.h (Relobj::get_symbols_data): New function.
13666         (Relobj::is_section_name_included): New function.
13667         (Relobj::copy_symbols_data): New function.
13668         (Relobj::set_symbols_data): New function.
13669         (Relobj::get_relocs_data): New function.
13670         (Relobj::set_relocs_data): New function.
13671         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13672         (Relobj::gc_process_relocs): New function.
13673         (Relobj::do_gc_process_relocs): New pure virtual function.
13674         (Relobj::sd_): New data member.
13675         (Sized_relobj::is_output_section_offset_invalid): New function.
13676         (Sized_relobj::do_gc_process_relocs): New function.
13677         * options.h (General_options::gc_sections): Modify to not be a no-op.
13678         (General_options::print_gc_sections): New option.
13679         * plugin.cc (Plugin_finish::run): Remove function call to
13680         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13681         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13682         * reloc.cc (Read_relocs::run): Add task to process relocs and
13683         determine unreferenced sections when doing garbage collection.
13684         (Gc_process_relocs): New class.
13685         (Sized_relobj::do_gc_process_relocs): New function.
13686         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13687         sections that are garbage collected.
13688         * reloc.h (Gc_process_relocs): New class.
13689         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13690         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13691         symbols whose corresponding sections are garbage collected.
13692         (Symbol_table::Symbol_table): Add new parameter for the garbage
13693         collection object.
13694         (Symbol_table::gc_mark_undef_symbols): New function.
13695         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13696         (Symbol_table::gc_mark_dyn_syms): New function.
13697         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13698         as garbage.
13699         (Symbol_table::add_from_object): Likewise.
13700         (Symbol_table::add_from_relobj): When building shared objects, do not
13701         treat externally visible symbols as garbage.
13702         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13703         table information for static and relocatable links.
13704         * symtab.h (Symbol_table::set_gc): New function.
13705         (Symbol_table::gc): New function.
13706         (Symbol_table::gc_mark_undef_symbols): New function.
13707         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13708         (Symbol_table::gc_mark_dyn_syms): New function.
13709         (Symbol_table::gc_): New data member.
13710         * target.h (Sized_target::gc_process_relocs): New pure virtual
13711         function.
13712         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13713         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13714
13715 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13716
13717         * options.h (General_options::gc_sections): Define as a no-op for now.
13718         (General_options::no_keep_memory): Ditto.
13719         (General_options::Bshareable): Define.
13720         * options.cc (General_options::finalize): Honor -Bshareable.
13721
13722 2009-01-20  Andreas Schwab  <schwab@suse.de>
13723
13724         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13725         read the value in the contents, since we don't use it.  Use the
13726         template endianness when writing.
13727         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13728
13729 2009-01-19  Andreas Schwab  <schwab@suse.de>
13730
13731         * configure.tgt (powerpc64-*): Fix targ_obj.
13732
13733 2009-01-15  Ian Lance Taylor  <iant@google.com>
13734
13735         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13736         local symbols when stripping all symbols.
13737
13738 2009-01-14  Cary Coutant  <ccoutant@google.com>
13739
13740         * output.cc (Output_reloc): Add explicit instantiations.
13741
13742 2009-01-14  Cary Coutant  <ccoutant@google.com>
13743
13744         * archive.cc (Archive::get_elf_object_for_member): Remove call
13745         to File_read::claim_for_plugin.
13746         * descriptors.cc (Descriptors::open): Remove reference to
13747         is_claimed.
13748         (Descriptors::claim_for_plugin): Remove.
13749         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13750         (Descriptors::is_claimed): Remove.
13751         (claim_descriptor_for_plugin): Remove.
13752         * fileread.cc (File_read::claim_for_plugin): Remove.
13753         * fileread.h (File_read::claim_for_plugin): Remove.
13754         (File_read::descriptor): Reopen descriptor if necessary.
13755         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13756         (Plugin_manager::all_symbols_read): Add task parameter. Change
13757         all callers.
13758         (Plugin_manager::get_input_file): New function.
13759         (Plugin_manager::release_input_file): New function.
13760         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13761         corresponding data member.
13762         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13763         and pass to base constructor. Change all callers.
13764         (get_input_file, release_input_file): New functions.
13765         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13766         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13767         (Plugin_manager::all_symbols_read): Add task parameter.
13768         (Plugin_manager::get_input_file): New function.
13769         (Plugin_manager::release_input_file): New function.
13770         (Plugin_manager::task_): New data member.
13771         (Pluginobj::Pluginobj): Add filesize parameter.
13772         (Pluginobj::filename): New function.
13773         (Pluginobj::descriptor): New function.
13774         (Pluginobj::filesize): New function.
13775         (Pluginobj::filesize_): New data member.
13776         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13777         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13778         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13779
13780         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13781         with archive libraries.
13782         * testsuite/Makefile.in: Regenerate.
13783         * testsuite/plugin_test.c (struct sym_info): New type.
13784         (get_input_file, release_input_file): New static variables.
13785         (onload): Capture new transfer vector entries.
13786         (claim_file_hook): Stop reading at end of file according to filesize.
13787         Factor out parsing of readelf output into separate function.
13788         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13789         APIs and get the source file name from the symbol table.  Convert
13790         source file name to corresponding object file name.  Print info
13791         message when adding new input files.
13792         (parse_readelf_line): New function.
13793         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13794         * testsuite/plugin_test_2.sh: Likewise.
13795         * testsuite/plugin_test_3.sh: Likewise.
13796         * testsuite/plugin_test_4.sh: New test case.
13797
13798 2009-01-07  Ian Lance Taylor  <iant@google.com>
13799
13800         * version.cc (version_string): Bump to 1.8.
13801
13802 2008-12-23  Cary Coutant  <ccoutant@google.com>
13803
13804         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13805         * plugin.cc (Plugin_manager::finish): Rename as
13806         layout_deferred_objects.  Move cleanup to separate function.
13807         (Plugin_manager::cleanup): New function.
13808         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13809         separately.
13810         * plugin.h (Plugin_manager::finish): Rename as
13811         layout_deferred_objects.
13812         (Plugin_manager::cleanup): New function.
13813         (Plugin_manager::cleanup_done): New field.
13814
13815 2008-12-23  Cary Coutant  <ccoutant@google.com>
13816
13817         * plugin.cc (is_visible_from_outside): New function.
13818         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13819         so we don't return "IR only" status for exported symbols or -r links.
13820
13821         * testsuite/Makefile.am (plugin_test_3): New test case.
13822         * testsuite/Makefile.in: Regenerate.
13823         * testsuite/plugin_test_3.sh: New file.
13824
13825 2008-12-22  Cary Coutant  <ccoutant@google.com>
13826
13827         * object.cc (Sized_relobj::layout_section): New function.
13828         (Sized_relobj::do_layout): Defer layout of input sections until after
13829         plugin has provided replacement files.
13830         (Sized_relobj::do_layout_deferred_sections): New function.
13831         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13832         (Relobj::layout_deferred_sections): New function.
13833         (Relobj::do_layout_deferred_sections): New function.
13834         (Sized_relobj::do_layout_deferred_sections): New function.
13835         (Sized_relobj::layout_section): New function.
13836         (Sized_relobj::Deferred_layout): New structure.
13837         (Sized_relobj::deferred_layout_): New field.
13838         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13839         Change all callers.  Layout deferred sections.
13840         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13841         references.
13842         (Plugin_hook::run): Move code from do_plugin_hook inline.
13843         (Plugin_hook::do_plugin_hook): Remove.
13844         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13845         (Plugin_manager::finish): Renamed, was cleanup.
13846         (Plugin_manager::should_defer_layout): New function.
13847         (Plugin_manager::add_deferred_layout_object): New function.
13848         (Plugin_manager::Deferred_layout_list): New type.
13849         (Plugin_manager::deferred_layout_objects_): New field.
13850         (Plugin_hook::do_plugin_hook): Remove.
13851
13852 2008-12-17  Ian Lance Taylor  <iant@google.com>
13853
13854         * options.h (class General_options): Add --no case for
13855         --export-dynamic.
13856
13857 2008-12-16  Cary Coutant  <ccoutant@google.com>
13858
13859         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13860         vector.
13861         (Plugin_manager::claim_file): Create plugin object even if
13862         plugin did not call the add_symbols callback.
13863         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13864         asking for more symbols than were added.
13865         * testsuite/Makefile.am (plugin_test_1): Add test case with
13866         no global symbols.
13867         (empty.syms): New target.
13868         * testsuite/Makefile.in: Regenerate.
13869         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13870         message. Don't call add_symbols if no globals.
13871         (all_symbols_read_hook): Don't provide replacement for empty
13872         claimed file.
13873
13874 2008-12-12  Ian Lance Taylor  <iant@google.com>
13875
13876         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13877         r_type == 0 for a local symbol with r_sym == 0.
13878         (scan_relocatable_relocs): Pass r_sym to
13879         local_non_section_strategy.
13880         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13881         r_sym parameter.
13882
13883         * configure.ac: Update test for TLS descriptors: they are
13884         supported as of glibc 2.9.
13885         * configure: Rebuild.
13886
13887 2008-12-11  Ian Lance Taylor  <iant@google.com>
13888
13889         PR 7091
13890         * target-reloc.h (Default_scan_relocatable_relocs): For each
13891         function, map r_type == 0 to RELOC_DISCARD.
13892
13893 2008-12-10  Cary Coutant  <ccoutant@google.com>
13894
13895         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13896         object to override a kept COMDAT group from a plugin object.
13897
13898 2008-12-09  Ian Lance Taylor  <iant@google.com>
13899
13900         PR 7088
13901         * yyscript.y (file_cmd): Handle INPUT.
13902
13903         * testsuite/initpri1.c: Change all declarations to be full
13904         prototypes by adding void, to avoid compiler warnings.
13905
13906 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13907
13908         * options.cc (General_options::parse_plugin_opt): New.
13909         (General_options::add_plugin): The argument now is just the filename.
13910         (General_options::add_plugin_option): New.
13911         * options.h (plugin_opt): New.
13912         (add_plugin): Change argument name.
13913         (add_plugin_option): New.
13914         * plugin.cc (Plugin::load): Don't parse the plugin option.
13915         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13916         (Plugin::add_option): New.
13917         (Plugin::args_): Change type.
13918         (Plugin::filename_): New.
13919         (Plugin_manager::add_plugin_option): New.
13920         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13921         * testsuite/Makefile.in: Regenerate.
13922
13923 2008-12-05  Cary Coutant  <ccoutant@google.com>
13924
13925         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13926         Handle --strip-lto-sections option.
13927         * options.h (strip_lto_sections): New option.
13928
13929 2008-12-01  Cary Coutant  <ccoutant@google.com>
13930
13931         * plugin.cc (ld_plugin_message): Change format parameter to const.
13932         Fix mismatch between new[] and delete.
13933
13934 2008-11-14  Cary Coutant  <ccoutant@google.com>
13935
13936         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13937         instead of -1U.
13938
13939 2008-11-05  Craig Silverstein  <csilvers@google.com>
13940
13941         * options.cc (General_options::parse_dynamic_list): New function.
13942         * options.h (General_options): New flags dynamic_list,
13943         dynamic_list_data, dynamic_list_cpp_new, and
13944         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13945         (General_options::in_dynamic_list): New function.
13946         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13947         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13948         (Lex::can_continue_name): Likewise.
13949         (yylex): Likewise.
13950         (read_script_file): New parameter script_options.
13951         (read_dynamic_list): New function.
13952         (Script_options::define_dynamic_list): New function.
13953         (dynamic_list_keyword_parsecodes): New variable.
13954         (dynamic_list_keywords): New variable.
13955         * script.h (Script_options::define_dynamic_list): New function
13956         prototype.
13957         (read_dynamic_list): New function prototype.
13958         * symtab.cc (strprefix): New macro.
13959         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13960         dynamic_list_data, dynamic_list_cpp_new, and
13961         dynamic_list_cpp_typeinfo.
13962         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13963         (dynamic_list_expr): New rule.
13964         (dynamic_list_nodes): Likewise.
13965         (dynamic_list_node): Likewise.
13966         * testsuite/Makefile.am (dynamic_list): New test.
13967         * testsuite/Makefile.in: Regenerated.
13968         * testsuite/dynamic_list.t: New file.
13969         * testsuite/dynamic_list.sh: New file.
13970
13971 2008-11-05  Craig Silverstein  <csilvers@google.com>
13972
13973         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13974         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13975         (t11_last): Likewise.
13976         * testsuite/ver_test_6.c (main): Likewise.
13977
13978 2008-10-07  Cary Coutant  <ccoutant@google.com>
13979
13980         * options.c (General_options::finalize): Add check for -static and
13981         -shared.
13982         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13983         is not empty.
13984
13985 2008-10-02  Cary Coutant  <ccoutant@google.com>
13986
13987         * plugin.cc (make_sized_plugin_object): Fix conditional
13988         compilation to work when not all targets are enabled.
13989
13990 2008-09-29  Cary Coutant  <ccoutant@google.com>
13991
13992         * archive.cc (Archive::get_file_and_offset): Use filename instead
13993         of name to get library path.
13994         (Archive::include_member): Unlock external member of a thin archive.
13995
13996         * testsuite/Makefile.am (TEST_AR): New variable.
13997         (thin_archive_test_1): New test.
13998         (thin_archive_test_2): New test.
13999         * testsuite/Makefile.in: Regenerate.
14000         * testsuite/thin_archive_main.cc: New file.
14001         * testsuite/thin_archive_test_1.cc: New file.
14002         * testsuite/thin_archive_test_2.cc: New file.
14003         * testsuite/thin_archive_test_3.cc: New file.
14004         * testsuite/thin_archive_test_4.cc: New file.
14005
14006 2008-09-29  Cary Coutant  <ccoutant@google.com>
14007
14008         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14009         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14010         instead of -1U.
14011         (Sized_relobj::do_finalize_local_symbols): Likewise.
14012         (Sized_relobj::map_to_kept_section): Likewise.
14013         * object.h (Sized_relobj::invalid_address): New constant.
14014         (Sized_relobj::do_output_section_offset): Check for invalid_address
14015         and return -1ULL.
14016         * output.cc (Output_reloc::local_section_offset): Use constant
14017         invalid_address instead of -1U.
14018         (Output_reloc::get_address): Likewise.
14019         (Output_section::output_address): Change -1U to -1ULL.
14020         * output.h (Output_reloc::invalid_address): New constant.
14021         * reloc.cc (Sized_relobj::write_sections): Use constant
14022         invalid_address instead of -1U.
14023         (Sized_relobj::relocate_sections): Likewise.
14024         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14025         values for merge sections.
14026         * target-reloc.h (relocate_for_relocatable): Use constant
14027         invalid_address instead of -1U.
14028
14029 2008-09-19  Cary Coutant  <ccoutant@google.com>
14030
14031         Add plugin functionality for link-time optimization (LTO).
14032         * configure.ac (plugins): Add --enable-plugins option.
14033         * configure: Regenerate.
14034         * config.in: Regenerate.
14035         * Makefile.am (LIBDL): New variable.
14036         (CCFILES): Add plugin.cc.
14037         (HFILES): Add plugin.h.
14038         (ldadd_var): Add LIBDL.
14039         * Makefile.in: Regenerate.
14040
14041         * archive.cc: Include "plugin.h".
14042         (Archive::setup): Don't preread archive symbols when using a plugin.
14043         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14044         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14045         files.
14046         (Archive::include_member): Add symbols from plugin objects.
14047         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14048         * descriptors.cc (Descriptors::open): Check for file descriptors
14049         abandoned by plugins.
14050         (Descriptors::claim_for_plugin): New function.
14051         * descriptors.h (Descriptors::claim_for_plugin): New function.
14052         (Open_descriptor::is_claimed): New field.
14053         (claim_descriptor_for_plugin): New function.
14054         * fileread.cc (File_read::claim_for_plugin): New function.
14055         * fileread.h (File_read::claim_for_plugin): New function.
14056         (File_read::descriptor): New function.
14057         * gold.cc: Include "plugin.h".
14058         (queue_initial_tasks): Add task to call plugin hooks for generating
14059         new object files.
14060         * main.cc: Include "plugin.h".
14061         (main): Load plugin libraries.
14062         * object.h (Pluginobj): Declare.
14063         (Object::pluginobj): New function.
14064         (Object::do_pluginobj): New function.
14065         (Object::set_target): New function.
14066         * options.cc: Include "plugin.h".
14067         (General_options::parse_plugin): New function.
14068         (General_options::General_options): Initialize plugins_ field.
14069         (General_options::add_plugin): New function.
14070         * options.h (Plugin_manager): Declare.
14071         (General_options): Add --plugin option.
14072         (General_options::has_plugins): New function.
14073         (General_options::plugins): New function.
14074         (General_options::add_plugin): New function.
14075         (General_options::plugins_): New field.
14076         * plugin.cc: New file.
14077         * plugin.h: New file.
14078         * readsyms.cc: Include "plugin.h".
14079         (Read_symbols::do_read_symbols): Check for archive before checking
14080         for ELF file.  Call plugin hooks to claim files.
14081         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14082         from a real object file; force override when processing replacement
14083         files.
14084         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14085         (Symbol::init_base_object): Likewise.
14086         (Symbol::init_base_output_data): Likewise.
14087         (Symbol::init_base_output_segment): Likewise.
14088         (Symbol::init_base_constant): Likewise.
14089         (Symbol::init_base_undefined): Likewise.
14090         (Symbol::output_section): Assert that object is not a plugin.
14091         (Symbol_table::add_from_pluginobj): New function.
14092         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14093         undefined.
14094         (Symbol_table::sized_write_globals): Likewise.
14095         (Symbol_table::add_from_pluginobj): Instantiate template.
14096         * symtab.h (Sized_pluginobj): Declare.
14097         (Symbol::in_real_elf): New function.
14098         (Symbol::set_in_real_elf): New function.
14099         (Symbol::in_real_elf_): New field.
14100         (Symbol_table::add_from_pluginobj): New function.
14101
14102         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14103         (LIBDL): New variable.
14104         (LDADD): Add LIBDL.
14105         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14106         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14107         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14108         (MOSTLYCLEANFILES): Likewise.
14109         * testsuite/Makefile.in: Regenerate.
14110         * testsuite/plugin_test.c: New file.
14111         * testsuite/plugin_test_1.sh: New file.
14112         * testsuite/plugin_test_2.sh: New file.
14113
14114 2008-09-16  Ian Lance Taylor  <iant@google.com>
14115
14116         * target-reloc.h (relocate_section): Check whether a symbol is
14117         defined by the ABI before reporting an undefined symbol error.
14118         * target.h (Target::is_defined_by_abi): Make parameter const.
14119         (Target::do_is_defined_by_abi): Likewise.
14120         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14121         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14122         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14123         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14124         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14125         * testsuite/Makefile.in: Rebuild.
14126
14127         * fileread.cc (make_view): Add casts to avoid warning.
14128
14129 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14130
14131         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14132         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14133
14134 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14135
14136         * options.h (General_options::output_is_executable): New.
14137         (General_options::output_is_pie): New.
14138         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14139         for shared libraries.
14140         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14141
14142 2008-09-11  Chris Demetriou  <cgd@google.com>
14143
14144         * options.h (origin): New -z option.
14145         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14146         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14147         in DT_FLAGS_1.
14148
14149 2008-09-05  Cary Coutant  <ccoutant@google.com>
14150
14151         * fileread.cc (File_read::make_view): Add check for attempt to map
14152         beyond end of file.
14153
14154 2008-09-05  Cary Coutant  <ccoutant@google.com>
14155
14156         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14157         explicit instantiations.
14158
14159 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14160
14161         PR gold/6858
14162         * options.cc (General_options::finalize): Allow undefined symbols
14163         in shlibs if linking -shared.
14164
14165         PR gold/6859
14166         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14167         symbols as not needing a dynsym entry.
14168
14169 2008-08-20  Craig Silverstein  <csilvers@google.com>
14170
14171         * fileread.cc (File_read::open): Do not lock the file unless it
14172         was successfully opened.
14173
14174 2008-08-14  Cary Coutant  <ccoutant@google.com>
14175
14176         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14177         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14178         * testsuite/tls_test.cc (struct int128): 128-bit struct
14179         for testing TLS relocs with non-zero addend.
14180         (v12): New TLS variable.
14181         (t12): New test.
14182         (t_last): Add check for v12.
14183         * testsuite/tls_test.h (t12): New function.
14184         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14185
14186 2008-08-13  Ian Lance Taylor  <iant@google.com>
14187
14188         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14189         set tls_segment_ or relro_segment_.
14190         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14191         when appropriate.
14192         * output.h (Output_section::clear_is_relro): New function.
14193         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14194         sections specially even when output_data_ is empty.
14195         (Output_segment::maximum_alignment): When first section is relro,
14196         only force alignment for PT_LOAD segments.
14197         * script.cc (script_data_segment_align): New function.
14198         (script_data_segment_relro_end): New function.
14199         * script-c.h (script_data_segment_align): Declare.
14200         (script_data_segment_relro_end): Declare.
14201         * script-sections.h (class Script_sections): Declare
14202         data_segment_align and data_segment_relro_end.  Add fields
14203         segment_align_index_ and saw_relro_end_.
14204         * script-sections.cc (class Sections_element): Add set_is_relro
14205         virtual function.  Add new bool* parameter to place_orphan_here.
14206         Add get_output_section virtual function.
14207         (class Output_section_definition): Add set_is_relro.  Add new
14208         bool* parameter to place_orphan_here.  Add get_output_section.
14209         Add is_relro_ field.
14210         (Output_section_definition::Output_section_definition): Initialize
14211         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14212         and is_relro_ fields.
14213         (Output_section_definition::place_orphan_here): Add is_relro
14214         parameter.
14215         (Output_section_definition::set_section_addresses): Set relro for
14216         output section.
14217         (Output_section_definition::alternate_constraint): Likewise.
14218         (class Orphan_output_section): Add new bool* parameter to
14219         place_orphan_here.  Add get_output_section.
14220         (Orphan_output_section::place_orphan_here): Add is_relro
14221         parameter.
14222         (Script_sections::Script_sections): Initialize
14223         data_segment_align_index_ and saw_relro_end_.
14224         (Script_sections::data_segment_align): New function.
14225         (Script_sections::data_segment_relro_end): New function.
14226         (Script_sections::place_orphan): Set or clear is_relro.
14227         (Script_sections::set_section_addresses): Force alignment of first
14228         TLS section.
14229         * yyscript.y (exp): Call script_data_segment_align and
14230         script_data_segment_relro_end.
14231         * testsuite/relro_script_test.t: New file.
14232         * testsuite/relro_test.cc (using_script): Declare.
14233         (t1, t2): Test using_script.
14234         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14235         (relro_script_test_SOURCES): Define.
14236         (relro_script_test_DEPENDENCIES): Define.
14237         (relro_script_test_LDFLAGS): Define.
14238         (relro_script_test_LDADD): Define.
14239         (relro_script_test.so): New target.
14240         * testsuite/Makefile.in: Rebuild.
14241
14242 2008-08-06  Cary Coutant <ccoutant@google.com>
14243
14244         * archive.cc (Archive::total_archives, Archive::total_members)
14245         (Archive::total_members_loaded): New variables.
14246         (Archive::setup): Add parameter.  Add option to preread
14247         archive symbols.
14248         (Archive::read_armap): Add counter.
14249         (Archive::get_file_and_offset): New function.
14250         (Archive::get_elf_object_for_member): New function.
14251         (Archive::read_all_symbols): New function.
14252         (Archive::read_symbols): New function.
14253         (Archive::add_symbols): Add counters.
14254         (Archive::include_all_members): Use armap to find members if it's
14255         already built.
14256         (Archive::include_member): Skip reading symbols if already read.
14257         Factored code into Archive::get_file_and_offset and
14258         Archive::get_elf_object_for_member.  Changed call to
14259         Mapfile::report_include_archive_member.
14260         (Archive::print_stats): New function.
14261         * archive.h: Declare Object and Read_symbols_data classes.
14262         (Archive::Archive): Add initializers for new members.
14263         (Archive::setup): Add parameter.
14264         (Archive::print_stats): New function.
14265         (Archive::total_archives, Archive::total_members)
14266         (Archive::total_members_loaded): New variables.
14267         (Archive::get_file_and_offset): New function.
14268         (Archive::get_elf_object_for_member): New function.
14269         (Archive::read_all_symbols): New function.
14270         (Archive::read_symbols): New function.
14271         (Archive::Archive_member): New class.
14272         (Archive::members_): New member.
14273         (Archive::num_members_): New member.
14274         * main.cc: Include archive.h.
14275         (main): Call Archive::print_stats.
14276         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14277         archive parameter; member_name is now the fully-decorated name.
14278         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14279         * options.h: (General_options): Add --preread-archive-symbols option.
14280         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14281         Archive::setup.
14282
14283 2008-08-04  Ian Lance Taylor  <iant@google.com>
14284
14285         * symtab.h (Symbol::use_plt_offset): New function.
14286         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14287         * powerpc.cc (Relocate::relocate): Likewise.
14288         * sparc.cc (Relocate::relocate): Likewise.
14289         * x86_64.cc (Relocate::relocate): Likewise.
14290         * testsuite/weak_plt.sh: New test.
14291         * testsuite/weak_plt_main.cc: New test.
14292         * testsuite/weak_plt_shared.cc: New test.
14293         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14294         (check_PROGRAMS): Add weak_plt.
14295         (check_DATA): Add weak_plt_shared.so.
14296         (weak_plt_main_pic.o, weak_plt): New targets.
14297         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14298         * testsuite/Makefile.in: Rebuild.
14299
14300         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14301         gcctestdir/ld.
14302         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14303         * testsuite/Makefile.in: Rebuild.
14304
14305 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14306
14307         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14308         * Makefile.in: Regenerate.
14309         * po/POTFILES.in: Regenerate.
14310
14311 2008-07-29  Ian Lance Taylor  <iant@google.com>
14312
14313         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14314         symbols before other symbols.
14315         * testsuite/script_test_2.cc (test_addr): Declare.
14316         (test_addr_alias): Declare.
14317         (main): Check that test_addr and test_addr_alias have the right
14318         values.
14319         * testsuite/script_test_2.t: Define test_addr_alias and
14320         test_addr.
14321
14322 2008-07-24  Ian Lance Taylor  <iant@google.com>
14323
14324         PR 5990
14325         * descriptors.cc: New file.
14326         * descriptors.h: New file.
14327         * gold-threads.h (class Hold_optional_lock): New class.
14328         * fileread.cc: Include "descriptors.h".
14329         (File_read::~File_read): Release descriptor rather than closing
14330         it.
14331         (File_read::open) [file]: Call open_descriptor rather than open.
14332         Set is_descriptor_opened_.
14333         (File_read::open) [memory]: Assert that descriptor is not open.
14334         (File_read::reopen_descriptor): New function.
14335         (File_read::release): Release descriptor.
14336         (File_read::do_read): Make non-const.  Reopen descriptor.
14337         (File_read::read): Make non-const.
14338         (File_read::make_view): Reopen descriptor.
14339         (File_read::do_readv): Likewise.
14340         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14341         Update declarations.
14342         * layout.cc: Include "descriptors.h".
14343         (Layout::create_build_id): Use open_descriptor rather than open.
14344         * output.cc: Include "descriptors.h".
14345         (Output_file::open): Use open_descriptor rather than open.
14346         * archive.cc (Archive::const_iterator): Change Archive to be
14347         non-const.
14348         (Archive::begin, Archive::end): Make non-const.
14349         (Archive::count_members): Likewise.
14350         * archive.h (class Archive): Update declarations.
14351         * object.h (Object::read): Make non-const.
14352         * Makefile.am (CCFILES): Add descriptors.cc.
14353         (HFILES): Add descriptors.h.
14354         * Makefile.in: Rebuild.
14355
14356         PR 6716
14357         * gold.h: Always include <clocale>.  Add Solaris workarounds
14358         following code in binutils/sysdep.h.
14359
14360         PR 6048
14361         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14362         this->eh_frame_hdr_ is NULL before using it.
14363
14364         * dynobj.cc (Versions::Versions): Update comment.
14365
14366         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14367         the base version name.
14368
14369         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14370         array size plus one.
14371         (Stringpool_template::set_string_offsets): Subtract one from key
14372         before using it as an array index.
14373         (Stringpool_template::get_offset_with_length): Likewise.
14374         (Stringpool_template::write_to_buffer): Likewise.
14375         * stringpool.h (Stringpool_template::get_offset_from_key):
14376         Likewise.
14377
14378 2008-07-23  Ian Lance Taylor  <iant@google.com>
14379
14380         PR 6658
14381         * object.h (Merged_symbol_value::value): Do our best to handle a
14382         negative addend.
14383
14384         PR 6647
14385         * script.cc (Version_script_info::get_versions): Don't add empty
14386         version tag to return value.
14387         (Version_script_info::get_symbol_version_helper): Change return
14388         type to bool.  Add pversion parameter.  Change all callers.
14389         (script_register_vers_node): Don't require a non-NULL tag.
14390         * script.h (class Version_script_info): Update declarations.
14391         (Version_script_info::get_symbol_version): Change return type to
14392         bool.  Add version parameter.  Change all callers.
14393         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14394         handling.  Handle an empty version from a version script.
14395         (Symbol_table::define_special_symbol): Likewise.
14396         * testsuite/ver_test_10.script: New file.
14397         * testsuite/ver_test_10.sh: New file.
14398         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14399         (check_DATA): Add ver_test_10.syms.
14400         (ver_test_10.syms, ver_test_10.so): New target.
14401         * testsuite/Makefile.in: Rebuild.
14402
14403 2008-07-23  Simon Baldwin  <simonb@google.com>
14404
14405         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14406         to zero for undefined symbols from dynamic libraries.
14407
14408 2008-07-23  Ian Lance Taylor  <iant@google.com>
14409
14410         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14411         Change all callers.
14412         * symtab.h (class Symbol_table): Update declaration.
14413         * testsuite/ver_test_9.cc: New file.
14414         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14415         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14416         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14417         (ver_test_9.so, ver_test_9.o): New targets.
14418         * testsuite/Makefile.in: Rebuild.
14419
14420 2008-07-22  Ian Lance Taylor  <iant@google.com>
14421
14422         * options.h (class General_options): Define --check-sections.
14423         * layout.cc (Layout::set_segment_offsets): Handle
14424         --check-sections.
14425
14426         * options.h (class General_options): Define -n/--nmagic and
14427         -N/--omagic.
14428         * options.cc (General_options::finalize): For -n/--nmagic or
14429         -N/--omagic, set -static.
14430         * layout.cc (Layout::attach_allocated_section_to_segment): If
14431         -N/--omagic, don't put read-only and read-write sections in
14432         different segments.
14433         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14434         finding a read-only segment.
14435         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14436         don't set the minimum segment alignment to the common page size,
14437         and don't set the file offset to the address modulo the page size.
14438         * script-sections.cc (Script_sections::create_segments): If
14439         -n/--omagic, don't put read-only and read-write sections in
14440         different segments.
14441
14442         * cref.cc: New file.
14443         * cref.h: New file.
14444         * options.h (class General_options): Add --print-symbol-counts.
14445         * main.cc (main): Issue defined symbol report if requested.
14446         * archive.cc (Archive::interpret_header): Make into a const member
14447         function.
14448         (Archive::add_symbols): Call Input_objects::archive_start and
14449         archive_stop.
14450         (Archive::const_iterator): Define new class.
14451         (Archive::begin, Archive::end): New functions.
14452         (Archive::include_all_members): Rewrite to use iterator.
14453         (Archive::count_members): New function.
14454         * archive.h (class Archive): Update declarations.
14455         (Archive::filename): New function.
14456         * object.cc: Include "cref.h".
14457         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14458         (Sized_relobj::do_get_global_symbol_counts): New function.
14459         (Input_objects::add_object): Add object to cross-referencer.
14460         (Input_objects::archive_start): New function.
14461         (Input_objects::archive_stop): New function.
14462         (Input_objects::print_symbol_counts): New function.
14463         * object.h: Declare Cref and Archive.
14464         (Object::get_global_symbol_counts): New function.
14465         (Object::do_get_global_symbol_counts): New pure virtual function.
14466         (class Sized_relobj): Add defined_count_ field.  Update
14467         declarations.
14468         (class Input_objects): Add cref_ field.  Update constructor.
14469         Update declarations.
14470         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14471         defined_count_.
14472         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14473         symbol counts.
14474         (Sized_dynobj::do_get_global_symbol_counts): New function.
14475         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14476         defined_count_.  Update declarations.  Define Symbols typedef.
14477         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14478         parameter.  Change all callers.
14479         (Symbol_table::add_from_dynobj): Add sympointers and defined
14480         parameters.  Change all callers.
14481         * symtab.h (class Symbol_table): Update declarations.
14482         * Makefile.am (CCFILES): Add cref.cc.
14483         (HFILES): Add cref.h.
14484         * Makefile.in: Rebuild.
14485
14486 2008-07-22  Simon Baldwin  <simonb@google.com>
14487
14488         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14489         to zero when writing undefined symbols.
14490
14491 2008-07-22  Ian Lance Taylor  <iant@google.com>
14492
14493         * output.cc (Output_section::add_input_section): Don't try to
14494         merge empty merge sections.
14495
14496 2008-07-21  Craig Silverstein  <csilvers@google.com>
14497
14498         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14499         Include symbol version in error message.
14500
14501 2008-07-20  Chris Demetriou  <cgd@google.com>
14502
14503         * configure.ac (gold_cv_c_random_seed): New configured variable.
14504         (RANDOM_SEED_CFLAGS): New substituted variable.
14505         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14506         * configure: Rebuild.
14507         * Makefile.in: Likewise.
14508         * testsuite/Makefile.in: Likewise.
14509
14510 2008-07-18  Ian Lance Taylor  <iant@google.com>
14511
14512         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14513         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14514         * testsuite/ver_test_main.cc (main): Call t4.
14515         (t4, t4_2a): Define.
14516         * testsuite/ver_test_2.cc (t4_2): Define.
14517         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14518         * testsuite/ver_test_4.cc (t4_2a): Define.
14519         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14520         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14521
14522 2008-07-17  Ian Lance Taylor  <iant@google.com>
14523
14524         * dynobj.cc (Versions::add_def): If we give an error about a
14525         missing version, go ahead and create the version anyhow.
14526
14527 2008-07-10  Ian Lance Taylor  <iant@google.com>
14528
14529         Handle output sections with more than 0x7fffffff bytes.
14530         * object.h (class Relobj): Change map_to_output_ to
14531         output_sections_, and just keep a section pointer.  Change all
14532         uses.  Move comdat group support to Sized_relobj.
14533         (Relobj::is_section_specially_mapped): Remove.
14534         (Relobj::output_section): Remove poff parameter.  Change all
14535         callers.
14536         (Relobj::output_section_offset): New function.
14537         (Relobj::set_section_offset): Rewrite.
14538         (Relobj::map_to_output): Remove.
14539         (Relobj::output_sections): New function.
14540         (Relobj::do_output_section_offset): New pure virtual function.
14541         (Relobj::do_set_section_offset): Likewise.
14542         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14543         group support from Relobj.  Update declarations.
14544         (Sized_relobj::get_output_section_offset): New function.
14545         (Sized_relobj::do_output_section_offset): New function.
14546         (Sized_relobj::do_set_section_offset): New function.
14547         * object.cc (Relobj::output_section_address): Remove.
14548         (Sized_relobj::Sized_relobj): Initialize new fields.
14549         (Sized_relobj::include_section_group): Cast find_kept_object to
14550         Sized_relobj.
14551         (Sized_relobj::include_linkonce_section): Likewise.
14552         (Sized_relobj::do_layout): Use separate arrays for output section
14553         and output offset.
14554         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14555         output_sections.
14556         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14557         output_sections and section_offsets.
14558         (Sized_relobj::write_local_symbols): Likewise.
14559         (map_to_kept_section): Compute output address directly.
14560         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14561         output_sections and section_offsets.
14562         (Sized_relobj::write_sections): Likewise.
14563         (Sized_relobj::relocate_sections): Likewise.
14564         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14565         * output.h (class Output_reloc): Update declarations.  Change
14566         u2_.relobj to Sized_relobj*.
14567         (class Output_data_reloc): Change add functions to use
14568         Sized_relobj*.
14569         * output.cc (Output_reloc::Output_reloc): Change relobj to
14570         Sized_relobj*.
14571         (Output_reloc::local_section_offset): Change return type to
14572         Elf_Addr.  Use get_output_section_offset.
14573         (Output_reloc::get_address): Likewise.
14574         (Output_section::is_input_address_mapped): Don't call
14575         is_section_specially_mapped.
14576         (Output_section::output_offset): Likewise.
14577         (Output_section::output_address): Likewise.
14578         (Output_section::starting_output_address): Likewise.
14579         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14580         parameter to Sized_relobj*.
14581         (Copy_relocs::need_copy_reloc): Likewise.
14582         (Copy_relocs::save): Likewise.
14583         * copy-relocs.h (class Copy_relocs): Update declarations.
14584         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14585         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14586         * target-reloc.h (relocate_for_relocatable): Change
14587         offset_in_output_section type to Elf_Addr.  Change code that uses
14588         it as well.
14589         * layout.cc (Layout::layout): Always set *off.
14590         * mapfile.cc (Mapfile::print_input_section): Use
14591         output_section_offset.
14592         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14593         Sized_relobj*.
14594         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14595         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14596         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14597
14598 2008-07-03  Ian Lance Taylor  <iant@google.com>
14599
14600         * layout.cc (Layout::include_section): Do not discard unrecognized
14601         SHT_STRTAB sections.
14602
14603 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14604
14605         * script.cc (Lex::can_continue_name): Make '?' allowable in
14606         version-script names.
14607         * testsuite/version_script.map: Change glob pattern to use '?'
14608
14609 2008-06-30  Manish Singh  <yosh@gimp.org>
14610
14611         PR 6585
14612         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14613         Correct typo.
14614
14615 2008-06-30  Ian Lance Taylor  <iant@google.com>
14616
14617         PR 6660
14618         PR 6682
14619         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14620         versions]: Don't try to read the value in the contents, since we
14621         don't use it.  Use the template endianness when writing.
14622
14623 2008-06-25  Cary Coutant  <ccoutant@google.com>
14624
14625         * fileread.cc (File_read::make_view): Assert on zero-length view.
14626         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14627         symbol table when there are no symbols to read.
14628
14629 2008-06-23  Craig Silverstein  <csilvers@google.com>
14630
14631         * version.cc (version_string): Bump to 1.7
14632
14633 2008-06-18  Craig Silverstein  <csilvers@google.com>
14634
14635         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14636         constant 0xFFFF to type Valtype.
14637         (Powerpc_relocate_functions::rel16_ha): Likewise.
14638
14639 2008-06-17  Ian Lance Taylor  <iant@google.com>
14640
14641         * output.h (Output_section::Input_section): Initialize p2align_ to
14642         zero for Output_section_data constructors.
14643         (Output_section::Input_section::addralign): If not an input
14644         section, return the alignment of the Output_section_data.
14645         * testsuite/copy_test.cc: New file.
14646         * testsuite/copy_test_1.cc: New file.
14647         * testsuite/copy_test_2.cc: New file.
14648         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14649         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14650         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14651         (copy_test_1_pic.o, copy_test_1.so): New targets.
14652         (copy_test_2_pic.o, copy_test_2.so): New targets.
14653         * testsuite/Makefile.in: Rebuild.
14654
14655         * script-sections.cc (Script_sections::place_orphan): Initialize
14656         local variable exact.
14657
14658 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14659
14660         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14661
14662 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14663             David S. Miller  <davem@davemloft.net>
14664
14665         * powerpc.cc: New file.
14666         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14667         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14668         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14669         * Makefile.in: Rebuild.
14670
14671 2008-06-09  Ian Lance Taylor  <iant@google.com>
14672
14673         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14674         <exception>.
14675         (throwing, orig_terminate): New static variables.
14676         (terminate_handler): New static function.
14677         (t2): Set terminate handler.
14678
14679 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14680
14681         PR 6584
14682         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14683         alignment.
14684
14685 2008-05-30  Cary Coutant  <ccoutant@google.com>
14686
14687         * archive.cc (Archive::include_all_members) Correct to step
14688         over symbol table and extended name table in thin archives.
14689
14690 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14691
14692         PR 6407
14693         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14694         calculation.
14695
14696 2008-05-28  Caleb Howe  <cshowe@google.com>
14697
14698         * reduced_debug_output.cc: New file.
14699         * reduced_debug_output.h: New file.
14700         * options.h (class General_options): Add --strip-debug-non-line.
14701         * options.cc (General_options::finalize): Add strip_debug_non_line
14702         to the strip heirarchy.
14703         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14704         fields.
14705         * layout.cc: Include "reduced_debug_output.h".
14706         (Layout::Layout): Initialize new fields.
14707         (line_only_debug_sections): New static array.
14708         (is_lines_only_debug_sections): New static inline function.
14709         (Layout::include_section): Handle --strip-debug-non-line.
14710         (Layout::make_output_section): If --strip-debug-non-line, build
14711         new output sections for .debug_abbrev and .debug_info.
14712         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14713         gold.  Warn about possible overflow.
14714         (read_signed_LEB_128): Likewise.
14715         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14716         (read_signed_LEB_128): Declare.
14717         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14718         (HFILES): Add reduced_debug_output.h.
14719         * Makefile.in: Rebuild.
14720
14721 2008-05-21  Ian Lance Taylor  <iant@google.com>
14722
14723         * mapfile.cc: New file.
14724         * mapfile.h: New file.
14725         * options.h (class General_options): Add -M/--print-map and -Map.
14726         * options.cc (General_options::finalize): Make -M equivalent to
14727         -Map -.
14728         * main.cc: Include <cstdio> and "mapfile.h".
14729         (main): Open mapfile if requested.
14730         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14731         constructor.  Change caller.
14732         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14733         (queue_middle_tasks): Likewise.
14734         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14735         declarations.
14736         * archive.cc: Include "mapfile.h".
14737         (Archive::add_symbols): Add mapfile parameter.  Change all
14738         callers.  Pass mapfile, symbol, and reason to include_member.
14739         (Archive::include_all_members): Add mapfile parameter.  Change all
14740         callers.
14741         (Archive::include_member): Add mapfile, sym, and why parameters.
14742         Change all callers.  Report inclusion to map file.
14743         * archive.h: Include "fileread.h".
14744         (class Archive): Update declarations.
14745         (Archive::file): New const method.
14746         (class Add_archive_symbols): Add mapfile_ field.  Update
14747         constructor.  Change all callers.
14748         * readsyms.h (class Read_symbols): Likewise.
14749         (class Finish_group): Likewise.
14750         (class Read_script): Likewise.
14751         * common.cc: Include "mapfile.h".
14752         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14753         all callers.
14754         (Symbol_table::do_allocate_commons): Likewise.
14755         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14756         symbol allocation to mapfile.
14757         * common.h (class Allocate_commons_task): Add mapfile_ field.
14758         Update constructor.  Change all callers.
14759         * symtab.h (class Symbol_table): Update declarations.
14760         * layout.cc: Include "mapfile.h".
14761         (Layout_task_runner::run): Print information to mapfile.
14762         (Layout::create_gold_note): Change Output_data_fixed_space to
14763         Output_data_zero_fill.
14764         (Layout::create_build_id): Likewise.
14765         (Layout::print_to_mapfile): New function.
14766         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14767         constructor.  Change caller.
14768         (class Layout): Declare print_to_mapfile.
14769         * output.cc (Output_section::Input_section::print_to_mapfile): New
14770         function.
14771         (Output_section::add_input_section): If producing a map, always
14772         add to input_sections_ list.
14773         (Output_section::do_print_to_mapfile): New function.
14774         (Output_segment::print_sections_to_mapfile): New function.
14775         (Output_segment::print_section_list_to_mapfile): New function.
14776         * output.h: Include "mapfile.h".
14777         (Output_data::print_to_mapfile): New function.
14778         (Output_data::do_print_to_mapfile): New virtual function.
14779         (Output_segment_headers::do_print_to_mapfile): New function.
14780         (Output_file_header::do_print_to_mapfile): New function.
14781         (Output_data_const::do_print_to_mapfile): New function.
14782         (class Output_data_const_buffer): Add map_name_ field.  Update
14783         constructor.  Change all callers.  Add do_print_to_mapfile
14784         function.
14785         (class Output_data_fixed_space): Likewise.
14786         (class Output_data_space): Likewise.
14787         (class Output_data_zero_fill): New class.
14788         (Output_data_strtab::do_print_to_mapfile): New function.
14789         (Output_data_reloc_base::do_print_to_mapfile): New function.
14790         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14791         (Output_data_group::do_print_to_mapfile): New function.
14792         (Output_data_got::do_print_to_mapfile): New function.
14793         (Output_data_dynamic::do_print_to_mapfile): New function.
14794         (Output_symtab_xindex::do_print_to_mapfile): New function.
14795         (class Output_section): Declare do_print_to_mapflie.  Declare
14796         print_to_mapfile in Input_section.
14797         (class Output_segment): Declare new functions.
14798         * object.h (Sized_relobj::symbol_count): New function.
14799         * script-sections.cc
14800         (Output_section_element_dot_assignment::set_section_addresses):
14801         Change Output_data_fixed_space to Output_data_zero_fill.
14802         (Output_data_expression::do_print_to_mapfile): New function.
14803         * script.cc (read_input_script): Add mapfile parameter.  Change
14804         all callers.
14805         * script.h (read_input_script): Update declaration.
14806         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14807         (Eh_frame::do_print_to_mapfile): New function.
14808         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14809         (Output_merge_string::do_print_to_mapfile): New function.
14810         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14811         function.
14812         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14813         function.
14814         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14815         function.
14816         * Makefile.am (CCFILES): Add mapfile.cc.
14817         (HFILES): Add mapfile.h.
14818         * Makefile.in: Rebuild.
14819
14820 2008-05-19  Ian Lance Taylor  <iant@google.com>
14821
14822         * options.h (class General_options): Add -z relro.
14823         * layout.cc (Layout::Layout): Initialize relro_segment_.
14824         (Layout::add_output_section_data): Return the output section.
14825         (Layout::make_output_section): Rcognize relro sections and mark
14826         them appropriately.
14827         (Layout::attach_allocated_section_to_segment): Put relro sections
14828         in a PT_GNU_RELRO segment.
14829         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14830         section as relro.
14831         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14832         PT_TLS segments.
14833         (Layout::linkonce_mapping): Map d.rel.ro.local to
14834         .data.rel.ro.local.
14835         (Layout::output_section_name): Us .data.rel.ro.local for any
14836         section which begins with that.
14837         * layout.h (class Layout): Update add_output_section_data
14838         declaration.  Add relro_segment_ field.
14839         * output.cc (Output_section::Output_section): Initialize is_relro_
14840         and is_relro_local_ fields.
14841         (Output_segment::add_output_section): Group relro sections.
14842         (Output_segment::is_first_section_relro): New function.
14843         (Output_segment::maximum_alignment): If there is a relro section,
14844         align the segment to the common page size.
14845         (Output_segment::set_section_addresses): Track whether we are
14846         looking at relro sections.  If the last section is a relro
14847         section, align to the common page size.
14848         (Output_segment::set_section_list_addresses): Add in_relro
14849         parameter.  Change all callers.  Align to the page size when
14850         moving from relro to non-relro section.
14851         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14852         segment.
14853         * output.h (class Output_section): Add is_relro_ and
14854         is_relro_local_ fields.
14855         (Output_section::is_relro): New function.
14856         (Output_section::set_is_relro): New function.
14857         (Output_section::is_relro_local): New function.
14858         (Output_section::set_is_relro_local): New function.
14859         (class Output_segment): Update declarations.
14860         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14861         * sparc.cc (Target_sparc::got_section): Likewise.
14862         * x86_64.cc (Target_x86_64::got_section): Likewise.
14863         * testsuite/relro_test_main.cc: New file.
14864         * testsuite/relro_test.cc: New file.
14865         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14866         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14867         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14868         (relro_test.so, relro_test_pic.o): New targets.
14869         * testsuite/Makefile.in: Rebuild.
14870
14871 2008-05-16  Ian Lance Taylor  <iant@google.com>
14872
14873         * output.cc (Output_segment::add_output_section): Remove front
14874         parameter.
14875         * output.h (class Output_segment): Remove
14876         add_initial_output_section and overloaded add_output_section.
14877         Update declaration of remaining add_output_section.
14878         * layout.cc (Layout::create_interp): Call add_output_section
14879         rather than add_initial_output_section.
14880         (Layout::finish_dynamic_section): Likewise.
14881
14882         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14883         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14884         know the dynamic type.
14885         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14886         field.  Initialize it in constructor.
14887         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14888         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14889         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14890         reloc.
14891
14892         * output.cc (Output_reloc::get_address): Change return type to
14893         Elf_Addr.
14894         * output.h (class Output_reloc): Update get_address declaration.
14895         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14896         for section addresses.
14897
14898 2008-05-09  Ian Lance Taylor  <iant@google.com>
14899
14900         PR 6493
14901         * gold.cc (gold_nomem): Use return value of write.
14902
14903 2008-05-08  Ian Lance Taylor  <iant@google.com>
14904
14905         * symtab.c (Symbol::init_base_output_data): Add version
14906         parameter.  Change all callers.
14907         (Symbol::init_base_output_segment): Likewise.
14908         (Symbol::init_base_constant): Likewise.
14909         (Symbol::init_base_undefined): Likewise.
14910         (Sized_symbol::init_output_data): Likewise.
14911         (Sized_symbol::init_output_segment): Likewise.
14912         (Sized_symbol::init_constant): Likewise.
14913         (Sized_symbol::init_undefined): Likewise.
14914         (Symbol_table::do_define_in_output_data): If the new symbol has a
14915         version, mark it as the default.
14916         (Symbol_table::do_define_in_output_segment): Likewise.
14917         (Symbol_table::do_define_as_constant): Likewise.
14918         * symtab.h (class Symbol): Update declarations.
14919         (class Sized_symbol): Likewise.
14920         * resolve.cc (Symbol::override_version): New function.
14921         (Symbol::override_base): Call override_version.
14922         (Symbol::override_base_with_special): Likewise.
14923         * testsuite/ver_script_8.script: New file.
14924         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14925         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14926         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14927         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14928
14929 2008-05-06  Ian Lance Taylor  <iant@google.com>
14930
14931         PR 6049
14932         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14933         functions.
14934         (class General_options): Remove existing --undefined, and add
14935         --no-undefined instead.  Add new --undefined as synonym for -u.
14936         * archive.cc (Archive::add_symbols): Check whether symbol was
14937         named with -u.
14938         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14939         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14940         all uses.  Add IS_UNDEFINED.  Update declarations to split
14941         different versions of init_base.  Declare init_base_undefined.
14942         (Symbol::is_defined): Handle IS_UNDEFINED.
14943         (Symbol::is_undefined): Likewise.
14944         (Symbol::is_weak_undefined): Call is_undefined.
14945         (Symbol::is_absolute): Handle IS_CONSTANT.
14946         (class Sized_symbol): Update declarations to split different
14947         versions of init.  Declare init_undefined.
14948         (class Symbol_table): Declare new functions.
14949         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14950         Change all callers.
14951         (Symbol::init_base_output_data): Likewise.
14952         (Symbol::init_base_output_segment): Likewise.
14953         (Symbol::init_base_constant): Likewise.
14954         (Symbol::init_base_undefined): New function.
14955         (Sized_symbol::init_object): Rename from init.  Change all
14956         callers.
14957         (Sized_symbol::init_output_data): Likewise.
14958         (Sized_symbol::init_output_segment): Likewise.
14959         (Sized_symbol::init_constant): Likewise.
14960         (Sized_symbol::init_undefined): New function.
14961         (Symbol_table::add_undefined_symbols_from_command_line): New
14962         function.
14963         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14964         function.
14965         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14966         (Symbol::output_section): Likewise.
14967         (Symbol::set_output_section): Likewise.
14968         (Symbol_table::sized_finalize_symbol): Likewise.
14969         (Symbol_table::sized_write_globals): Likewise.
14970         * resolve.cc (Symbol_table::should_override): Likewise.
14971         (Symbol::override_base_with_special): Likewise.
14972
14973         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14974         symbol, change it to have default visibility.
14975         * testsuite/protected_1.cc: New file.
14976         * testsuite/protected_2.cc: New file.
14977         * testsuite/protected_3.cc: New file.
14978         * testsuite/protected_main_1.cc: New file.
14979         * testsuite/protected_main_2.cc: New file.
14980         * testsuite/protected_main_3.cc: New file.
14981         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14982         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14983         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14984         (protected_1.so): New target.
14985         (protected_1_pic.o, protected_2_pic.o): New targets.
14986         (protected_3_pic.o): New target.
14987         (check_PROGRAMS): Add protected_2.
14988         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14989         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14990         * testsuite/Makefile.in: Rebuild.
14991
14992         * options.h (DEFINE_var): Add set_user_set_##varname__.
14993         (DEFINE_bool_alias): New macro.
14994         (class General_options): Define -Bstatic using DEFINE_bool_alias
14995         rather than DEFINE_special.  Add --undefined as an alias for -z
14996         defs.
14997         * options.cc (General_options::parse_Bstatic): Remove.
14998
14999         * options.h (class General_options): Add --fatal-warnings.
15000         * main.cc (main): Implement --fatal-warnings.
15001         * errors.h (Errors::warning_count): New function.
15002
15003         * options.h (class General_options): Add -Bsymbolic-functions.
15004         * symtab.h (Symbol::is_preemptible): Check for
15005         -Bsymbolic-functions.
15006
15007 2008-05-05  Ian Lance Taylor  <iant@google.com>
15008
15009         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15010         as noVARNAME rather than no-VARNAME.
15011         (class General_options): Add option -z combreloc.
15012         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15013         get_address.
15014         (Output_reloc::sort_before) [SHT_REL]: New function.
15015         (Output_reloc::sort_before) [SHT_RELA]: New function.
15016         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15017         Sort_relocs_comparison.
15018         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15019         parameter.  Change all callers.
15020         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15021         sort_relocs parameter.  Change all callers.
15022         * output.cc (Output_reloc::get_address): New function, broken out
15023         of write_rel.
15024         (Output_reloc::write_rel): Call it.
15025         (Output_reloc::compare): New function.
15026         (Output_data_reloc_base::do_write): Optionally sort relocs.
15027
15028         * configure.ac: If targ_extra_obj is set, link it in.
15029         * configure.tgt: Initialize all variables.
15030         (x86_64*): Set targ_extra_obj and targ_extra_size.
15031         * configure: Rebuild.
15032
15033         * object.cc (Sized_relobj::include_section_group): Adjust section
15034         indexes read from group data.  Build vector to pass to
15035         layout_group.
15036         * layout.cc (Layout::layout_group): Add flags and shndxes
15037         parameters.  Remove contents parameter.  Change caller.  Update
15038         explicit instantiations.
15039         * layout.h (class Layout): Update layout_group declaration.
15040         * output.cc (Output_data_group::Output_data_group): Add flags and
15041         input_shndxes parameters.  Remove contents parameter.  Change
15042         caller.
15043         (Output_data_group::do_write): Change input_sections_ to
15044         input_shndxes_.
15045         * output.h (class Output_data_group): Update constructor
15046         declaration.  Rename input_sections_ to input_shndxes_.
15047         * testsuite/many_sections_test.cc: Add template.
15048
15049 2008-04-30  Cary Coutant  <ccoutant@google.com>
15050
15051         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15052
15053         * layout.cc (Layout::include_section): Refactored check for debug
15054         info section.
15055         (Layout::add_comdat): Add new parameters.  Change type
15056         of signature parameter.  Add object and shndx to signatures table.
15057         (Layout::find_kept_object): New function.
15058         * layout.h: Include <cstring>.
15059         (Layout::is_debug_info_section): New function.
15060         (Layout::add_comdat): Add new parameters.
15061         (Layout::find_kept_object): New function.
15062         (Layout::Kept_section): New struct.
15063         (Layout::Signatures): Change type of map range.
15064         * object.cc (Relobj::output_section_address): New function.
15065         (Sized_relobj::include_section_group): Add new parameters.  Change
15066         calls to Layout::add_comdat.  Change to build table of kept comdat
15067         groups and table mapping discarded sections to kept sections.
15068         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15069         (Sized_relobj::do_layout): Change calls to include_section_group and
15070         include_linkonce_section.
15071         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15072         value to zero when section is discarded.
15073         (Sized_relobj::map_to_kept_section): New function.
15074         * object.h (Relobj::output_section_address): New function.
15075         (Relobj::Comdat_group): New type.
15076         (Relobj::find_comdat_group): New function.
15077         (Relobj::Comdat_group_table): New type.
15078         (Relobj::Kept_comdat_section): New type.
15079         (Relobj::Kept_comdat_section_table): New type.
15080         (Relobj::add_comdat_group): New function.
15081         (Relobj::set_kept_comdat_section): New function.
15082         (Relobj::get_kept_comdat_section): New function.
15083         (Relobj::comdat_groups_): New field.
15084         (Relobj::kept_comdat_sections_): New field.
15085         (Symbol_value::input_value): Update comment.
15086         (Sized_relobj::map_to_kept_section) New function.
15087         (Sized_relobj::include_linkonce_section): Add new parameter.
15088         * target-reloc.h (Comdat_behavior): New type.
15089         (get_comdat_behavior): New function.
15090         (relocate_section): Add code to map a discarded section to the
15091         corresponding kept section when applying a relocation.
15092
15093 2008-04-30  Craig Silverstein  <csilvers@google.com>
15094
15095         * dwarf_reader.cc (next_generation_count): New static var.
15096         (Addr2line_cache_entry): New struct.
15097         (addr2line_cache): New static var.
15098         (Dwarf_line_info::one_addr2line): Added caching.
15099         (Dwarf_line_info::clear_addr2line_cache): New function.
15100         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15101         cache-size parameter.
15102         (Dwarf_line_info::one_addr2line_cache): New function.
15103         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15104         new cache-size argument to one_addr2line(), and clear cache.
15105
15106 2008-04-28  Cary Coutant  <ccoutant@google.com>
15107
15108         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15109         R_386_PC8 relocations.
15110
15111 2008-04-23  Ian Lance Taylor  <iant@google.com>
15112
15113         * object.cc (Sized_relobj::include_section_group): Check for
15114         invalid section group.
15115
15116         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15117         header size.
15118
15119         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15120         than read for file header.
15121         * archive.cc (Archive::include_member): Likewise.
15122
15123 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15124
15125         * aclocal.m4: Regenerate.
15126         * configure: Regenerate.
15127
15128 2008-04-19  Ian Lance Taylor  <iant@google.com>
15129
15130         * version.cc (version_string): Bump to 1.6.
15131
15132         * testsuite/Makefile.am (many_sections_r_test): New target.
15133         (many_sections_r_test_SOURCES): Remove.
15134         (many_sections_r_test_DEPENDENCIES): Remove.
15135         (many_sections_r_test_LDFLAGS): Remove.
15136         (many_sections_r_test_LDADD): Remove.
15137
15138         * object.cc (Sized_relobj::do_add_symbols): Always pass
15139         local_symbol_count_ to add_from_relobj.
15140
15141         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15142         every thousand variables.
15143         * testsuite/Makefile.in: Rebuild.
15144
15145         * object.cc (Xindex::initialize_symtab_xindex): New function.
15146         (Xindex::read_symtab_xindex): New function.
15147         (Xindex::sym_xindex_to_shndx): New function.
15148         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15149         available.
15150         (Sized_relobj::do_initialize_xindex): New function.
15151         (Sized_relobj::do_read_symbols): Adjust section links.
15152         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15153         parameter.  Change all callers.
15154         (Sized_relobj::include_section_group): Adjust section links and
15155         symbol section indexes.
15156         (Sized_relobj::do_layout): Adjust section links.
15157         (Sized_relobj::do_count_local_symbols): Adjust section links and
15158         symbol section indexes.
15159         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15160         ordinary and special symbols.
15161         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15162         dynsym_xindex parameters.  Change all callers.  Adjust section
15163         links.  Use SHN_XINDEX when needed.
15164         (Sized_relobj::get_symbol_location_info): Adjust section links.
15165         Don't get fooled by special symbols.
15166         * object.h (class Xindex): Define.
15167         (class Object): Add xindex_ parameter.  Declare virtual functoin
15168         do_initialize_xindex.
15169         (Object::adjust_sym_shndx): New function.
15170         (Object::set_xindex): New protected function.
15171         (class Symbol_value): Add is_ordinary_shndx_ field.
15172         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15173         (Symbol_value::value): Assert ordinary section.
15174         (Symbol_value::initialize_input_to_output_map): Likewise.
15175         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15176         Change all callers.
15177         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15178         all callers.
15179         (class Sized_relobj): Update declarations.
15180         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15181         parameter.  Change all callers.
15182         (Sized_relobj::adjust_shndx): New function.
15183         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15184         field.
15185         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15186         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15187         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15188         (Sized_dynobj::read_dynsym_section): Adjust section links.
15189         (Sized_dynobj::read_dynamic): Likewise.
15190         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15191         section links.
15192         (Sized_dynobj::do_initialize_xindex): New function.
15193         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15194         do_initialize_xindex.
15195         (Sized_dynobj::adjust_shndx): New function.
15196         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15197         dynsym_xindex_ fields.
15198         (Layout::finalize): Add a call to set_section_indexes before
15199         creating the symtab sections.
15200         (Layout::set_section_indexes): Don't do anything if the section
15201         already has a section index.
15202         (Layout::create_symtab_sections): Add shnum parameter.  Change
15203         caller.  Create .symtab_shndx section if needed.
15204         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15205         caller.
15206         (Layout::allocated_output_section_count): New function.
15207         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15208         needed.
15209         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15210         fields.  Update declarations.
15211         (Layout::symtab_xindex): New function.
15212         (Layout::dynsym_xindex): New function.
15213         (class Write_symbols_task): Add layout_ field.
15214         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15215         Change caller.
15216         * output.cc (Output_section_headers::Output_section_headers): Add
15217         shstrtab_section parameter.  Change all callers.
15218         (Output_section_headers::do_sized_write): Store overflow values
15219         for section count and section string table section index in
15220         section header zero.
15221         (Output_file_header::do_sized_write): Check for overflow of
15222         section count and section string table section index.
15223         (Output_symtab_xindex::do_write): New function.
15224         (Output_symtab_xindex::endian_do_write): New function.
15225         * output.h (class Output_section_headers): Add shstrtab_section_.
15226         Update declarations.
15227         (class Output_symtab_xindex): Define.
15228         (Output_section::has_out_shndx): New function.
15229         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15230         field.
15231         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15232         Change all callers.
15233         (Sized_symbol::init): Likewise.
15234         (Symbol::output_section): Check for ordinary symbol.
15235         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15236         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15237         callers.
15238         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15239         Change all callers.  Simplify handling of symbols from sections
15240         not included in the link.
15241         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15242         distinction.
15243         (Weak_alias_sorter::operator()): Assert that symbols are
15244         ordinary.
15245         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15246         distinction.
15247         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15248         parameters.  Change all callers.
15249         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15250         symbol distinction.  Use SHN_XINDEX when needed.
15251         (Symbol_table::write_section_symbol): Add symtab_xindex
15252         parameter.  Change all callers.
15253         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15254         SHN_XINDEX when needed.
15255         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15256         declarations.
15257         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15258         (Symbol::is_defined): Check is_ordinary.
15259         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15260         (Symbol::is_absolute, Symbol::is_common): Likewise.
15261         (class Sized_symbol): Update declarations.
15262         (class Symbol_table): Update declarations.
15263         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15264         parameters.  Change all callers.
15265         (Sized_symbol::override): Likewise.
15266         (Symbol_table::override): Likewise.
15267         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15268         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15269         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15270         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15271         to be in an ordinary section.
15272         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15273         object and is_ordinary parameters.  Change all callers.
15274         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15275         Change all callers.  Don't add undefined or non-ordinary symbols
15276         to reloc_map_.
15277         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15278         Change all callers.
15279         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15280         declarations.
15281         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15282         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15283         (Sized_relobj::relocate_sections): Likewise.
15284         * target-reloc.h (scan_relocs): Adjust section symbol index.
15285         (scan_relocatable_relocs): Likewise.
15286         * i386.cc (Scan::local): Check for ordinary symbols.
15287         * sparc.cc (Scan::local): Likewise.
15288         * x86_64.cc (Scan::local): Likewise.
15289         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15290         to symbol_section_and_value.
15291         * testsuite/many_sections_test.cc: New file.
15292         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15293         (check_PROGRAMS): Add many_sections_test.
15294         (many_sections_test_SOURCES): Define.
15295         (many_sections_test_DEPENDENCIES): Define.
15296         (many_sections_test_LDFLAGS): Define.
15297         (BUILT_SOURCES): Add many_sections_define.h.
15298         (many_sections_define.h): New target.
15299         (BUILT_SOURCES): Add many_sections_check.h.
15300         (many_sections_check.h): New target.
15301         (check_PROGRAMS): Add many_sections_r_test.
15302         (many_sections_r_test_SOURCES): Define.
15303         (many_sections_r_test_DEPENDENCIES): Define.
15304         (many_sections_r_test_LDFLAGS): Define.
15305         (many_sections_r_test_LDADD): Define.
15306         (many_sections_r_test.o): New target.
15307         * testsuite/Makefile.in: Rebuild.
15308
15309 2008-04-17  Cary Coutant  <ccoutant@google.com>
15310
15311         * errors.cc (Errors::info): New function.
15312         (gold_info): New function.
15313         * errors.h (Errors::info): New function.
15314         * gold.h (gold_info): New function.
15315         * object.cc (Input_objects::add_object): Print trace output.
15316         * options.cc (options::parse_set): New function.
15317         (General_options::parse_wrap): Deleted.
15318         (General_options::General_options): Deleted initializer.
15319         * options.h (options::String_set): New typedef.
15320         (options::parse_set): New function.
15321         (DEFINE_set): New macro.
15322         (General_options::wrap): Changed to use DEFINE_set. Changed
15323         callers of any_wrap_symbols and is_wrap_symbol.
15324         (General_options::trace, General_options::trace_symbol):
15325         New options.
15326         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15327         (General_options::wrap_symbols_): Deleted.
15328         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15329
15330 2008-04-17  David S. Miller  <davem@davemloft.net>
15331
15332         * options.cc (General_options::parse_V): New function.
15333         * options.h: Add entries for -V and -Qy.
15334
15335 2008-04-17  Ian Lance Taylor  <iant@google.com>
15336
15337         * common.cc (Symbol_table::allocate_commons): Remove options
15338         parameter.  Change caller.
15339         (Symbol_table::do_allocate_commons): Remove options parameter.
15340         Change caller.  Just call do_allocate_commons_list twice.
15341         (Symbol_table::do_allocate_commons_list): New function, broken out
15342         of do_allocate_commons.
15343         * common.h (class Allocate_commons_task): Remove options_ field.
15344         Update constructor.
15345         * symtab.cc (Symbol_table::Symbol_table): Initialize
15346         tls_commons_.
15347         (Symbol_table::add_from_object): Put TLS common symbols on
15348         tls_commons_ list.
15349         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15350         which are IN_OUTPUT_DATA.
15351         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15352         allocate_commons and do_allocate_commons declarations.  Declare
15353         do_allocate_commons_list.
15354         * gold.cc (queue_middle_tasks): Update creation of
15355         Allocate_commons_task to not pass options.
15356         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15357         (TLS_TEST_C_FLAGS): New variable.
15358         (tls_test_c_pic.o): New target.
15359         (tls_test_shared.so): Link in tls_test_c_pic.o.
15360         (tls_test_c_pic_ie.o): New target.
15361         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15362         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15363         (tls_test_c.o): New target.
15364         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15365         (tls_pic_test_LDADD): Likewise.
15366         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15367         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15368         (tls_test_c_gnu2.o): New target.
15369         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15370         tls_test_c_gnu2.o.
15371         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15372         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15373         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15374         * testsuite/tls_test.cc: Include "config.h".
15375         (t_last): Call t11_last.
15376         * testsuite/tls_test.h (t11, t11_last): Declare.
15377         * testsuite/tls_test_c.c: New file.
15378         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15379         * configure.ac: Check for OpenMP support.
15380         * configure, config.in, Makefile.in: Rebuild.
15381         * testsuite/Makefile.in: Rebuild.
15382
15383 2008-04-16  Cary Coutant  <ccoutant@google.com>
15384
15385         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15386         (Target_i386::tls_base_symbol_defined_): New field.
15387         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15388         (Target_i386::Scan::global): Likewise.
15389         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15390         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15391         (Target_x86_64::tls_base_symbol_defined_): New field.
15392         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15393         (Target_x86_64::Scan::global): Likewise.
15394
15395 2008-04-16  Cary Coutant  <ccoutant@google.com>
15396
15397         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15398         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15399         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15400         building shared libraries.
15401         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15402         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15403         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15404         * testsuite/Makefile.in: Rebuild.
15405         * testsuite/weak_undef.h: New file.
15406         * testsuite/weak_undef_file1.cc: Add extra test cases.
15407         * testsuite/weak_undef_file2.cc: Likewise.
15408         * testsuite/weak_undef_test.cc: Likewise.
15409
15410 2008-04-16  David S. Miller  <davem@davemloft.net>
15411
15412         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15413         Add issued_non_pic_error_ field.  Declare check_non_pic.
15414         (Target_sparc::Scan::check_non_pic): New function.
15415         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15416         (Target_sparc::Scan::global): Likewise.
15417
15418         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15419         * configure: Rebuild.
15420
15421         * options.h (DEFINE_enable): New macro.
15422         (new_dtags): New enable option.
15423         (initfirst, interpose, loadfltr, nodefaultlib,
15424         nodelete, nodlopen, nodump): New -z options.
15425         * layout.cc (Layout:finish_dynamic_section): If new
15426         dtags enabled, emit DT_RUNPATH.  Also, emit a
15427         DT_FLAGS_1 containing any specified -z flags.
15428
15429 2008-04-16  Ian Lance Taylor  <iant@google.com>
15430
15431         * copy-relocs.cc: New file.
15432         * copy-relocs.h: New file.
15433         * reloc.cc: Remove Copy_relocs code.
15434         * reloc.h: Likewise.
15435         * reloc-types.h (struct Reloc_types) [both versions]: Add
15436         get_reloc_addend_noerror.
15437         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15438         variants of add_global which take an addend which must be zero.
15439         * i386.cc: Include "copy-relocs.h".
15440         (class Target_i386): Change type of copy_relocs_ to variable,
15441         update initializer.
15442         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15443         Change all callers.
15444         (Target_i386::do_finalize_sections): Change handling of
15445         copy_relocs_.
15446         * sparc.cc: Include "copy-relocs.h".
15447         (class Target_sparc): Change type of copy_relocs_ to variable,
15448         update initializer.
15449         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15450         Change all callers.
15451         (Target_sparc::do_finalize_sections): Change handling of
15452         copy_relocs_.
15453         * x86_64.cc: Include "copy-relocs.h".
15454         (class Target_x86_64): Change type of copy_relocs_ to variable,
15455         update initializer.
15456         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15457         class.  Change all callers.
15458         (Target_x86_64::do_finalize_sections): Change handling of
15459         copy_relocs_.
15460         * Makefile.am (CCFILES): Add copy-relocs.cc.
15461         (HFILES): Add copy-relocs.h.
15462
15463         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15464
15465         * testsuite/script_test_4.sh: Permit leading zeroes.
15466
15467 2008-04-15  Ian Lance Taylor  <iant@google.com>
15468
15469         * script-sections.cc (Script_sections::create_segments): Use
15470         header_size_adjustment even when there is enough room for the
15471         headers.
15472         * testsuite/script_test_4.sh: New file.
15473         * testsuite/script_test_4.t: New file.
15474         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15475         (check_DATA): Add script_test_4.stdout.
15476         (MOSTLYCLEANFILES): Likewise.
15477         (script_test_4): New target.
15478         (script_test_4.stdout): New target.
15479         * testsuite/Makefile.in: Rebuild.
15480
15481         * sparc.cc: Add definitions for Output_data_plt_sparc class
15482         constants.
15483
15484 2008-04-14  David S. Miller  <davem@davemloft.net>
15485
15486         * sparc.cc: New file.
15487         * Makefile.am (TARGETSOURCES): Add sparc.cc
15488         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15489         * configure.tgt: Document targ_extra_size and
15490         targ_extra_big_endian.  Add entries for sparc-* and
15491         sparc64-*.
15492         * configure.ac: Handle targ_extra_size and
15493         targ_extra_big_endian.
15494         * Makefile.in: Rebuild.
15495         * configure: Likewise.
15496         * po/POTFILES.in: Likewise.
15497         * po/gold.pot: Likewise.
15498
15499 2008-04-14  Ian Lance Taylor  <iant@google.com>
15500
15501         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15502         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15503         in the name/type/flags to section mapping.  Don't call
15504         allocate_output_section.
15505         (Layout::choose_output_section): Change parameter from adjust_name
15506         to is_input_section.  Don't permit input sections after sections
15507         are attached to segments.  Don't call allocate_output_section.
15508         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15509         not write_enable_output_section.
15510         (Layout::make_output_section): Don't push to
15511         unattached_section_list_ nor call attach_to_segment.  Call
15512         attach_section_to_segment if sections are attached.
15513         (Layout::attach_sections_to_segments): New function.
15514         (Layout::attach_section_to_segment): New function.
15515         (Layout::attach_allocated_section_to_segment): Rename from
15516         attach_to_segment.  Remove flags parameter.
15517         (Layout::allocate_output_section): Remove function.
15518         (Layout::write_enable_output_section): Remove function.
15519         * layout.h (class Layout): Update for above changes.  Add new
15520         field sections_are_attached_.
15521         * output.h (Output_section::update_flags_for_input_section): New
15522         function.
15523         * output.cc (Output_section::add_input_section): Call
15524         update_flags_for_input_section.
15525         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15526
15527 2008-04-11  Cary Coutant  <ccoutant@google.com>
15528
15529         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15530         thought unnecessary.
15531         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15532
15533 2008-04-11  Ian Lance Taylor  <iant@google.com>
15534
15535         * output.h (class Output_section_data): Remove inline definition
15536         of set_addralign.
15537         * output.cc (Output_section_data::set_addralign): New function.
15538
15539 2008-04-11  Cary Coutant  <ccoutant@google.com>
15540
15541         Add support for TLS descriptors for i386 and x86_64.
15542         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15543         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15544         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15545         GOT_TYPE_TLS_DESC.
15546         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15547         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15548         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15549         relocations.
15550         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15551         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15552         Fix problem with initial-exec relocations.
15553         (Target_i386::Relocate::relocate_tls): Likewise.
15554         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15555         relaxation.
15556         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15557         support for section-plus-offset dynamic table entries.
15558         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15559         (Output_data_dynamic::Dynamic_entry): Add support for
15560         section-plus-offset dynamic table entries.
15561         (Output_data_dynamic::Classification): Likewise.
15562         (Output_data_dynamic::classification_): Renamed offset_.
15563         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15564         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15565         (Target_x86_64::make_plt_section): New function.
15566         (Target_x86_64::reserve_tlsdesc_entries): New function.
15567         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15568         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15569         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15570         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15571         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15572         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15573         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15574         add extra PLT entry for TLS descriptors.
15575         (Output_data_plt_x86_64::got_): New field.
15576         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15577         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15578         fields.
15579         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15580         descriptors.
15581         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15582         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15583         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15584         R_386_TLS_DESC_CALL relocations.
15585         (Target_x86_64::Scan::global): Likewise.
15586         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15587         for TLS descriptors.
15588         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15589         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15590         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15591         GD-to-IE relaxation.
15592         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15593         and TLS_DESCRIPTORS.
15594         * Makefile.in: Rebuild.
15595         * configure: Rebuild.
15596         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15597         (tls_test_shared2.so): New target.
15598         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15599         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15600         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15601         (tls_shared_gd_to_ie_test_LDADD): New variable.
15602         (tls_shared_gnu2_gd_to_ie_test): New target.
15603         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15604         New targets.
15605         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15606         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15607         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15608         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15609         (tls_shared_gnu2_test): New target.
15610         (tls_test_gnu2_shared.so): New target.
15611         (tls_shared_gnu2_test_SOURCES): New variable.
15612         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15613         (tls_shared_gnu2_test_LDFLAGS): New variable.
15614         (tls_shared_gnu2_test_LDADD): New variable.
15615         * testsuite/Makefile.in: Rebuild.
15616         * testsuite/Makefile.
15617
15618 2008-04-11  Ian Lance Taylor  <iant@google.com>
15619
15620         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15621         justsyms.t.
15622         * testsuite/Makefile.in: Rebuild.
15623
15624         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15625         long.
15626         * testsuite/script_test_2.cc (main): Adjust test.
15627
15628 2008-04-11  David S. Miller  <davem@davemloft.net>
15629             Ian Lance Taylor  <iant@google.com>
15630
15631         * options.h (General_options): Add entries for '-Y' and
15632         '-relax'.
15633         * options.cc (General_options:finalize): If -Y was used, add those
15634         entries to the library path instead of the default "/lib" and
15635         "/usr/lib".
15636
15637 2008-04-11  David S. Miller  <davem@davemloft.net>
15638
15639         * testsuite/justsyms.t: Start at 0x100.
15640         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15641         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15642         long.
15643         * testsuite/script_test_2.cc: Adjust string and section length
15644         checks.
15645
15646 2008-04-09  Ian Lance Taylor  <iant@google.com>
15647
15648         PR gold/5996
15649         * script-sections.cc (Sections_element::allocate_to_segment): Add
15650         orphan parameter.
15651         (Output_section_definition::allocate_to_segment): Likewise.
15652         (Orphan_output_section::allocate_to_segment): Likewise.
15653         (Script_sections::attach_sections_using_phdrs_clause): Don't
15654         propagate non-PT_LOAD segments to orphan sections.
15655         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15656         readelf rather than objdump.
15657         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15658         .interp section and PT_INTERP segment are the same size.
15659         * testsuite/Makefile.in: Rebuild.
15660
15661         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15662         aliases for symbols defined in the same object.
15663         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15664         (weak_alias_test_SOURCES): New variable.
15665         (weak_alias_test_DEPENDENCIES): New variable.
15666         (weak_alias_test_LDFLAGS): New variable.
15667         (weak_alias_test_LDADD): New variable.
15668         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15669         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15670         (weak_alias_test_3.o): New target.
15671         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15672         * testsuite/weak_alias_test_main.cc: New file.
15673         * testsuite/weak_alias_test_1.cc: New file.
15674         * testsuite/weak_alias_test_2.cc: New file.
15675         * testsuite/weak_alias_test_3.cc: New file.
15676
15677 2008-04-08  Ian Lance Taylor  <iant@google.com>
15678
15679         * options.h (class General_options): Add --noinhibit-exec option.
15680         * main.cc (main): Check --noinhibit-exec.
15681
15682         * options.h (class General_options): Define --wrap as a special
15683         option.  Add wrap_symbols_ field.
15684         (General_options::any_wrap_symbols): New function.
15685         (General_options::is_wrap_symbol): New function.
15686         * options.cc (General_options::parse_wrap): New function.
15687         (General_options::General_options): Initialize wrap_symbols_.
15688         * symtab.cc (Symbol_table::wrap_symbol): New function.
15689         (Symbol_table::add_from_object): Handle --wrap.
15690         * symtab.h (class Symbol_table): Declare wrap_symbol.
15691         * target.h (Target::wrap_char): New function.
15692         (Target::Target_info): Add wrap_char field.
15693         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15694         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15695         * testsuite/testfile.cc (Target_test::test_target_info):
15696         Likewise.
15697
15698         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15699         there is one.
15700
15701         * layout.h (class Layout): Add added_eh_frame_data_ field.
15702         * layout.cc (Layout::Layout): Initialize new field.
15703         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15704         output section until we find a section we merged successfully.
15705         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15706         that the size be non-zero.
15707
15708         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15709         qualifier.
15710
15711 2008-04-08  Craig Silverstein  <csilvers@google.com>
15712
15713         * configure.ac: Export new conditional variable HAVE_ZLIB.
15714         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15715         on HAVE_ZLIB.
15716         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15717         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15718
15719 2008-04-07  Ian Lance Taylor  <iant@google.com>
15720
15721         * version.cc (version_string): Set to "1.5".
15722
15723         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15724         Add issued_non_pic_error_ field.  Declare check_non_pic.
15725         (Target_x86_64::Scan::check_non_pic): New function.
15726         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15727         (Target_x86_64::Scan::global): Likewise.
15728
15729         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15730         addend parameter.  Change caller.  Handle merge sections.
15731         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15732         Address to Addend.  Don't add in the result of
15733         local_section_offset, pass down the addend and use the returned
15734         value.
15735         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15736         Update declarations of local_section_offset and symbol_value.
15737         * testsuite/two_file_test_1.cc (t18): New function.
15738         * testsuite/two_file_test_2.cc (f18): New function.
15739         * testsuite/two_file_test_main.cc (main): Call t18.
15740         * testsuite/two_file_test.h (t18, f18): Declare.
15741
15742         * configure.ac: Don't test for objdump, c++filt, or readelf.
15743         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15744         conditionals.
15745         (TEST_READELF): New variable.
15746         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15747         (check_PROGRAMS): Add two_file_strip_test.
15748         (two_file_strip_test): New target.
15749         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15750         (two_file_same_shared_strip_test_SOURCES): New variable.
15751         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15752         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15753         (two_file_same_shared_strip_test_LDADD): New variable.
15754         (two_file_shared_strip.so): New target.
15755         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15756         (ver_test_5.syms, ver_test_7.syms): Likewise.
15757         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15758         (strip_test_3.stdout): Use TEST_OBJDUMP.
15759         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15760
15761 2008-04-04  Cary Coutant  <ccoutant@google.com>
15762
15763         * symtab.h (Symbol::is_weak_undefined): New function.
15764         (Symbol::is_strong_undefined): New function.
15765         (Symbol::is_absolute): New function.
15766         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15767         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15768         absolute symbols.
15769         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15770         (weak_undef_test): New target.
15771         * testsuite/Makefile.in: Rebuild.
15772         * testsuite/weak_undef_file1.cc: New file.
15773         * testsuite/weak_undef_file2.cc: New file.
15774         * testsuite/weak_undef_test.cc: New file.
15775
15776 2008-04-03  Craig Silverstein  <csilvers@google.com>
15777
15778         * compressed_output.h (class Output_compressed_section): Use
15779         unsigned buffer.
15780         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15781         add zlib header.
15782         (zlib_compressed_suffix): Removed.
15783         (Output_compressed_section::set_final_data_size): Use unsigned
15784         buffers.
15785         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15786         Fix linker invocation.
15787         (flagstest_o_specialfile_and_compress_debug_sections):
15788         Likewise.
15789         * testsuite/Makefile.in: Regenerated.
15790
15791 2008-04-02  David S. Miller  <davem@davemloft.net>
15792
15793         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15794         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15795
15796 2008-04-02  Craig Silverstein  <csilvers@google.com>
15797
15798         * TODO: New file.
15799
15800 2008-04-02  Ian Lance Taylor  <iant@google.com>
15801
15802         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15803         parameters.  Update for new key type to views_.  Change all
15804         callers.
15805         (File_read::read): Adjust for byteshift in returned view.
15806         (File_read::add_view): New function, broken out of
15807         find_and_make_view.
15808         (File_read::make_view): New function, broken out of
15809         find_and_make_view.
15810         (File_read::find_or_make_view): Add offset and aligned
15811         parameters.  Rewrite accordingly.  Change all callers.
15812         (File_read::get_view): Add offset and aligned parameters.  Adjust
15813         for byteshift in return value.
15814         (File_read::get_lasting_view): Likewise.
15815         * fileread.h (class File_read): Update declarations.
15816         (class File_read::View): Add byteshift_ field.  Add byteshift to
15817         constructor.  Add byteshift method.
15818         * archive.h (Archive::clear_uncached_views): New function.
15819         (Archive::get_view): Add aligned parameter.  Change all callers.
15820         * object.h (Object::get_view): Add aligned parameter.  Change all
15821         callers.
15822         (Object::get_lasting_view): Likewise.
15823
15824         * fileread.cc (File_read::release): Don't call clear_views if
15825         there are multiple objects.
15826         * fileread.h (File_read::clear_uncached_views): New function.
15827         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15828         on the archive.
15829
15830 2008-03-31  Cary Coutant  <ccoutant@google.com>
15831
15832         Add thin archive support.
15833         * archive.cc (Archive::armagt): New const.
15834         (Archive::setup): Remove task parameter and calls to unlock.
15835         (Archive::unlock_nested_archives): New function.
15836         (Archive::read_header): Add nested_off parameter. Change
15837         all callers.
15838         (Archive::interpret_header): Likewise.
15839         (Archive::include_all_members): Change to handle thin
15840         archives.
15841         (Archive::include_member): Likewise.
15842         * archive.h (Archive::Archive): Add new parameters and
15843         initializers.
15844         (Archive::armagt): New const.
15845         (Archive::setup): Remove task parameter.
15846         (Archive::unlock_nested_archives): New function.
15847         (Archive::read_header): Add nested_off parameter.
15848         (Archive::interpret_header): Likewise.
15849         (Archive::Nested_archive_table): New typedef.
15850         (Archive::is_thin_archive_): New field.
15851         (Archive::nested_archives_): New field.
15852         (Archive::options_): New field.
15853         (Archive::dirpath_): New field.
15854         (Archive::task_): New field.
15855         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15856         for thin archives.  Pass additional parameters to
15857         Archive::Archive.  Unlock the archive file after calling
15858         Archive::setup.
15859
15860 2008-03-29  Ian Lance Taylor  <iant@google.com>
15861
15862         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15863         version symbol to be local.
15864         * testsuite/ver_test_4.sh: New file.
15865         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15866         (check_DATA): Add ver_test_4.syms.
15867         (ver_test_4.syms): New target.
15868         * testsuite/Makefile.in: Rebuild.
15869
15870         * output.cc
15871         (Output_section::Input_section_sort_entry::has_priority): New
15872         function.
15873         (Output_section::Input_section_sort_entry::match_file_name): New
15874         function.
15875         (Output_section::Input_section_sort_entry::match_section_name):
15876         Remove.
15877         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15878         Remove.
15879         (Output_section::Input_section_sort_entry::match_section_file):
15880         Remove.
15881         (Output_section::Input_section_sort_compare::operator()): Rewrite
15882         using new Input_section_sort_entry functions.  Sort crtbegin and
15883         crtend first.  Sort sections with no priority before sections with
15884         a priority.
15885         * testsuite/initpri1.c (d3): Check j != 4.
15886         (cd5): New constructor/destructor function.
15887         (main): Check j != 2.
15888
15889         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15890         new symbol when resolving, don't call set_is_default.
15891         * testsuite/ver_test_7.cc: New file.
15892         * testsuite/ver_test_7.sh: New file.
15893         * testsuite/Makefile.am (ver_test_7.so): New target.
15894         (ver_test_7.o): New target.
15895         (check_SCRIPTS): Add ver_test_7.sh.
15896         (check_DATA): Add ver_test_7.syms.
15897         (ver_test_7.syms): New target.
15898
15899 2008-03-28  Ian Lance Taylor  <iant@google.com>
15900
15901         * layout.cc (Layout::layout): If we see an input section with a
15902         name that needs sorting, set the must_sort flag for the output
15903         section.
15904         (Layout::make_output_section): If the name of the output section
15905         indicates that it might require sorting, set the may_sort flag.
15906         * output.h (Output_section::may_sort_attached_input_sections): New
15907         function.
15908         (Output_section::set_may_sort_attached_input_sections): New
15909         function.
15910         (Output_section::must_sort_attached_input_sections): New
15911         function.
15912         (Output_section::set_must_sort_attached_input_sections): New
15913         function.
15914         (class Output_section): Declare Input_section_sort_entry.  Define
15915         Input_section_sort_compare.  Declare
15916         sort_attached_input_sections.  Add new fields:
15917         may_sort_attached_input_sections_,
15918         must_sort_attached_input_sections_,
15919         attached_input_sections_are_sorted_.
15920         * output.cc (Output_section::Output_section): Initialize new
15921         fields.
15922         (Output_section::add_input_section): Add an entry to
15923         input_sections_ if may_sort or must_sort are true.
15924         (Output_section::set_final_data_size): Call
15925         sort_attached_input_sections if necessary.
15926         (Output_section::Input_section_sort_entry): Define new class.
15927         (Output_section::Input_section_sort_compare::operator()): New
15928         function.
15929         (Output_section::sort_attached_input_sections): New function.
15930         * configure.ac: Check whether the compiler supports constructor
15931         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15932         * testsuite/initpri1.c: New file.
15933         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15934         CONSTRUCTOR_PRIORITY.
15935         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15936         (initpri1_LDFLAGS): New variable.
15937         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15938
15939 2008-03-27  Ian Lance Taylor  <iant@google.com>
15940
15941         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15942         * testsuite/common_test_1.c: New file.
15943         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15944         (common_test_1_SOURCES): New variable.
15945         (common_test_1_DEPENDENCIES): New variable.
15946         (common_test_1_LDFLAGS): New variable.
15947
15948         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15949         and commons_ correctly when NAME/VERSION does not override
15950         NAME/NULL.
15951         * testsuite/ver_test_6.c: New file.
15952         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15953         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15954         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15955
15956 2008-03-26  Ian Lance Taylor  <iant@google.com>
15957
15958         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15959         of an undefined symbol from a version script.
15960         * testsuite/Makefile.am (ver_test_5.so): New target.
15961         (ver_test_5.o): New target.
15962         (check_SCRIPTS): Add ver_test_5.sh.
15963         (check_DATA): Add ver_test_5.syms.
15964         (ver_test_5.syms): New target.
15965         * testsuite/ver_test_5.cc: New file.
15966         * testsuite/ver_test_5.script: New file.
15967         * testsuite/ver_test_5.sh: New file.
15968         * Makefile.in, testsuite/Makefile.in: Rebuild.
15969
15970         PR gold/5986
15971         Fix problems building gold with gcc 4.3.0.
15972         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15973         (gold_error_at_location, gold_warning_at_location): Use it.
15974         * configure.ac: Check whether we can compile and use a template
15975         function with a printf attribute.
15976         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15977         when jumping over bytes.
15978         * object.cc: Instantiate Object::read_section_data.
15979         * debug.h: Include <cstring>
15980         * dwarf_reader.cc: Include <algorithm>
15981         * main.cc: Include <cstring>.
15982         * options.cc: Include <cstring>.
15983         * output.cc: Include <cstring>.
15984         * script.cc: Include <cstring>.
15985         * script.h: Include <string>.
15986         * symtab.cc: Include <cstring> and <algorithm>.
15987         * target-select.cc: Include <cstring>.
15988         * version.cc: Include <string>.
15989         * testsuite/testmain.cc: Include <cstdlib>.
15990         * configure, config.in: Rebuild.
15991
15992 2008-03-25  Ian Lance Taylor  <iant@google.com>
15993
15994         * options.cc: Include "../bfd/bfdver.h".
15995         (options::help): Print bug reporting address.
15996
15997         * version.cc (print_version): Adjust output for current value of
15998         BFD_VERSION_STRING.
15999
16000         * NEWS: New file.
16001
16002         * options.cc (options::help): Print list of supported targets.
16003         * target-select.h: Include <vector>.
16004         (class Target_selector): Make machine_, size_, and is_big_endian_
16005         fields const.  Add bfd_name_ and instantiated_target_ fields.
16006         (Target_selector::Target_selector): Add bfd_name parameter.
16007         (Target_selector::recognize): Make non-virtual, call
16008         do_recognize.
16009         (Target_selector::recognize_by_name): Make non-virtual, call
16010         do_recognize_by_name.
16011         (Target_selector::supported_names): New function.
16012         (Target_selector::bfd_name): New function.
16013         (Target_selector::do_instantiate_target): New pure virtual
16014         function.
16015         (Target_selector::do_recognize): New virtual function.
16016         (Target_selector::do_recognize_by_name): New virtual function.
16017         (Target_selector::instantiate_target): New private function.
16018         (supported_target_names): Declare.
16019         * target-select.cc (Target_selector::Target_selector): Update for
16020         new parameter and fields.
16021         (select_target_by_name): Check that the name matches before
16022         calling recognize_by_name.
16023         (supported_target_names): New function.
16024         * i386.cc (class Target_selector_i386): Update Target_selector
16025         constructor call.  Remove recognize and recognize_by_name.  Add
16026         do_instantiate_target.
16027         * x86_64.cc (class Target_selector_x86_64): Likewise.
16028         * testsuite/testfile.cc (class Target_selector_test): Update for
16029         changes to Target_selector.
16030
16031         * README: Rewrite, with some notes on unsupported features.
16032
16033 2008-03-24  Cary Coutant  <ccoutant@google.com>
16034
16035         * i386.cc (Target_i386::Got_type): New enum declaration.
16036         (Target_i386::Scan::local): Updated callers of Output_data_got
16037         member functions.
16038         (Target_i386::Scan::global): Likewise.
16039         (Target_i386::Relocate::relocate): Likewise.
16040         (Target_i386::Relocate::relocate_tls): Likewise.
16041         * object.h (Got_offset_list): New class.
16042         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16043         (Sized_relobj::local_got_offset): Likewise.
16044         (Sized_relobj::set_local_got_offset): Likewise.
16045         (Sized_relobj::local_has_tls_got_offset): Removed.
16046         (Sized_relobj::local_tls_got_offset): Removed.
16047         (Sized_relobj::set_local_tls_got_offset): Removed.
16048         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16049         * output.cc (Output_data_got::add_global): Added got_type parameter.
16050         (Output_data_got::add_global_with_rel): Likewise.
16051         (Output_data_got::add_global_with_rela): Likewise.
16052         (Output_data_got::add_global_pair_with_rel): New function.
16053         (Output_data_got::add_global_pair_with_rela): New function.
16054         (Output_data_got::add_local): Added got_type parameter.
16055         (Output_data_got::add_local_with_rel): Likewise.
16056         (Output_data_got::add_local_with_rela): Likewise.
16057         (Output_data_got::add_local_pair_with_rel): New function.
16058         (Output_data_got::add_local_pair_with_rela): New function.
16059         (Output_data_got::add_global_tls): Removed.
16060         (Output_data_got::add_global_tls_with_rel): Removed.
16061         (Output_data_got::add_global_tls_with_rela): Removed.
16062         (Output_data_got::add_local_tls): Removed.
16063         (Output_data_got::add_local_tls_with_rel): Removed.
16064         (Output_data_got::add_local_tls_with_rela): Removed.
16065         * output.h (Output_data_got::add_global): Added got_type parameter.
16066         (Output_data_got::add_global_with_rel): Likewise.
16067         (Output_data_got::add_global_with_rela): Likewise.
16068         (Output_data_got::add_global_pair_with_rel): New function.
16069         (Output_data_got::add_global_pair_with_rela): New function.
16070         (Output_data_got::add_local): Added got_type parameter.
16071         (Output_data_got::add_local_with_rel): Likewise.
16072         (Output_data_got::add_local_with_rela): Likewise.
16073         (Output_data_got::add_local_pair_with_rel): New function.
16074         (Output_data_got::add_local_pair_with_rela): New function.
16075         (Output_data_got::add_global_tls): Removed.
16076         (Output_data_got::add_global_tls_with_rel): Removed.
16077         (Output_data_got::add_global_tls_with_rela): Removed.
16078         (Output_data_got::add_local_tls): Removed.
16079         (Output_data_got::add_local_tls_with_rel): Removed.
16080         (Output_data_got::add_local_tls_with_rela): Removed.
16081         * resolve.cc (Symbol::override_base_with_special): Removed
16082         reference to has_got_offset_ field.
16083         * symtab.cc (Symbol::init_fields): Replaced initialization
16084         of got_offset_ with got_offsets_.  Removed initialization
16085         of has_got_offset_
16086         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16087         (Symbol::got_offset): Likewise.
16088         (Symbol::set_got_offset): Likewise.
16089         (Symbol::has_tls_got_offset): Removed.
16090         (Symbol::tls_got_offset): Removed.
16091         (Symbol::set_tls_got_offset): Removed.
16092         (Symbol::got_offset_): Removed.
16093         (Symbol::tls_mod_got_offset_): Removed.
16094         (Symbol::tls_pair_got_offset_): Removed.
16095         (Symbol::got_offsets_): New field.
16096         (Symbol::has_got_offset): Removed.
16097         (Symbol::has_tls_mod_got_offset): Removed.
16098         (Symbol::has_tls_pair_got_offset): Removed.
16099         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16100         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16101         member functions.
16102         (Target_x86_64::Scan::global): Likewise.
16103         (Target_x86_64::Relocate::relocate): Likewise.
16104         (Target_x86_64::Relocate::relocate_tls): Likewise.
16105
16106 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16107
16108         * yyscript.y: Fix spelling error in comment.
16109
16110 2008-03-24  Ian Lance Taylor  <iant@google.com>
16111
16112         * options.h (class General_options): Define build_id option.
16113         * layout.h (class Layout): Declare write_build_id, create_note,
16114         create_build_id.  Add build_id_note_ member.
16115         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16116         "libiberty.h", "md5.h", "sha1.h".
16117         (Layout::Layout): Initialize eh_frame_data_,
16118         eh_frame_hdr_section_, and build_id_note_.
16119         (Layout::finalize): Call create_build_id.
16120         (Layout::create_note): New function, broken out of
16121         Layout::create_gold_note.
16122         (Layout::create_gold_note): Call create_note.
16123         (Layout::create_build_id): New function.
16124         (Layout::write_build_id): New function.
16125         (Close_task_runner::run): Call write_build_id.
16126
16127         * x86_64.cc: Correct license to GPLv3.
16128
16129 2008-03-23  Ian Lance Taylor  <iant@google.com>
16130
16131         * options.cc: Include "demangle.h".
16132         (parse_optional_string): New function.
16133         (parse_long_option): Handle takes_optional_argument.
16134         (parse_short_option): Update dash_z initializer.  Handle
16135         takes_optional_argument.
16136         (General_options::General_options): Initialize do_demangle_.
16137         (General_options::finalize): Set do_demangle_.  Handle demangling
16138         style.
16139         * options.h (parse_optional_string): Declare.
16140         (struct One_option): Add optional_arg field.  Update constructor.
16141         Update call constructor calls.  Add takes_optional_argument
16142         function.
16143         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16144         (DEFINE_optional_string): Define.
16145         (General_options::demangle): Change from DEFINE_bool to
16146         DEFINE_optional_string.
16147         (General_options::no_demangle): New function.
16148         (General_options::do_demangle): New function.
16149         (General_options::set_do_demangle): New function.
16150         (General_options::execstack_status_): Move definition to end of
16151         class definition.
16152         (General_options::static_): Likewise.
16153         (General_options::do_demangle_): New field.
16154         * object.cc (big_endian>::get_symbol_location_info): Call
16155         Options::do_demangle, not Options::demangle.
16156         * symtab.cc (demangle): Likewise.
16157
16158 2008-03-22  Ian Lance Taylor  <iant@google.com>
16159
16160         * gold.h: Include <cstddef> and <sys/types.h>
16161         * options.h: Include <cstring>.
16162
16163 2008-03-21  Ian Lance Taylor  <iant@google.com>
16164
16165         * Added source code to GNU binutils.
16166 \f
16167 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16168
16169 Copying and distribution of this file, with or without modification,
16170 are permitted in any medium without royalty provided the copyright
16171 notice and this notice are preserved.
16172
16173 Local Variables:
16174 mode: change-log
16175 left-margin: 8
16176 fill-column: 74
16177 version-control: never
16178 End: