884feb8a131fa8f27ea133494598afc83238c9a7
[external/binutils.git] / gold / ChangeLog
1 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
2
3         * options.h (--pic-executable): Add negative to alias to -no-pie.
4
5 2014-09-26  Cary Coutant  <ccoutant@google.com>
6
7         PR gold/16773
8         * object.cc (Sized_relobj_file): Compute value of section symbols
9         for TLS sections the same as TLS symbols.
10
11 2014-09-25  Cary Coutant  <ccoutant@google.com>
12
13         PR gold/17432
14         * resolve.cc (Symbol_table::resolve): Override common placeholder
15         symbols, but adjust sizes.
16         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
17         symbols to common lists.
18
19 2014-09-24  Alan Modra  <amodra@gmail.com>
20
21         * po/POTFILES.in: Regenerate.
22
23 2014-09-23  Taiju Tsuiki  <tzik@google.com>
24             Cary Coutant  <ccoutant@google.com>
25
26         PR gold/14860
27         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
28         on input_sections_blocker.
29         * layout.cc (Write_sections_task::locks): Unblock
30         input_sections_blocker_.
31         * layout.h (Write_sections_task::Write_sections_task): Add
32         input_sections_blocker.
33         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
34         to DEPENDENCIES.
35         * testsuite/Makefile.in: Regenerate.
36
37 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
38
39         * testsuite/Makefile.am (plugin_test_10): New test.
40         * testsuite/Makefile.in: Regenerate
41         * testsuite/plugin_common_test_2.c (c1): Align to 8.
42         * testsuite/plugin_test_10.sh: New file.
43
44 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
45
46         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
47         * resolve.cc (Symbol_table::resolve): Don't override common symbols
48         during the replacement phase.
49
50 2014-09-17  Han Shen  <shenhan@google.com>
51             Jing Yu  <jingyu@google.com>
52
53         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
54         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
55         * aarch64.cc (Target_aarch64): Add data members
56         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
57         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
58         constructor.
59         (Target_aarch64::do_reloc_symbol_index): New method.
60         (Target_aarch64::do_reloc_addend): New method.
61         (Target_aarch64::add_tlsdesc_info): New method.
62         (Target_aarch64::do_dynsym_value): New method.
63         (Target_aarch64::do_make_data_plt): Add new parameters: got,
64         got_irelative. Pass them to Output_data_plt_aarch64_standard.
65         (Target_aarch64::make_data_plt): Add new parameters: got,
66         got_irelative. Pass them to do_make_data_plt.
67         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
68         (Target_aarch64::Relocate:tls_gd_to_le): New method.
69         (Target_aarch64::Relocate:tls_ie_to_le): New method.
70         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
71         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
72         (Target_aarch64::got_tlsdesc_section): New method.
73         (Target_aarch64::make_local_ifunc_plt_entry): New method.
74         (Target_aarch64::define_tls_base_symbol): New method.
75         (Target_aarch64::reserve_tlsdesc_entries): New method.
76         (Target_aarch64::got_mod_index_entry): New method.
77         (Target_aarch64::rela_tlsdesc_section): New method.
78         (Target_aarch64::rela_irelative_section): New method.
79         (Target_aarch64::Tlsdesc_info): New struct.
80         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
81         relocations and tlsdesc relocations.
82         (Target_aarch64::optimize_tls_reloc): Implement method.
83         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
84         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
85         in constructor.
86         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
87         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
88         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
89         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
90         (Output_data_plt_aarch64::rela_tlsdesc): New method.
91         (Output_data_plt_aarch64::rela_irelative): New method.
92         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
93         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
94         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
95         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
96         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
97         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
98         (Output_data_plt_aarch64_standard): New member variables:
99         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
100         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
101         New parameter: got, got_irelative.
102         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
103         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
104         (Output_data_plt_aarch64::do_write): Replace got_address with
105         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
106         (AArch64_relocate_functions::update_movnz): New method.
107         (AArch64_relocate_functions): Correct format.
108         (AArch64_relocate_functions::movnz): New method.
109         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
110         before the switch. Add new cases to switch.
111         Check ie_to_le relaxation on tlsie relocations. Add code handling
112         tlsgd tlsdesc cases.
113         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
114         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
115         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
116         Call reloc_name_in_error_message to print unsupported reloc.
117         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
118         make_data_plt.
119         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
120         relocs. Fill in some more dynamic tags.
121         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
122         Skip call tls_get_addr when tlsgd is relaxed.
123         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
124         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
125         tlsdesc->ie relaxation.
126
127 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
128
129         * mips.cc (Target_mips_nacl): New class.
130         (Target_selector_mips_nacl): New class.
131         (target_selector_mips32): Rename from target_selector_mips32be and use
132         Target_selector_mips_nacl instead of Target_selector_mips.
133         (target_selector_mips32el): Rename from target_selector_mips32 and use
134         Target_selector_mips_nacl instead of Target_selector_mips.
135         (target_selector_mips64): Rename from target_selector_mips64be and use
136         Target_selector_mips_nacl instead of Target_selector_mips.
137         (target_selector_mips64el): Rename from target_selector_mips64 and use
138         Target_selector_mips_nacl instead of Target_selector_mips.
139         (Target_mips::mips_info): Add const attribute.
140
141 2014-09-02  Cary Coutant  <ccoutant@google.com>
142
143         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
144         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
145         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
146         (Sized_incr_dynobj::do_section_name): Likewise.
147         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
148         (Sized_incr_dynobj::do_section_name): Likewise.
149         * object.h (Object::section_name): Likewise.
150         (Object::do_section_name): Likewise.
151         (Sized_relobj_file::do_section_name): Likewise.
152         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
153         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
154
155 2014-09-02  Cary Coutant  <ccoutant@google.com>
156
157         PR gold/17005
158         * ehframe.cc (Fde::write): Add output_offset parameter.
159         (Cie::write): Likewise.
160         (Eh_frame::set_final_data_size): Account for offset within output
161         section.
162         (Eh_frame::do_sized_write): Likewise.
163         * ehframe.h (Fde::write): Add output_offset parameter.
164         (Cie::write): Likewise.
165         * output.cc (Output_section::Input_section_sort_entry): Remove
166         section_has_name_; add output_section_name parameter. Use
167         output section name for non-input sections.
168         (Output_section::Input_section_sort_entry::section_has_name): Remove.
169         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
170         (Output_section::Input_section_sort_compare): Remove logic for
171         sections without names.
172         (Output_section::Input_section_sort_init_fini_compare): Likewise.
173         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
174         Likewise.
175         (Output_section::Input_section_sort_section_name_compare): Likewise.
176
177 2014-08-29 Han Shen <shenhan@google.com>
178            Jing Yu <jingyu@google.com>
179
180         * aarch64-reloc-property.cc
181         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
182         reference reloc property in the table.
183         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
184         3 other entries.
185         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
186         2 new overloaded methods.
187         (Output_data_got_aarch64::do_write): Add code to write out
188         static relocs.
189         (class Output_data_got_aarch64::Static_reloc): New class to wrap
190         static relocs.
191         (Output_data_got_aarch64::static_relocs): New vector to
192         hold static relocs.
193         (Target_aarch64::TCB_SIZE): New const static memeber.
194         (Target_aarch64::tcb_size): New method.
195         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
196         (Target_aarch64::Relocate::relocate_tls): New method.
197         (Target_aarch64::Scan::local): Add code handling new reloc types.
198         (Target_aarch64::Scan::global): Add code handling new reloc types.
199
200 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
201
202         * options.h (-no-pie): Add option.
203
204 2014-08-08  Jing Yu  <jingyu@google.com>
205             Han Shen  <shenhan@google.com>
206
207         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
208         (DEFFILES): add aarch64-reloc.def.
209         (TARGETSOURCES): Add aarch64-reloc-property.cc.
210         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
211         * Makefile.in: Regenerate.
212         * aarch64-reloc-property.cc: New file.
213         * aarch64-reloc-property.h: New file.
214         * aarch64-reloc.def: New file.
215         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
216         with tab to make the format consistent.
217         (Output_data_got_aarch64::symbol_table_): New method.
218         (Target_aarch64::do_plt_address_for_global): New method.
219         (Target_aarch64::do_plt_address_for_local): New method.
220         (Target_aarch64::do_select_as_default_target): New method.
221         (Target_aarch64::do_make_data_plt): New method.
222         (Target_aarch64::make_data_plt): New method.
223         (Output_data_plt_aarch64::has_irelative_section): New method.
224         (Output_data_plt_aarch64::address_for_global): New method.
225         (Output_data_plt_aarch64::address_for_local): New method.
226         (Output_data_plt_aarch64::irelative_rel_): New parameter.
227         (Output_data_plt_aarch64::add_entry): Implement contents.
228         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
229         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
230         the got_pov entry to plt0.
231         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
232         Implement contents.
233         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
234         (AArch64_howto): New struct.
235         (aarch64_howto[]): New static const array.
236         (AArch64_relocate_functions): New class.
237         (Target_aarch64::Scan::get_reference_flags): Remove method.
238         (Target_aarch64::Scan::local): Implement to support a few relocations.
239         (Target_aarch64::Scan::global): Implement to support a few relocations.
240         (Target_aarch64::make_plt_section): Implement contents.
241         (Target_aarch64::make_plt_entry): Implement contents.
242         (Target_aarch64::do_finalize_sections): Implement contents.
243         (Target_aarch64::Relocate::relocate): Implement a few relocations.
244         (Target_aarch64::relocate_section): Implement contents.
245
246 2014-08-06  Alan Modra  <amodra@gmail.com>
247
248         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
249
250 2014-08-06  Alan Modra  <amodra@gmail.com>
251
252         PR 13227
253         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
254
255 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
256
257         * object.cc (Relobj::is_section_name_included): Add
258         ".rodata.nptl_version" to not garbage collect this section.
259
260 2014-07-08  Cary Coutant  <ccoutant@google.com>
261
262         * expression.cc (struct Expression::Expression_eval_info): Add
263         new fields type_pointer, vis_pointer, and nonvis_pointer.
264         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
265         nonvis_pointer parameters. Adjust all calls.
266         (Symbol_expression::value): Update type, visibility, and nonvis bits
267         in caller.
268         * script.cc (Symbol_assignment::sized_finalize): Update type,
269         visibility, and remaining st_other bits for new symbol.
270         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
271         vis_pointer, and nonvis_pointer parameters.
272         * symtab.h (Symbol::set_type): New method.
273
274         * testsuite/Makefile.am (defsym_test): New test.
275         * testsuite/Makefile.in: Regenerate.
276         * testsuite/defsym_test.c: New file.
277         * testsuite/defsym_test.sh: New file.
278
279 2014-07-08  Cary Coutant  <ccoutant@google.com>
280
281         PR gold/15639
282         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
283         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
284         (Sized_dynobj::base_read_symbols): ...new method.
285         * object.h (Sized_relobj_file::base_read_symbols): New method.
286         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
287         (Sized_relobj_file::base_read_symbols): ...new method.
288         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
289         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
290         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
291
292 2014-07-04  Alan Modra  <amodra@gmail.com>
293
294         * po/POTFILES.in: Regenerate.
295
296 2014-07-02  Jing Yu  <jingyu@google.com>
297
298         * aarch64.cc: New file
299         * Makefile.am (TARGETSOURCES): Add aarch64.cc
300         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
301         * Makefile.in: Regenerate.
302         * configure.tgt: Add entries for aarch64*.
303         * configure.ac:  Likewise.
304         * configure: Likewise.
305
306 2014-06-27  Alan Modra  <amodra@gmail.com>
307
308         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
309
310 2014-06-24  Cary Coutant  <ccoutant@google.com>
311
312         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
313         sections.
314         (Dwo_file::sized_read_unit_index): Likewise.
315
316 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
317
318         * mips.cc: New file.
319         * Makefile.am (TARGETSOURCES): Add mips.cc
320         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
321         * configure.tgt: Add entries for mips*.
322         * configure.ac: Likewise.
323         * Makefile.in: Regenerate.
324         * configure: Likewise.
325
326 2014-06-09  Cary Coutant  <ccoutant@google.com>
327
328         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
329         unit_length is within section bounds.
330
331 2014-06-09  Cary Coutant  <ccoutant@google.com>
332
333         PR gold/16980
334         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
335         map.
336
337 2014-06-07  Alan Modra  <amodra@gmail.com>
338
339         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
340
341 2014-06-06  Cary Coutant  <ccoutant@google.com>
342
343         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
344         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
345         (Dwarf_pubnames_table::read_header): Likewise.
346         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
347         .debug_gnu_pubtypes.
348
349 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
350
351         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
352         * Makefile.in, configure: Regenerate.
353
354 2014-06-03  Alan Modra  <amodra@gmail.com>
355
356         * powerpc.cc (addis_12_2): Define.
357         (Stub_table::do_write): Support fusion on ELFv2 stubs.
358
359 2014-06-03  Alan Modra  <amodra@gmail.com>
360
361         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
362         st_other output.
363
364 2014-06-02  Alan Modra  <amodra@gmail.com>
365
366         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
367         Only ignore relocs on ELFv1.
368         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
369
370 2014-05-30  Cary Coutant  <ccoutant@google.com>
371
372         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
373         * testsuite/Makefile.in: Regenerate.
374         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
375
376 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
377
378         PR gold/16945
379         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
380         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
381
382 2014-05-15  Alan Modra  <amodra@gmail.com>
383
384         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
385         Compare FDE contents with DW_CFA_nop rather than 0.
386
387 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
388
389         * symtab.h (may_need_copy_reloc): Remove check for position independent
390         code.
391         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
392         position independence before pc absolute may_need_copy_reloc call.
393         Add check for executable output befor pc relative may_need_copy_reloc
394         call.
395         * i386.cc: Ditto.
396         * arm.cc: Ditto.
397         * sparc.cc: Ditto.
398         * tilegx.cc: Ditto.
399         * powerpc.cc: Add check for no position independence before
400         may_need_copy_reloc calls.
401         * testsuite/pie_copyrelocs_test.cc: New file.
402         * testsuite/pie_copyrelocs_shared_test.cc: New file.
403         * Makefile.am (pie_copyrelocs_test): New test.
404         * Makefile.in: Regenerate.
405
406 2014-05-08  Martin Liška  <mliska@suse.cz>
407
408         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
409
410 2014-05-06  Cary Coutant  <ccoutant@google.com>
411
412         PR gold/16900
413         * i386.cc (Output_data_got_plt_i386): New class.
414         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
415         parameter. Change all callers.
416         (Output_data_plt_i386::layout_): Remove.
417         (Output_data_plt_i386::got_plt_): Change type.
418         (Target_i386::got_plt_): Change type. Change all references.
419         (Target_i386::got_section): Create instance of new class.
420         (Output_data_got_plt_i386::do_write): New function.
421         * x86_64.cc (Output_data_got_plt_x86_64): New class.
422         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
423         parameter. Change all callers.
424         (Output_data_plt_x86_64::layout_): Remove.
425         (Output_data_plt_x86_64::got_plt_): Change type.
426         (Target_x86_64::got_plt_): Change type. Change all references.
427         (Target_x86_64::got_section): Create instance of new class.
428         (Output_data_got_plt_x86_64::do_write): New function.
429         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
430         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
431         class.
432
433 2014-05-05  Cary Coutant  <ccoutant@google.com>
434
435         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
436         if we have pubnames/pubtypes.
437
438 2014-05-02  Cary Coutant  <ccoutant@google.com>
439
440         * defstd.cc (in_segment): Define __ehdr_start here...
441         * layout.cc (Layout::finalize): ...Instead of here.  Set the
442         output segment when known.
443         * resolve.cc (Symbol::override_base_with_special): Remember
444         the original binding.
445         * symtab.cc (Symbol::set_output_segment): New function.
446         (Symbol::set_undefined): New function.
447         * symtab.h (Symbol::is_weak_undefined): Check original undef
448         binding.
449         (Symbol::is_strong_undefined): New function.
450         (Symbol::set_output_segment): New function.
451         (Symbol::set_undefined): New function.
452         * target-reloc.h (is_strong_undefined): Remove.
453         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
454         Check for hidden undefs.
455         (relocate_section): Call Symbol::is_strong_undefined.
456
457         * testsuite/Makefile.am (ehdr_start_test_1)
458         (ehdr_start_test_2, ehdr_start_test_3)
459         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
460         * testsuite/Makefile.in: Regenerate.
461         * testsuite/ehdr_start_def.cc: New source file.
462         * testsuite/ehdr_start_test.cc: New source file.
463         * testsuite/ehdr_start_test.t: New linker script.
464         * testsuite/ehdr_start_test_4.sh: New shell script.
465
466 2014-04-23  Cary Coutant  <ccoutant@google.com>
467
468         PR gold/16870
469         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
470
471 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
472
473         * layout.cc (Layout::include_section): Allow a target to decide
474         whether to include a section.
475         * target.h (Target::should_include_section): New function.
476         (Target::do_should_include_section): New function.
477
478 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
479
480         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
481         inline into ...
482         (Copy_relocs::emit): ... here.
483         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
484         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
485         (Copy_reloc_entry::entries_): Change from private to protected.
486
487 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
488
489         * icf.cc (get_section_contents): Replace copies of reloc
490         vectors with const references.
491
492 2014-04-02  Cary Coutant  <ccoutant@google.com>
493
494         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
495         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
496         * configure: Regenerate.
497         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
498         -fno-use-linker-plugin.
499         (LINK1, CXXLINK1): Add it to the link command.
500         * testsuite/Makefile.in: Regenerate.
501
502 2014-03-12  Alan Modra  <amodra@gmail.com>
503
504         * Makefile.in: Regenerate.
505
506 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
507
508         * symtab.h (Symbol::set_nonvis): New function.
509
510 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
511
512         * symtab.cc (Sized_symbol<32>::init_output_data):
513         Instantiate the template.
514         (Sized_symbol<64>::init_output_data): Likewise.
515
516 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
517
518         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
519         adjust dynamic symbol value.
520         * target.h (Target::adjust_dyn_symbol): New function.
521         (Target::do_adjust_dyn_symbol): New function.
522
523 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
524
525         * output.cc (Output_data_dynamic::Dynamic_entry::write):
526         Get the value of DYNAMIC_CUSTOM dynamic entry.
527         * output.h (Output_data_dynamic::add_custom): New function.
528         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
529         dynamic entry.
530         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
531         * target.h (Target::dynamic_tag_custom_value): New function.
532         (Target::do_dynamic_tag_custom_value): New function.
533
534 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
535
536         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
537         dynsym indexes.
538         * target.h (Target::has_custom_set_dynsym_indexes): New function.
539         (Target::do_has_custom_set_dynsym_indexes): New function.
540         (Target::set_dynsym_indexes): New function.
541         (Target::do_set_dynsym_indexes): New function.
542
543 2014-03-07  Alan Modra  <amodra@gmail.com>
544
545         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
546         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
547         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
548         (Powerpc_relocate_functions::has_overflow_bitfield,
549         overflowed): Use the above.
550         (Target_powerpc::Relocate::relocate): Correct overflow checking
551         for a number of relocations.  Modify overflow test for 16-bit
552         fields in instructions to signed/unsigned according to whether
553         the field takes a signed or unsigned value.
554
555 2014-03-05  Alan Modra  <amodra@gmail.com>
556
557         Update copyright years.
558
559 2014-03-05  Alan Modra  <amodra@gmail.com>
560
561         * powerpc.cc (Target_powerpc::Scan::local, global): Support
562         R_PPC64_ADDR64_LOCAL.
563         (Target_powerpc::Relocate::relocate): Likewise.
564
565 2014-03-03  Alan Modra  <amodra@gmail.com>
566
567         * dwp.cc (print_version): Update copyright year to current.
568
569 2014-02-10  Alan Modra  <amodra@gmail.com>
570
571         * po/gold.pot: Regenerate.
572
573 2014-02-06  Cary Coutant  <ccoutant@google.com>
574
575         Fix problem where -u is ignored when a weak undef is seen.
576
577         * archive.cc (Library_base::should_include_member): Reorder
578         code to check for -u option if a weak undef has already been seen.
579         * testsuite/Makefile.am (weak_undef_test_2): New test case.
580         * testsuite/Makefile.in: Regenerate.
581         * testsuite/weak_undef_file3.cc: New file.
582         * testsuite/weak_undef_file4.cc: New file.
583         * testsuite/weak_undef_test_2.cc: New file.
584
585 2014-02-05  Cary Coutant  <ccoutant@google.com>
586
587         Fix issues with gold undefined symbol diagnostics.
588
589         PR binutils/15435
590         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
591         check to here.
592         * target-reloc.h (is_strong_undefined): New function.
593         (relocate_section): Move undef vtable symbol check from here.
594         Check for is_strong_undefined.
595
596 2014-02-05  Cary Coutant  <ccoutant@google.com>
597
598         Fix problems with the --dynamic-list option.
599
600         PR gold/13577
601         * options.cc (General_options::parse_dynamic_list):
602         Set have_dynamic_list_.
603         (General_options::General_options): Initialize have_dynamic_list_.
604         (General_options::finalize): Turn off -Bsymbolic and
605         -Bsymbolic-functions if --dynamic-list provided.
606         * options.h (General_options::have_dynamic_list): New function.
607         (General_options::have_dynamic_list_): New data member.
608         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
609         correctly.
610
611         PR gold/16530
612         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
613         in --dynamic-list, mark it.
614
615         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
616         (dynamic_list_2): New test case.
617         * testsuite/Makefile.in: Regenerate.
618         * testsuite/dynamic_list_2.cc: New file.
619         * testsuite/dynamic_list_2.t: New file.
620         * testsuite/dynamic_list_lib1.cc: New file.
621         * testsuite/dynamic_list_lib2.cc: New file.
622         * testsuite/gc_dynamic_list_test.c: New file.
623         * testsuite/gc_dynamic_list_test.sh: New file.
624         * testsuite/gc_dynamic_list_test.t: New file.
625
626 2014-01-28  Cary Coutant  <ccoutant@google.com>
627
628         Add .gdb_index version 7 support.
629
630         * gold/dwarf_reader.cc: include <utility> (for make_pair).
631         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
632         debug sections.
633         (Dwarf_ranges_table::read_ranges_table): Likewise.
634         (Dwarf_pubnames_table::read_section): Check for GNU-style
635         sections, and for compressed debug sections.
636         (Dwarf_pubnames_table::read_header): Compute end address of table.
637         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
638         for end of list by offset, not by offset == 0.
639         (Dwarf_info_reader::do_read_string_table): Check for compressed
640         debug sections.
641         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
642         Initialize new data members.
643         (Dwarf_pubnames_table::next_name): return flag_byte.
644         (Dwarf_pubnames_table::end_of_table_): New data member.
645         (Dwarf_pubnames_table::is_gnu_style_): New data member.
646         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
647         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
648         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
649         read skeleton type unit DIEs.
650         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
651         (Gdb_index::do_write): Write flag_byte.
652         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
653         (Gdb_index::Cu_vector): Store flags along with cu indexes.
654         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
655         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
656
657 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
658
659         * version.cc (print_version): Update copyright year to 2014.
660
661 2013-12-19  Dimitry Andric  <dimitry@andric.com>
662
663         * stringpool.cc (Stringpool_template::reserve): Add
664         HAVE_UNORDERED_MAP case.
665         * stringpool.cc (Stringpool_template::print_stats): Likewise.
666
667 2013-12-18  Cary Coutant  <ccoutant@google.com>
668
669         * configure.ac: Check for <unordered_set> and <unordered_map>.
670         * config.in: Regenerate.
671         * configure: Regenerate.
672         * system.h: Use <unordered_set> and <unordered_map> if available.
673
674 2013-12-10  Roland McGrath  <mcgrathr@google.com>
675
676         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
677         with $(INSTALL_PROGRAM_ENV).
678         * Makefile.in: Regenerate.
679
680 2013-11-22  Cary Coutant  <ccoutant@google.com>
681
682         * configure.ac: Add check for which library is needed for
683         dlopen.
684         * configure: Regenerate.
685
686 2013-11-22  Cary Coutant  <ccoutant@google.com>
687
688         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
689         assembler.
690         * testsuite/Makefile.in: Regenerate.
691
692 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
693
694         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
695         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
696         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
697         (Target_x86_64<size>::Scan::local): Likewise.
698         (Target_x86_64<size>::Scan::global): Likewise.
699         (Target_x86_64<size>::Relocate::relocate): Likewise.
700         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
701         Likewise.
702         (Target_x86_64<size>::Scan::check_non_pic(): Handle
703         R_X86_64_PC32_BND.
704
705         * testsuite/Makefile.am (check_PROGRAMS): Add
706         exception_x86_64_bnd_test.
707         (exception_x86_64_bnd_test_SOURCES): New macro.
708         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
709         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
710         (exception_x86_64_bnd_test_LDADD): Likewise.
711         (exception_x86_64_bnd_1.o): New rule.
712         (exception_x86_64_bnd_2.o): Likewise.
713         * testsuite/Makefile.in: Regenerated.
714
715 2013-11-15  Alan Modra  <amodra@gmail.com>
716
717         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
718         accessor.
719         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
720         Only call ppc64_local_entry_offset for 64-bit.  Restrict
721         symval_for_branch lookup to ELFv1.
722         (Stub_table::add_plt_call_entry): Use unsigned int off.
723         (Output_data_glink::Address, invalid_address): New.
724         (Output_data_glink::add_eh_frame): Move out of line.  Add
725         support for ELFv2.
726         (Output_data_glink::add_global_entry, find_global_entry,
727         global_entry_address): New functions.
728         (Output_data_glink::global_entry_stubs_, end_branch_table_,
729         ge_size): New variables.
730         (Output_data_glink::set_final_data_size): Add global entry
731         stub sizing.
732         (Output_data_glink::do_write): Write global entry stubs.
733         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
734         parameter.  Return true for ELFv2.  Adjust callers.
735         (Target_powerpc::Scan::local, global): Restrict opd lookup to
736         ELFv1.  Similarly for ifunc and dynamic relocation processing
737         specific to ELFv1.  Recognize that symbols are defined on
738         their plt entries for ELFv2.
739         (Target_powerpc::symval_for_branch): Assert if called for
740         ELFv2 or ppc32.
741         (Target_powerpc::Relocate::relocate): Use global entry plt
742         stub for symbol value if such exists on ELFv2.
743         (Target_powerpc::Relocate::relocate): Don't call
744         symval_for_branch when ELFv2.  Do adjust for local entry
745         offset when ELFv2.
746         (Target_powerpc::do_dynsym_value): Set symbols to global entry
747         plt stub for ELFv2.
748         (Target_powerpc::do_plt_address_for_global): Similarly.
749
750 2013-11-14  Cary Coutant  <ccoutant@google.com>
751
752         Revert patch -- this did not fix the problem, and there is
753         no race there.
754
755         2013-11-14  Cary Coutant  <ccoutant@google.com>
756
757             PR gold/14860
758             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
759             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
760             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
761             updating fde_offsets_.
762             (Eh_frame_hdr::lock_): New data member.
763
764 2013-11-14  Cary Coutant  <ccoutant@google.com>
765
766         * dwp.cc (Dwo_file_entry): New type.
767         (File_list): Use Dwo_file_entry.
768         (Dwo_file::verify): New function.
769         (Dwo_file::verify_dwo_list): New function.
770         (Dwo_file::sized_verify_dwo_list): New function.
771         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
772         list.
773         (Dwp_options): New enum type.
774         (dwp_options): Add --verify-only.
775         (usage): Likewise.
776         (main): Likewise.
777         * dwp.h (gold_info): Add declaration.
778
779 2013-11-14  Cary Coutant  <ccoutant@google.com>
780
781         PR gold/14860
782         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
783         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
784         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
785         updating fde_offsets_.
786         (Eh_frame_hdr::lock_): New data member.
787
788 2013-11-06  Cary Coutant  <ccoutant@google.com>
789
790         PR gold/15758
791         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
792         before reloc sections.
793
794 2013-11-04  Alan Modra  <amodra@gmail.com>
795
796         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
797         (Symbol::needs_dynamic_reloc): Test new flag.
798         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
799         (Target_powerpc::Scan::get_reference_flags): Add target param.
800         Return FUNC_DESC_ABI for 64-bit ELFv1.
801         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
802         call.
803         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
804         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
805
806 2013-10-31  Cary Coutant  <ccoutant@google.com>
807
808         Restore support for dwp v2 DWARF package file format.
809
810         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
811         tu_length parameter.  Adjust all callers.
812         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
813         * dwp.cc: Include dwarf.h.
814         (Section_bounds): New struct type.
815         (Unit_set): New struct type.
816         (Dwo_file::Dwo_file): Initialize new data member.
817         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
818         Combine and rename to...
819         (Dwo_file::read_unit_index): ...this.
820         (Dwo_file::sized_read_compunit_index)
821         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
822         (Dwo_file::sized_read_unit_index): ...this.
823         (Dwo_file::copy_section): Remove section_name, is_str_offsets
824         parameters; add section_id parameter.
825         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
826         (Dwo_file::add_unit_set): ...this.
827         (Dwo_file::shndx_map_): Remove.
828         (Dwo_file::sect_offsets_): New data member.
829         (Dwp_output_file::Dwp_output_file): Initialize new data members.
830         (Dwp_output_file::add_section): Rename to...
831         (Dwp_output_file::add_contribution): ...this.
832         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
833         (Dwp_output_file::add_tu_set): Likewise.
834         (Dwp_output_file::Contribution): New type.
835         (Dwp_output_file::Section::contributions): New data member.
836         (Dwp_output_file::Cu_or_tu_set): Remove.
837         (Dwp_output_file::Section::Section): New ctor.
838         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
839         (Dwp_output_file::Dwp_index::Section_table): New type.
840         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
841         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
842         parameter.
843         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
844         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
845         (Dwp_output_file::Dwp_index::section_table): New member function.
846         (Dwp_output_file::Dwp_index::section_table_end): New member function.
847         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
848         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
849         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
850         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
851         (Dwp_output_file::Dwp_index::section_table_): New data member.
852         (Dwp_output_file::Dwp_index::section_mask_): New data member.
853         (Dwp_output_file::add_output_section): New member function.
854         (Dwp_output_file::write_new_section): New member function.
855         (Dwp_output_file::write_contributions): New member function.
856         (Dwp_output_file::section_id_map_): New data member.
857         (class Dwo_id_info_reader): Remove.
858         (class Unit_reader): New class.
859         (get_dwarf_section_name): New function.
860         (Dwo_file::read_executable): Adjust initializations of class data.
861         (Dwo_file::read): Add support for v2 package file format.
862         (Dwo_file::read_unit_index): Likewise.
863         (Dwo_file::sized_read_unit_index): Likewise.
864         (Dwo_file::copy_section): Likewise.
865         (Dwo_file::add_unit_set): Likewise.
866         (Dwp_output_file::add_output_section): Likewise.
867         (Dwp_output_file::add_contribution): Likewise.
868         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
869         for empty slot.
870         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
871         file format.
872         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
873         slot.
874         (Dwp_output_file::initialize): Remove unused function.
875         (Dwp_output_file::finalize): Add support for v2 package file format.
876         (Dwp_output_file::write_index): Likewise.
877         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
878         function prototype.
879
880 2013-10-31  Cary Coutant  <ccoutant@google.com>
881
882         * configure.ac: Fix check for -fmerge-constants.
883         * configure.ac: Regenerate.
884
885 2013-10-30  Roland McGrath  <mcgrathr@google.com>
886
887         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
888         Correct 9-byte nop sequence to match what the assembler generates.
889
890 2013-10-30  Alan Modra  <amodra@gmail.com>
891
892         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
893         ppc64_local_entry_offset, ppc64_local_entry_offset,
894         do_read_symbols): New functions.
895         (Powerpc_relobj::e_flags_, st_other_): New vars.
896         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
897         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
898         (Powerpc_relobj::e_flags_): New var.
899         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
900         and adjust for ELFv2.
901         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
902         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
903         (Powerpc_dynobj::do_find_special_sections): Likewise.
904         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
905         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
906         to ELFv2 local entry.
907         (Target_powerpc::do_relax): No thread safe barriers needed for
908         ELFv2.
909         (Output_data_plt_powerpc::initial_plt_entry_size_,
910         plt_entry_size): Delete.  Replace all uses with
911         first_plt_entry_offset() and plt_entry_size().
912         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
913         reserved_size parm.  Update callers.
914         (Output_data_plt_powerpc::entry_count): Update.
915         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
916         and use Target_powerpc::first_plt_entry_offset().
917         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
918         rename to plt_entry_size.
919         (Output_data_plt_powerpc::add_ifunc_entry,
920         add_local_ifunc_entry): Adjust reloc for ELFv2.
921         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
922         (glink_eh_frame_fde_64v2): New.
923         (Stub_table::plt_call_size): Support ELFv2 sizing.
924         (Output_data_glink::add_eh_frame): Use the new FDE.
925         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
926         (Stub_table::do_write): Write ELFv2 stubs and glink.
927         (Target_powerpc::Relocate::relocate): Replaces nop after call
928         with ld 2,24(1) and adjust local offset destination for ELFv2.
929
930 2013-10-30  Alan Modra  <amodra@gmail.com>
931
932         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
933         (Target_powerpc::Scan::global, local): Likewise.
934         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
935         on all ppc64 @h and @ha relocs.
936
937 2013-10-14  Alan Modra  <amodra@gmail.com>
938
939         * output.h (Output_data_got::add_constant): Tidy.
940         (Output_data_got::add_constant_pair): New function.
941         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
942         methods used so as to first call reserve_ent().
943
944 2013-10-11  Roland McGrath  <mcgrathr@google.com>
945
946         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
947         add_got_entry and add_got_entry_pair.
948
949         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
950         (HAVE_PUBNAMES): Likewise.
951         * configure: Regenerate.
952
953         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
954         * testsuite/Makefile.in: Regenerate.
955
956         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
957         Remove const from declaration.
958         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
959         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
960         * output.h (Output_file_header): Remove const from member target_
961         and corresponding constructor argument.
962         * output.cc (Output_file_header::Output_file_header): Update prototype.
963         (Output_file_header::do_sized_write): Use this->target_ in place
964         of parameters()->target().
965
966         * testsuite/undef_symbol.cc (Foo::get_a): New method.
967
968         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
969         * configure: Regenerate.
970         * Makefile.in: Regenerate.
971         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
972         * testsuite/merge_string_literals_2.c: Likewise.
973         * testsuite/Makefile.am
974         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
975         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
976         literal -fmerge-constants.
977         * testsuite/Makefile.in: Regenerate.
978
979         * i386.cc (Target_i386): Remove unused member dynbss_.
980         * arm.cc (Target_arm): Likewise.
981         * powerpc.cc (Target_powerpc): Likewise.
982         * sparc.cc (Target_sparc): Likewise.
983         * tilegx.cc (Target_tilegx): Likewise.
984         * x86_64.cc (Target_x86_64): Likewise.
985         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
986         type_signature_, type_offset_.
987         * plugin.h (Plugin_hook): Remove unused member layout_.
988         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
989         mapfile_.
990         (Read_member): Remove unused members input_objects_, symtab_,
991         mapfile_, layout_.
992         (Check_library): Remove unused member symtab_.
993         * archive.h (Lib_group): Remove unused member lib_.
994         * archive.cc (Lib_group::Lib_group): Update initializer.
995         * incremental.h (Incremental_binary): Remove unused member target_.
996         (Incremental_script_entry): Removed unused member script_.
997         * layout.h (Write_symbols_task): Remove unused member input_objects_.
998         * icf.h (Icf): Remove unused member num_tracked_relocs.
999
1000         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1001         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1002         its only use.
1003         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1004
1005         * archive.h: Use struct rather than class for forward declaration
1006         of Read_symbols_data.
1007
1008 2013-10-07  Cary Coutant  <ccoutant@google.com>
1009
1010         PR gold/16010
1011         * testsuite/Makefile.am (icf_test): Fix dependencies.
1012         (icf_safe_test): Likewise.
1013         (icf_safe_so_test): Likewise.
1014         (large_symbol_alignment): Add empty _LDADD rule.
1015         * testsuite/Makefile.in: Regenerate.
1016
1017 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1018
1019         PR gold/15927
1020         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1021         relocation for R_X86_64_32 on x32.
1022
1023 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1024
1025         * output.cc (Output_segment::set_section_addresses): Take new
1026         Target* argument.  If target->isolate_execinstr() and the segment
1027         is executable and starts at a target->abi_pagesize() boundary,
1028         pad its end out to a target->abi_pagesize() boundary with code fill.
1029         * output.h (Output_segment::set_section_addresses): Update decl.
1030         * layout.h (Layout::check_output_data_for_reset_values): Take new
1031         argument RELAX_OUTPUTS.
1032         (Layout): New member relax_output_list_.
1033         (Layout::add_relax_output): New method.
1034         * layout.cc (Layout::Layout): Update constructor.
1035         (Layout::reset_relax_output): New method.
1036         (Layout::clean_up_after_relaxation): Call it.
1037         (Layout::prepare_for_relaxation): Update caller.
1038         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1039         Call reset_relax_output before re-processing segments for
1040         isolate_execinstr case.
1041         (Layout::write_data): Handle relax_output_list_.
1042         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1043         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1044
1045 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1046
1047         PR binutils/15834
1048         * object.h: Fix typos.
1049
1050 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1051
1052         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1053         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1054
1055 2013-08-07  Cary Coutant  <ccoutant@google.com>
1056
1057         Revert support for v2 DWP files:
1058
1059         2013-03-01  Cary Coutant  <ccoutant@google.com>
1060
1061             Add dwp support for v2 DWARF package file format.
1062             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1063             tu_length parameter.  Adjust all callers.
1064             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1065             * dwp.cc: Include dwarf.h.
1066             (Section_bounds): New struct type.
1067             (Unit_set): New struct type.
1068             (Dwo_file::Dwo_file): Initialize new data member.
1069             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1070             Combine and rename to...
1071             (Dwo_file::read_unit_index): ...this.
1072             (Dwo_file::sized_read_compunit_index)
1073             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1074             (Dwo_file::sized_read_unit_index): ...this.
1075             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1076             parameters; add section_id parameter.
1077             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1078             (Dwo_file::add_unit_set): ...this.
1079             (Dwo_file::shndx_map_): Remove.
1080             (Dwo_file::sect_offsets_): New data member.
1081             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1082             (Dwp_output_file::add_section): Rename to...
1083             (Dwp_output_file::add_contribution): ...this.
1084             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1085             (Dwp_output_file::add_tu_set): Likewise.
1086             (Dwp_output_file::Contribution): New type.
1087             (Dwp_output_file::Section::contributions): New data member.
1088             (Dwp_output_file::Cu_or_tu_set): Remove.
1089             (Dwp_output_file::Section::Section): New ctor.
1090             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1091             (Dwp_output_file::Dwp_index::Section_table): New type.
1092             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1093             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1094             parameter.
1095             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1096             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1097             (Dwp_output_file::Dwp_index::section_table): New member function.
1098             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1099             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1100             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1101             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1102             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1103             (Dwp_output_file::Dwp_index::section_table_): New data member.
1104             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1105             (Dwp_output_file::add_output_section): New member function.
1106             (Dwp_output_file::write_new_section): New member function.
1107             (Dwp_output_file::write_contributions): New member function.
1108             (Dwp_output_file::section_id_map_): New data member.
1109             (class Dwo_id_info_reader): Remove.
1110             (class Unit_reader): New class.
1111             (get_dwarf_section_name): New function.
1112             (Dwo_file::read_executable): Adjust initializations of class data.
1113             (Dwo_file::read): Add support for v2 package file format.
1114             (Dwo_file::read_unit_index): Likewise.
1115             (Dwo_file::sized_read_unit_index): Likewise.
1116             (Dwo_file::copy_section): Likewise.
1117             (Dwo_file::add_unit_set): Likewise.
1118             (Dwp_output_file::add_output_section): Likewise.
1119             (Dwp_output_file::add_contribution): Likewise.
1120             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1121             for empty slot.
1122             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1123             file format.
1124             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1125             slot.
1126             (Dwp_output_file::initialize): Remove unused function.
1127             (Dwp_output_file::finalize): Add support for v2 package file format.
1128             (Dwp_output_file::write_index): Likewise.
1129             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1130             function prototype.
1131
1132 2013-07-31  Cary Coutant  <ccoutant@google.com>
1133
1134         * object.cc (Sized_relobj::do_output_section_address): New function.
1135         (Sized_relobj): Instantiate explicitly.
1136         * object.h (Object::output_section_address): New function.
1137         (Object::do_output_section_address): New function.
1138         (Sized_relobj::do_output_section_address): New function.
1139         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1140
1141 2013-07-30  Cary Coutant  <ccoutant@google.com>
1142             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1143
1144         * parameters.cc (Parameters::entry): Return target-specific entry
1145         symbol name.
1146         * target.h (Target::entry_symbol_name): New function.
1147         (Target_info::entry_symbol_name): New data member.
1148
1149         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1150         * i386.cc (Target_i386::i386_info): Likewise.
1151         (Target_i386_nacl::i386_nacl_info): Likewise.
1152         * sparc.cc (Target_sparc::sparc_info): Likewise.
1153         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1154         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1155         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1156         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1157
1158 2013-07-22  Sterling Augustine  <saugustine@google.com>
1159
1160         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1161         Convert parameter shndx to local variable. Add parameters symtab
1162         and symtab_size.  Scan over section names.  Find relocation
1163         section corresponding to current section.  Create and initialize
1164         reloc_mapper_ and reloc_type_.
1165         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1166         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1167         cu_offset_.
1168         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1169         Initialize new fields unit_length_ and cu_offset_.
1170         (Dwarf_pubnames_table::read_section): Update prototype.
1171         (Dwarf_pubnames_table::cu_offset): New member function.
1172         (Dwarf_pubnames_table::subsection_size): Likewise.
1173         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1174         New fields.
1175         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1176         member functions public.
1177         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1178         Update comment.  Rework logic.  Move repeated parts to...
1179         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1180         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1181         pubtypes_table_, and stmt_list_offset.
1182         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1183         Gdb_index::find_pubtype_offset,
1184         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1185         (Gdb_index::pubnames_read): Update prototype and rework logic.
1186         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1187         Forward declare.
1188         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1189         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1190         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1191         Gdb_index::map_pubtable_to_dies):
1192         Declare functions.
1193         (Gdb_index::pubnames_read): Update declaration.
1194         (Gdb_index::Pubname_offset_map): New type.
1195         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1196         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1197         Gdb_index::stmt_list_offset): Declare.
1198         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1199         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1200         Gdb_index::pubtypes_offset_): Remove.
1201
1202 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1203
1204         * options.h (General_options): Add -Trodata-segment option.
1205         * parameters.cc (Parameters::check_rodata_segment): New function.
1206         (Parameters::set_target_once): Call it.
1207         * parameters.h (Parameters): Declare it (private member function).
1208         * layout.cc (load_seg_unusable_for_headers): New function, broken
1209         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1210         then validate rodata segment rather than text segment.
1211         (relaxation_loop_body): Call that.
1212         (is_text_segment): New function.  Don't admit a non-executable
1213         segment if TARGET->isolate_execinstr().
1214         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1215
1216 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1217
1218         PR gold/15070
1219         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1220         * nacl.h (Sniff_file::View::View): Request aligned view.
1221
1222 2013-07-11  Cary Coutant  <ccoutant@google.com>
1223
1224         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1225         correct BRLT entry size.
1226
1227 2013-07-03  Alan Modra  <amodra@gmail.com>
1228
1229         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1230         comment.
1231
1232 2013-07-01  Cary Coutant  <ccoutant@google.com>
1233
1234         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1235         reloc_type_.
1236         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1237         (Dwarf_ranges_table::lookup_reloc): New function.
1238         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1239         reloc_type_.
1240         (Dwarf_ranges_table::lookup_reloc): New function.
1241         (Dwarf_ranges_table::reloc_type_): New data member.
1242
1243 2013-06-27  Jing Yu  <jingyu@google.com>
1244
1245         PR gold/15662
1246         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1247         function.
1248         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1249         (Target_powerpc::do_relax): Call the above.
1250
1251 2013-06-27  Cary Coutant  <ccoutant@google.com>
1252
1253         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1254         on garbage collected .opd section.
1255
1256 2013-06-27  Alan Modra  <amodra@gmail.com>
1257
1258         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1259         is non-zero.
1260         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1261         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1262
1263 2013-06-14  Cary Coutant  <ccoutant@google.com>
1264
1265         * resolve.cc (Symbol::override_base): Don't override st_type
1266         from plugin placeholder symbols.
1267         (Symbol_table::resolve): Likewise.
1268         (Symbol_table::should_override): Don't complain about TLS mismatch
1269         if the TO symbol is a plugin placeholder.
1270         * testsuite/Makefile.am (plugin_test_tls): New test.
1271         * testsuite/Makefile.in: Regenerate.
1272         * testsuite/plugin_test_tls.sh: New test script.
1273         * testsuite/two_file_test_2_tls.cc: New test source.
1274         * testsuite/two_file_test_tls.cc: New test source.
1275
1276 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1277
1278         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1279         the maximum segment alignment is larger than the page size.
1280         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1281         correctly aligns the symbols with large alignemnt.
1282         * testsuite/Makefile.in: Regenerate.
1283         * testsuite/large_symbol_alignment.cc: New file.
1284
1285 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1286             Sriraman Tallam  <tmsriram@google.com>
1287
1288         * options.h (sort_section): New option.
1289         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1290         Rename from Input_section_sort_section_name_special_ordering_compare.
1291         (Input_section_sort_section_name_compare): New struct.
1292         * output.cc (Output_section::Input_section_sort_section_name_compare::
1293         operator()): New function.
1294         (Output_section::sort_attached_input_sections): Use new sort function
1295         for .text if --sort-section=name is specified.
1296         * layout.cc (Layout::make_output_section):
1297         Add sorting by name when --sort-section=name is specified.
1298         * testsuite/Makefile.am (text_section_grouping): Test option
1299         --sort-section=name.
1300         * testsuite/Makefile.in: Regenerate.
1301         * testsuite/section_sorting_name.cc: New file.
1302         * testsuite/section_sorting_name.sh: New file.
1303
1304 2013-05-21  Cary Coutant  <ccoutant@google.com>
1305
1306         * symtab.h (Symbol::is_cxx_vtable): New function.
1307         * target-reloc.h (relocate_section): Check for vtable symbol.
1308         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1309         * testsuite/Makefile.in: Regenerate.
1310         * testsuite/missing_key_func.cc: New test source.
1311         * testsuite/missing_key_func.sh: New test script.
1312
1313 2013-05-21  Cary Coutant  <ccoutant@google.com>
1314
1315         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1316         type of enclosing symbol.
1317         (Relocate_info::location): Check symbol type when describing symbol.
1318         * object.h (Symbol_location_info): Remove unused line_number;
1319         add enclosing_symbol_type.
1320         * testsuite/debug_msg.sh: Adjust expected output.
1321
1322 2013-05-13  Cary Coutant  <ccoutant@google.com>
1323
1324         * configure.ac: Export DEFAULT_TARGET.
1325         * configure: Regenerate.
1326         * Makefile.in: Regenerate.
1327         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1328         * testsuite/Makefile.in: Regenerate.
1329         * testsuite/debug_msg.sh: Delete duplicate tests.
1330         Don't check undef_int error message match for powerpc where the
1331         source file and line number aren't available.
1332
1333 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1334
1335         * options.h (General_options): Add --rosegment-gap option.
1336         * options.cc (finalize): --rosegment-gap implies --rosegment.
1337         * layout.cc (set_segment_offsets): Let user option override
1338         target->rosegment_gap().
1339
1340 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1341
1342         * options.h (General_options): Remove leading space from help
1343         messages for -nostdlib and --rosegment.
1344
1345 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1346
1347         PR ld/15365
1348         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1349
1350 2013-05-03  Alan Modra  <amodra@gmail.com>
1351
1352         * merge.cc (Output_merge_string::do_add_input_section): Correct
1353         scan for number of strings.  Rename vars to avoid shadowing.
1354         Include missing terminator in input_size_.
1355
1356 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1357
1358         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1359         Restore empty string handling.
1360
1361 2013-05-01  Cary Coutant  <ccoutant@google.com>
1362
1363         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1364         uninitialized warning.
1365
1366 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1367
1368         * output.cc (Output_section::add_merge_input_section): Allow
1369         to merge sections if the alignment is more than character size.
1370         * merge.h (Output_merge_string::Output_merge_string): Remove
1371         assert.
1372         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1373         only not-null strings. Check the alignment of strings.
1374         * stringpool.h
1375         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1376         alignment as the argument.
1377         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1378         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1379         Align non-zero length strings according to the addralign_.
1380         (Stringpool_template<Stringpool_char>::set_string_offsets):
1381         Updating offsets according to the given alignment.
1382         * testsuite/Makefile.am (text_section_grouping): Test if string
1383         literals are getting merged.
1384         * testsuite/Makefile.in: Regenerate.
1385         * testsuite/merge_string_literals_1.c: New file.
1386         * testsuite/merge_string_literals_2.c: Ditto.
1387         * testsuite/merge_string_literals.sh: Ditto.
1388
1389 2013-04-26  Ian Lance Taylor  <iant@google.com>
1390
1391         * target-reloc.h (relocate_section): If the reloc offset is out of
1392         range, pass VIEW as NULL to relocate.relocate.
1393         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1394         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1395         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1396         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1397         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1398         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1399
1400 2013-04-26  Geoff Pike  <gpike@chromium.org>
1401
1402         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1403         * layout.cc (Hash_task): New class.
1404         (Layout::queue_build_id_tasks): New function.
1405         (Layout::write_build_id): Handle single-thread portion of build ID
1406         computation.  (In some cases, all of it is single-threaded.)  Replace
1407         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1408         functionality in fewer lines of code.
1409         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1410         * options.h (General_options): make "--build-id" default to tree
1411         rather than sha1.  Add two new options related to --build-id=tree:
1412         --build-id-chunk-size-for-treehash and
1413         --build-id-min-file-size-for-treehash.
1414         * Makefile.am: add testing of --build-id=tree and related new options
1415         (these tests will be invoked by "make check").
1416         * Makefile.in: Regenerate.
1417
1418 2013-04-25  Alan Modra  <amodra@gmail.com>
1419
1420         * configure.tgt: Add powerpcle and powerpc64le.
1421
1422 2013-04-22  Alan Modra  <amodra@gmail.com>
1423
1424         PR gold/15355
1425         * layout.cc (Layout::segment_precedes): Allow more than one
1426         segment with the same type and flags.
1427
1428 2013-04-15  Cary Coutant  <ccoutant@google.com>
1429
1430         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1431         allocate space in file for BSS sections.
1432
1433 2013-04-15  Cary Coutant  <ccoutant@google.com>
1434
1435         * script-sections.cc (Orphan_output_section): Reset address
1436         to zero after each orphaned section for relocatable links.
1437
1438 2013-04-15  Cary Coutant  <ccoutant@google.com>
1439
1440         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1441         section starting address for relocatable link.
1442         * testsuite/Makefile.am (script_test_11): New test.
1443         * testsuite/Makefile.in: Regenerate.
1444         * testsuite/script_test_11.c: New source file.
1445         * testsuite/script_test_11.t: New linker script.
1446
1447 2013-04-13  Alan Modra  <amodra@gmail.com>
1448
1449         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1450         owner when sections are not adjacent and exceed group size.
1451         (Target_powerpc::group_sections): Handle corner case.
1452         (Target_powerpc::Branch_info::make_stub): Handle case where
1453         stub table doesn't exist due to branches in non-exec sections.
1454         (Target_powerpc::Relocate::relocate): Likewise.
1455
1456 2013-04-11  Alan Modra  <amodra@gmail.com>
1457
1458         PR gold/15354
1459         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1460         .branch_lt to match bfd ld.  Adjust comments throughout file.
1461
1462 2013-04-04  Ian Lance Taylor  <iant@google.com>
1463
1464         GCC PR c++/56840
1465         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1466         sections before checking whether they are included in the link.
1467
1468 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1469
1470         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1471         object before calling the plugin claim_file handler.  Pass the elf
1472         object of the archive to the plugin. Delete the elf object if the
1473         plugin claims the file.
1474
1475 2013-03-21  Alan Modra  <amodra@gmail.com>
1476
1477         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1478         segment when omagic.
1479
1480 2013-03-21  Alan Modra  <amodra@gmail.com>
1481
1482         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1483         comparison warning.
1484         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1485         uninitialized" warning.
1486
1487 2013-03-20  Alan Modra  <amodra@gmail.com>
1488
1489         * symtab.h (Symbol::clear_version): New function.
1490         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1491         is_needed by weak references.  Clear version for symbols defined
1492         in as-needed objects that are not needed.
1493
1494 2013-03-15  Alan Modra  <amodra@gmail.com>
1495
1496         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1497         static and public.  Add report_err param.  Return false for data refs.
1498         (Target_powerpc::rela_dyn_section): New overloaded function.
1499         (Target_powerpc::plt_, iplt_): Elucidate.
1500         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1501         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1502         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1503         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1504         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1505         push_branch and make_plt_entry for ifunc syms when
1506         reloc_needs_plt_for_ifunc.
1507         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1508         for ifunc unless reloc_needs_plt_for_ifunc.
1509
1510 2013-03-15  Alan Modra  <amodra@gmail.com>
1511
1512         * gc.h (gc_process_relocs): Don't look through function descriptors.
1513         * icf.cc (get_section_contents): Do so here instead.
1514
1515 2013-03-13  Alan Modra  <amodra@gmail.com>
1516
1517         * powerpc.cc (is_branch_reloc): Forward declare.
1518         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1519         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1520         false for 64-bit, true for 32-bit non-branch relocs.
1521         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1522         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1523         nm output.
1524         (icf_safe_test): Generate linker map file as well as nm output.
1525         (icf_safe_so_test): Likewise.
1526         * testsuite/Makefile.in: Regenerate.
1527         * testsuite/icf_test.sh: Parse linker map file to determine
1528         section folding.
1529         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1530         * testsuite/icf_safe_so_test.sh: Likewise.
1531         (X86_32_or_ARM_specific_safe_fold): Merge into..
1532         (arch_specific_safe_fold): ..this.
1533         (X86_64_specific_safe_fold): Delete unused function.
1534
1535 2013-03-12  Alan Modra  <amodra@gmail.com>
1536
1537         * gc.h (gc_process_relocs): Look through function descriptors
1538         to determine shndx, symvalue and addend used by ICF.  Tidy
1539         variable duplication.
1540
1541 2013-03-11  Alan Modra  <amodra@gmail.com>
1542
1543         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1544         * layout.cc (Layout_task_runner::run): ..to here.
1545         * symtab.h (struct Symbol_location): Extract from..
1546         (class Symbol_table): ..here.
1547         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1548         * target.h (class Target): Add function_location and
1549         do_function_location functions.
1550         (class Sized_target): Add do_function_location.
1551         * object.h (class Sized_relobj_file): Move find_shdr..
1552         (class Object): ..to here.
1553         * object.cc: Likewise.  Update to suit.  Instantiate.
1554         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1555         * powerpc.cc (class Powerpc_dynobj): New.
1556         (Target_powerpc::do_function_location): New function.
1557         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1558         (Powerpc_dynobj::do_read_symbols): New function.
1559         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1560
1561 2013-03-08  Ian Lance Taylor  <iant@google.com>
1562
1563         * options.cc (General_options::string_to_object_format): Accept
1564         "default".
1565
1566 2013-03-08  Alan Modra  <amodra@gmail.com>
1567
1568         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1569         pointer to Post_fde.
1570         (struct Post_fde): Move definition to here..
1571         * ehframe.cc (struct Post_fde): ..from here.
1572         (Cie::write): Don't alloc Post_fde.
1573         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1574
1575 2013-03-07  Alan Modra  <amodra@gmail.com>
1576
1577         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1578         relocation referencing .LC0.
1579         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1580
1581 2013-03-07  Alan Modra  <amodra@gmail.com>
1582
1583         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1584         always_inline.  Add assembly for powerpc to avoid GOT.
1585
1586 2013-03-07  Alan Modra  <amodra@gmail.com>
1587
1588         * testsuite/script_test_10.sh: Don't test .bss section
1589         header number.
1590
1591 2013-03-06  Alan Modra  <amodra@gmail.com>
1592
1593         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1594         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1595         all callers.  Handle folded sections.
1596         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1597         to Powerpc_relobj.
1598         (Global_symbol_visitor_opd::operator()): Likewise.
1599
1600 2013-03-04  Alan Modra  <amodra@gmail.com>
1601
1602         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1603         * testsuite/Makefile.in: Regenerate.
1604
1605 2013-03-01  Cary Coutant  <ccoutant@google.com>
1606
1607         Add dwp support for v2 DWARF package file format.
1608         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1609         tu_length parameter.  Adjust all callers.
1610         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1611         * dwp.cc: Include dwarf.h.
1612         (Section_bounds): New struct type.
1613         (Unit_set): New struct type.
1614         (Dwo_file::Dwo_file): Initialize new data member.
1615         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1616         Combine and rename to...
1617         (Dwo_file::read_unit_index): ...this.
1618         (Dwo_file::sized_read_compunit_index)
1619         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1620         (Dwo_file::sized_read_unit_index): ...this.
1621         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1622         parameters; add section_id parameter.
1623         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1624         (Dwo_file::add_unit_set): ...this.
1625         (Dwo_file::shndx_map_): Remove.
1626         (Dwo_file::sect_offsets_): New data member.
1627         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1628         (Dwp_output_file::add_section): Rename to...
1629         (Dwp_output_file::add_contribution): ...this.
1630         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1631         (Dwp_output_file::add_tu_set): Likewise.
1632         (Dwp_output_file::Contribution): New type.
1633         (Dwp_output_file::Section::contributions): New data member.
1634         (Dwp_output_file::Cu_or_tu_set): Remove.
1635         (Dwp_output_file::Section::Section): New ctor.
1636         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1637         (Dwp_output_file::Dwp_index::Section_table): New type.
1638         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1639         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1640         parameter.
1641         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1642         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1643         (Dwp_output_file::Dwp_index::section_table): New member function.
1644         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1645         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1646         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1647         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1648         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1649         (Dwp_output_file::Dwp_index::section_table_): New data member.
1650         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1651         (Dwp_output_file::add_output_section): New member function.
1652         (Dwp_output_file::write_new_section): New member function.
1653         (Dwp_output_file::write_contributions): New member function.
1654         (Dwp_output_file::section_id_map_): New data member.
1655         (class Dwo_id_info_reader): Remove.
1656         (class Unit_reader): New class.
1657         (get_dwarf_section_name): New function.
1658         (Dwo_file::read_executable): Adjust initializations of class data.
1659         (Dwo_file::read): Add support for v2 package file format.
1660         (Dwo_file::read_unit_index): Likewise.
1661         (Dwo_file::sized_read_unit_index): Likewise.
1662         (Dwo_file::copy_section): Likewise.
1663         (Dwo_file::add_unit_set): Likewise.
1664         (Dwp_output_file::add_output_section): Likewise.
1665         (Dwp_output_file::add_contribution): Likewise.
1666         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1667         for empty slot.
1668         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1669         file format.
1670         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1671         slot.
1672         (Dwp_output_file::initialize): Remove unused function.
1673         (Dwp_output_file::finalize): Add support for v2 package file format.
1674         (Dwp_output_file::write_index): Likewise.
1675         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1676         function prototype.
1677
1678 2013-03-01  Cary Coutant  <ccoutant@google.com>
1679
1680         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1681         function into class definition in header file.
1682         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1683         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1684         New function.
1685         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1686
1687 2013-02-28  Alan Modra  <amodra@gmail.com>
1688
1689         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1690         * target.cc (Target::do_plt_fde_location): New function.
1691         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1692         accessor function, and constructor param.
1693         (struct Post_fde, Post_fdes): Declare.
1694         (Cie::write): Add post_fdes param.
1695         * ehframe.cc (Fde::write): Use plt_fde_location.
1696         (struct Post_fde): Define.
1697         (Cie::write): Stash FDEs added post merge mapping.
1698         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1699         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1700         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1701         other FDEs.
1702         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1703         (Target_powerpc::has_glink): New function.
1704         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1705         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1706         glink_eh_frame_fde_32, default_fde): New data.
1707         (Stub_table::eh_frame_added_): New var.
1708         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1709         Make const.
1710         (Stub_table::add_eh_frame): New function.
1711         (Output_data_glink::add_eh_frame): New function.
1712         (Target_powerpc::make_glink_section): Call add_eh_frame.
1713
1714 2013-02-15  Ian Lance Taylor  <iant@google.com>
1715
1716         * options.h (DEFINE_uint64_alias): Define.
1717         (class General_options): Add -Ttext-segment as an alias for
1718         -Ttext.
1719
1720 2013-02-15  Alan Modra  <amodra@gmail.com>
1721
1722         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1723         (Stub_table::do_write): ..here, two places.
1724         (Stub_table::plt_call_size): Use it here too.
1725
1726 2013-02-11  Ian Lance Taylor  <iant@google.com>
1727
1728         * descriptors.cc (Descriptors::close_all): New function.
1729         * descriptors.h (class Descriptors): Declare close_all.
1730         (close_all_descriptors): New inline function.
1731         * plugin.cc: Include "descriptors.h".
1732         (Plugin_manager::cleanup): Call close_all_descriptors.
1733
1734 2013-02-06  Alan Modra  <amodra@gmail.com>
1735
1736         * README: Update coding style link.
1737
1738 2013-01-28  Cary Coutant  <ccoutant@google.com>
1739
1740         * dwp.cc (File_list): New typedef.
1741         (Dwo_name_info_reader): New class.
1742         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1743         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1744         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1745         (Dwo_file::read_executable): New function.
1746         (Dwo_file::read): Move common setup code to ...
1747         (Dwo_file::make_object): ... here.
1748         (dwp_options): Add --exec/-e.
1749         (usage): Likewise.
1750         (main): Likewise.
1751
1752 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1753
1754         * layout.cc (Layout::layout): Check for option text_reorder.
1755         (Layout::make_output_section): Ditto.
1756         * options.h (text_reorder): New option.
1757         * output.cc (Input_section_sort_compare): Remove special ordering
1758         of section names.
1759         (Output_section::
1760          Input_section_sort_section_name_special_ordering_compare::
1761          operator()): New function.
1762         (Output_section::sort_attached_input_sections): Use new sort function
1763         for .text.
1764         * output.h (Input_section_sort_section_name_special_ordering_compare):
1765         New struct.
1766         * testsuite/Makefile.am (text_section_grouping): Test option
1767         --no-text-reorder
1768         * testsuite/Makefile.in: Regenerate.
1769         * testsuite/text_section_grouping.sh: Check order of functions without
1770         default text reordering.
1771
1772 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1773
1774         * options.h (General_options): Change default to true for new_dtags.
1775
1776 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1777
1778         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1779         when enable_new_dtags is false.  Only add DT_RUNPATH when
1780         enable_new_dtags is true.
1781
1782 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1783
1784         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1785         used in declaration and definition consistent.
1786         (Target_powerpc::symval_for_branch): Ditto.
1787
1788 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1789
1790         * testsuite/plugin_final_layout.cc: Fix comment.
1791
1792 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1793
1794         * layout.cc (Layout::layout): Do not do default sorting for
1795         text sections when section ordering is specified.
1796         (make_output_section): Ditto.
1797         * testsuite/plugin_final_layout.cc: Name the function sections
1798         to catch reordering issues.
1799
1800 2013-01-15  Alan Modra  <amodra@gmail.com>
1801
1802         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1803         plt-thread-safe.
1804
1805 2013-01-15  Alan Modra  <amodra@gmail.com>
1806
1807         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1808         * testsuite/Makefile.in: Regenerate.
1809
1810 2013-01-14  Alan Modra  <amodra@gmail.com>
1811
1812         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1813         * testsuite/Makefile.in: Regenerate.
1814
1815 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1816
1817         PR bfd/14430
1818         Fix mingw gold build with plugins enabled
1819         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1820         * configure.ac: Export DLOPEN_LIBS and add headers check.
1821         * plugin.cc: Handle non-dlfcn case.
1822         * Makefile.in: Regenerate.
1823         * config.in: Regenerate.
1824         * configure: Regenerate.
1825         * testsuite/Makefile.in: Regenerate.
1826
1827 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1828
1829         * output.h (sort_attached_input_sections): Change to be public.
1830         * script-sections.cc
1831         (Output_section_definition::set_section_addresses): Sort
1832         attached input sections according to section order before linker
1833         script assigns section addresses.
1834         (Orphan_output_section::set_section_addresses): Sort
1835         attached input sections according to section order before linker
1836         script assigns section addresses.
1837         * Makefile.am (final_layout.sh): Use a simple linker script to
1838         check if section ordering still works.
1839         * Makefile.in: Regenerate.
1840
1841 2013-01-09  Ben Cheng  <bccheng@google.com>
1842
1843         * arm.cc (Target_arm::attributes_accept_div): New function.
1844         (Target_arm::attributes_forbid_div): New function.
1845         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1846         attribute using the same new functions as what bfd/elf32_arm.c
1847         does.
1848
1849 2013-01-07  Cary Coutant  <ccoutant@google.com>
1850
1851         PR gold/14993
1852         * output.cc (Output_section::add_input_section): For incremental
1853         updates, don't track input sections that are allocated from patch
1854         space.
1855
1856 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1857             Ian Lance Taylor  <iant@google.com>
1858
1859         PR gold/14897
1860         * configure.ac (--enable-ld): Removed.
1861         (install_as_default): Set to yes only for --enable-gold=default
1862         or --disable-ld.
1863         * configure: Regenerated.
1864
1865 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1866
1867         * options.h (General_options): Add -fuse-ld= for GCC linker
1868         option compatibility.
1869
1870 2013-01-04  Cary Coutant  <ccoutant@google.com>
1871
1872         * configure.ac: Fix typo restoring CXXFLAGS.
1873         * configure: Regenerate.
1874
1875 2013-01-04  Cary Coutant  <ccoutant@google.com>
1876
1877         * testsuite/Makefile.am (CXXLINK_S): New macro.
1878         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1879         * testsuite/Makefile.in: Regenerate.
1880
1881 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1882
1883         * version.cc (print_version): Update copyright year to 2013.
1884
1885 2012-12-20  Ian Lance Taylor  <iant@google.com>
1886
1887         * layout.cc (Layout::special_ordering_of_input_section): New
1888         function.
1889         (Layout::layout): If input section requires special ordering, must
1890         sort input sections.
1891         (Layout::make_output_section): May sort .text input sections.
1892         (Layout::is_section_name_prefix_grouped): Remove.
1893         * layout.h (class Layout): Declare
1894         special_ordering_of_input_section.  Don't declare
1895         is_section_name_prefix_grouped.
1896         * output.cc (Output_section::add_input_section): Revert last
1897         change.
1898         (Output_section::Input_section_sort::match_file_name): Don't crash
1899         if called on output section data.
1900         (Output_section::Input_section_sort_compare): Sort based on
1901         special ordering.
1902         (Output_section::Input_section_sort_section_order_index_compare):
1903         Revert last patch.
1904         (Output_section::sort_attached_input_sections): Likewise.
1905
1906 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1907
1908         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1909         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1910         * output.cc (Output_section::add_input_section): Check if section
1911         name contains special prefix.  Keep input sections to sort such
1912         sections.
1913         (Output_section::Input_section_sort_section_order_index_compare
1914          ::operator()): Group sections according to prefixes.
1915         (Output_section::sort_attached_input_sections): Add condition to
1916         Input_section_entry constructor call.
1917         * testsuite/Makefile.am (text_section_grouping): New test.
1918         * testsuite/Makefile.in: Regenerate.
1919         * testsuite/text_section_grouping.cc: New file.
1920         * testsuite/text_section_grouping.sh: New file.
1921
1922 2012-12-17  Nick Clifton  <nickc@redhat.com>
1923
1924         * Makefile.am: Add copyright notice.
1925         * NEWS: Likewise.
1926         * README: Likewise.
1927         * configure.ac: Likewise.
1928         * ftruncate.c: Likewise.
1929         * Makefile.in: Regenerate.
1930
1931 2012-12-14  Cary Coutant  <ccoutant@google.com>
1932
1933         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1934         --no-as-needed flag.
1935         (exception_separate_shared_12_test): Likewise.
1936         (incremental_copy_test): Likewise.
1937         * testsuite/Makefile.in: Regenerate.
1938
1939 2012-12-14  Cary Coutant  <ccoutant@google.com>
1940
1941         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1942         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1943
1944 2012-12-12  Alan Modra  <amodra@gmail.com>
1945
1946         * powerpc.cc (class Track_tls): New.
1947         (class Relocate, class Scan): Inherit Track_tls.
1948         (Target_powerpc::Scan::local, global): Track tls optimization
1949         and avoid creating plt entry for __tls_get_addr if all uses
1950         are optimized away.
1951         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1952
1953 2012-12-12  Alan Modra  <amodra@gmail.com>
1954
1955         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1956         Replace no_toc_optimize with toc_optimize.
1957         * output.h (Output_section::input_sections): Provide non-const variant.
1958         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1959         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1960         accessors.
1961         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1962         (class Sort_toc_sections): New.
1963         (Target_powerpc::do_finalize_sections): Sort toc sections.
1964         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1965
1966 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1967
1968         * testsuite/binary_unittest.cc (read_all): New function.
1969         (Sized_binary_test): Use it instead of ::read.
1970         * fileread.cc (do_read): Don't assume pread always reads the whole
1971         amount in a single call.
1972
1973 2012-12-10  Alan Modra  <amodra@gmail.com>
1974
1975         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1976         Set EM_PPC64 or EM_PPC here.
1977         (Target_selector_powerpc::do_recognize): Delete.
1978
1979 2012-12-10  Alan Modra  <amodra@gmail.com>
1980
1981         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1982         stub_table_.
1983         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1984
1985 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1986
1987         * testsuite/binary_unittest.cc (Sized_binary_test):
1988         Use open_descriptor rather than ::open.
1989
1990 2012-12-07  Alan Modra  <amodra@gmail.com>
1991
1992         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1993         typedef and invalid_address constant.
1994         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1995         instantiate constants.
1996
1997 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1998
1999         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2000         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2001         * aclocal.m4: Regenerate.
2002         * configure: Regenerate.
2003         * Makefile.in: Regenerate.
2004         * testsuite/Makefile.in: Regenerate.
2005
2006 2012-12-07  Alan Modra  <amodra@gmail.com>
2007
2008         * options.h (General_options): Add no_toc_optimize.
2009         * powerpc.cc (ok_lo_toc_insn): New function.
2010         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2011
2012 2012-12-06  Alan Modra  <amodra@gmail.com>
2013
2014         * options.h (General_options): Add plt_align, plt_static_chain,
2015         plt_thread_safe.  Update stub_group_size help text.
2016         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2017         for new plt_thread_safe_ var.
2018         (use_plt_offset): Correct comments.
2019         (Target_powerpc::do_relax): Look for thread creation symbols to
2020         determine default plt_thread_safe value.  Clear plt call stubs
2021         as well as branch stubs each iteration.
2022         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2023         insn constants.
2024         (l, hi, ha, write_insn): Move earlier.
2025         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2026         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2027         plt stubs too.
2028         (Stub_table::update_size): Adjust.
2029         (Stub_table::prev_size, set_prev_size): Delete.
2030         (Stub_table::stub_align): Let --plt-align affect result.
2031         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2032         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2033         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2034         (Stub_table::do_write): Support more stub variants.
2035
2036 2012-12-04  Alan Modra  <amodra@gmail.com>
2037
2038         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2039         (Target_powerpc::do_define_standard_symbols): New function.
2040
2041 2012-12-03  Alan Modra  <amodra@gmail.com>
2042
2043         * output.h: Formatting, whitespace.
2044
2045 2012-12-03  Alan Modra  <amodra@gmail.com>
2046
2047         * layout.h (Layout::get_executable_sections): Declare.
2048         * layout.cc (Layout::get_executable_sections): New function.
2049         * arm.cc (Target_arm::group_sections): Use it.
2050         (Arm_output_section::group_sections): Delete now redundant test.
2051         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2052         param to handle relative relocs.
2053         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2054         (Output_data_reloc::add_absolute): Adjust.
2055         (Output_data_reloc::add_relative): New function.
2056         (Output_data::reset_data_size): New function.
2057         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2058         (Output_section::set_addralign): New function.
2059         (Output_section::checkpoint_set_addralign): New function.
2060         (Output_section::clear_section_offsets_need_adjustment): New function.
2061         (Output_section::input_sections): Make public.
2062         * powerpc.cc (class Output_data_brlt_powerpc): New.
2063         (class Stub_table, class Stub_control): New.
2064         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2065         stub_table_, set_stub_table, stub_table): New vectors and accessor
2066         functions.
2067         (Target_powerpc::do_may_relax, do_relax, push_branch,
2068         new_stub_table, stub_tables, brlt_section, group_sections,
2069         add_branch_lookup_table, find_branch_lookup_table,
2070         write_branch_lookup_table, make_brlt_section): New functions.
2071         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2072         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2073         branch_info_): New vars.
2074         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2075         make call stubs here.
2076         (Output_data_glink): Remove all call stub handling from this class.
2077         (Target_powerpc::Scan::local, global): Save interesting branch
2078         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2079         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2080         functions on final link.
2081         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2082         Handle long branch destinations too.
2083         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2084         do_plt_address_for_local): Adjust lookup of plt call stubs.
2085
2086 2012-11-30  Alan Modra  <amodra@gmail.com>
2087
2088         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2089         relocs against protected symbols when building 32-bit shared libs.
2090
2091 2012-11-30  Alan Modra  <amodra@gmail.com>
2092
2093         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2094         param.  Call got_section() to make .got.  Update all callers
2095         and their callers and so on.
2096
2097 2012-11-30  Alan Modra  <amodra@gmail.com>
2098
2099         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2100         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2101         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2102         value if it already exists.
2103
2104 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2105
2106         PR gold/14858
2107         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2108
2109 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2110
2111         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2112         than bfc instruction for data sandboxing.
2113
2114 2012-11-08  Alan Modra  <amodra@gmail.com>
2115
2116         * po/POTFILES.in: Regenerate.
2117
2118 2012-11-05  Alan Modra  <amodra@gmail.com>
2119
2120         * configure.ac: Apply 2012-09-10 change to config.in here.
2121         * configure: Regenerate.
2122
2123 2012-11-05  Alan Modra  <amodra@gmail.com>
2124
2125         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2126         (struct Opd_ent): Use "Address" rather than "Offset".
2127         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2128         (Target_powerpc::got_section): Make public.
2129         (Target_powerpc::scan_relocs): Move code setting symbols..
2130         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2131         Create _SDA_BASE_ only when referenced.
2132
2133 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2134
2135         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2136         from last change.
2137
2138 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2139
2140         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2141         for offset_in_output_section parameter.
2142         (Sized_target::relocate_special_relocatable): Likewise.
2143         * arm.cc (Target_arm::relocate_relocs): Likewise.
2144         (Target_arm::relocate_special_relocatable): Likewise.
2145         * i386.cc (Target_i386::relocate_relocs): Likewise.
2146         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2147         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2148         * target-reloc.h (relocate_relocs): Likewise.
2149         * testsuite/testfile.cc (Target_test): Likewise.
2150         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2151         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2152
2153         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2154         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2155
2156         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2157         parameter, which is unused in the [!F_SETFD] case.
2158
2159         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2160         SYMNDX to off_t before comparing it to this->data_size().
2161         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2162         * incremental.cc (Output_section_incremental_inputs::do_write):
2163         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2164
2165         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2166
2167 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2168
2169         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2170         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2171         in EABI_VER5.
2172
2173 2012-10-29  Cary Coutant  <ccoutant@google.com>
2174
2175         * dwp.cc (usage): Add file and exit status parameters;
2176         add --help and --version options.
2177         (print_version): New function.
2178         (main): Add --help and --version options.
2179
2180 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2181
2182         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2183         final_layout_sequence.txt.
2184         * testsuite/Makefile.in: Regenerated.
2185
2186 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2187
2188         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2189         COMPILE generated by automake.
2190         (LINK1): Likewise.
2191         (CXXCOMPILE1): Likewise.
2192         (CXXLINK1): Likewise.
2193         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2194         (LINK): Likewise.
2195         (CXXCOMPILE): Likewise.
2196         (CXXLINK): Likewise.
2197         * testsuite/Makefile.in: Regenerated.
2198
2199 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2200
2201         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2202         on bad fwrite return.
2203
2204 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2205
2206         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2207         on val.
2208
2209 2012-10-23  Cary Coutant  <ccoutant@google.com>
2210
2211         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2212         * testsuite/Makefile.in: Regenerate.
2213         * testsuite/dwp_test.h: New source file.
2214         * testsuite/dwp_test_1.cc: New source file.
2215         * testsuite/dwp_test_1.s: New source file.
2216         * testsuite/dwp_test_1.sh: New source file.
2217         * testsuite/dwp_test_1b.cc: New source file.
2218         * testsuite/dwp_test_1b.s: New source file.
2219         * testsuite/dwp_test_2.cc: New source file.
2220         * testsuite/dwp_test_2.s: New source file.
2221         * testsuite/dwp_test_2.sh: New source file.
2222         * testsuite/dwp_test_main.cc: New source file.
2223         * testsuite/dwp_test_main.s: New source file.
2224
2225 2012-10-23  Cary Coutant  <ccoutant@google.com>
2226
2227         * dwp.h: New header file.
2228         * dwp.cc: New source file.
2229         * gold.h: Move shared declarations to system.h.
2230         * system.h: New header file.
2231         * Makefile.am: Add dwp.
2232         * Makefile.in: Regenerate.
2233
2234 2012-10-23  Cary Coutant  <ccoutant@google.com>
2235
2236         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2237         Dwarf_info_reader::read_from_pointer.
2238         (Dwarf_pubnames_table::read_header): Likewise.
2239         (Dwarf_pubnames_table::next_name): Likewise.
2240         (Dwarf_die::read_attributes): Likewise.
2241         (Dwarf_die::skip_attributes): Likewise.
2242         (Dwarf_info_reader::read_from_pointer): New function template.
2243         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2244         (Dwarf_pubnames_table): Likewise.
2245         (Dwarf_info_reader::read_from_pointer): New function template.
2246         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2247         Dwarf_pubnames_table ctor.
2248
2249 2012-10-23  Cary Coutant  <ccoutant@google.com>
2250
2251         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2252         abbrev_shndx.
2253         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2254         abbrev_shndx_.
2255         (Dwarf_info_reader::set_abbrev_shndx): New method.
2256         (Dwarf_info_reader::abbrev_shndx_): New data member.
2257
2258 2012-10-23  Cary Coutant  <ccoutant@google.com>
2259
2260         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2261         from object, not parameters.
2262         (Dwarf_info_reader::parse): Likewise.
2263         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2264         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2265         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2266         methods.
2267
2268 2012-10-23  Cary Coutant  <ccoutant@google.com>
2269
2270         * fileread.cc (Input_file::Input_file): New constructor.
2271         * fileread.h (class Input_file): Add new constructor.
2272
2273 2012-10-18  Alan Modra  <amodra@gmail.com>
2274
2275         PR gold/14727
2276         * object.cc (Relobj::is_section_name_included): Also match
2277         .sdata personality section.
2278
2279 2012-10-18  Alan Modra  <amodra@gmail.com>
2280
2281         * target-reloc.h (class Default_comdat_behavior): New, package up..
2282         (get_comdat_behaviour): ..this.
2283         (relocate_section): Add Relocate_comdat_behavior template arg,
2284         adjust code to suit.
2285         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2286         (Target_arm::scan_reloc_section): Likewise.
2287         * i386.cc (Target_i386::relocate_section): Likewise.
2288         * sparc.cc (Target_sparc::relocate_section): Likewise.
2289         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2290         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2291         * powerpc.cc (class Relocate_comdat_behavior): New.
2292         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2293         gold::relocate_section with new template arg.
2294
2295 2012-10-18  Alan Modra  <amodra@gmail.com>
2296
2297         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2298         dynamic relocs for GOT_TPREL got entries, without symbol if
2299         resolving locally.
2300         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2301         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2302         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2303
2304 2012-10-17  Alan Modra  <amodra@gmail.com>
2305
2306         PR gold/14726
2307         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2308
2309 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2310
2311         * layout.cc (Layout::include_section): Keep sections marked
2312         SHF_EXCLUDE when doing relocatable links.
2313
2314 2012-10-16  Alan Modra  <amodra@gmail.com>
2315
2316         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2317         (Target_powerpc::do_finalize_sections): Call it.
2318         (Output_data_save_res): New class and supporting functions.
2319         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2320         normal symbols defined in object files.
2321
2322 2012-10-12  Alan Modra  <amodra@gmail.com>
2323
2324         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2325         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2326         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2327         section if scan_opd_relocs not yet called.
2328         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2329
2330 2012-10-12  Alan Modra  <amodra@gmail.com>
2331
2332         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2333         add_local_ifunc_entry): Revert last change.
2334         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2335
2336 2012-10-05  Alan Modra  <amodra@gmail.com>
2337
2338         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2339         do_plt_address_for_global): New functions.
2340         (Output_data_got_powerpc::do_write): Don't segfault when linking
2341         statically.
2342         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2343         add_local_ifunc_entry): Return true on adding entry..
2344         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2345         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2346         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2347         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2348         set up symbols here.
2349         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2350         syms here.  Do so even when no .iplt.  Don't segfault when linking
2351         statically.
2352         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2353         new variants without reloc param.
2354         (Glink_sym_ent::Glink_sym_ent): Likewise.
2355         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2356         reloc when refs will resolve to plt call stub.
2357         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2358         R_PPC_PLTREL24 to resolve locally.
2359         (Target_powerpc::Scan::global): Correct ifunc handling.
2360         (Target_powerpc::Relocate::relocate): Correct local sym glink
2361         lookup.  Don't destroy "value" when we have a plt call stub,
2362         and when checking plt call validity.
2363         (Target_powerpc::do_dynsym_value): Simplify.
2364
2365 2012-10-05  Alan Modra  <amodra@gmail.com>
2366
2367         * i386.cc (Output_data_plt_i386::address_for_global,
2368         address_for_local): Add plt offset to returned value.  Adjust uses.
2369         * sparc.cc (Output_data_plt_sparc::address_for_global,
2370         address_for_local): Likewise.
2371         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2372         address_for_local): Likewise.
2373         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2374         address_for_local): Likewise.
2375         * target.h (Target::plt_address_for_global, plt_address_for_local):
2376         Update comment.
2377         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2378         (Output_data_got::Got_entry::write): Nor here.
2379         * output.h: Comment fix.
2380
2381 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2382
2383         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2384         global_offset_table_ value for larget got.
2385         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2386
2387 2012-09-29  Alan Modra  <amodra@gmail.com>
2388
2389         * powerpc.cc (Target_powerpc::iplt_): New output section.
2390         (Target_powerpc::iplt_section, make_iplt_section,
2391         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2392         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2393         Target_powerpc::plt_entry_count): Count iplt entries too.
2394         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2395         reloc section in constructor.  New params.
2396         (Target_powerpc::make_plt_section): Create reloc section here instead.
2397         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2398         functions.
2399         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2400         (Output_data_glink::add_entry, find_entry): New functions to
2401         deal with local syms.
2402         (Glink_sym_ent): Add support for local syms.
2403         (Output_data_glink::do_write): Handle ifunc plt entries.
2404         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2405         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2406         (Target_powerpc::Relocate::relocate): Likewise.
2407         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2408
2409 2012-09-25  Alan Modra  <amodra@gmail.com>
2410
2411         * object.h (Sized_relobj_file::adjust_local_symbol,
2412         do_adjust_local_symbol): New functions.
2413         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2414         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2415         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2416         and irregular opd entry spacing.
2417         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2418         (Global_symbol_visitor_opd): New functor.
2419         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2420         on deleted opd entries.
2421
2422 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2423
2424         * tilegx.cc: New file.
2425         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2426         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2427         * configure.tgt: Add entries for tilegx*.
2428         * configure.ac: Likewise.
2429         * Makefile.in: Rebuild.
2430         * configure: Likewise.
2431         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2432         tilegx.
2433
2434 2012-09-13  Alan Modra  <amodra@gmail.com>
2435
2436         * target-reloc.h (scan_relocs): Call scan.local for relocs
2437         against symbols in discarded sections.  Pass is_discarded
2438         param.
2439         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2440         Add is_discarded param.
2441         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2442         is_discarded to flag opd entry as discarded.  Don't emit dyn
2443         relocs on such entries.
2444         (Target_powerpc::Scan::global): Similarly detect and handle
2445         such opd entries.
2446         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2447         opd_ent_.  Update all uses.
2448         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2449         (Target_powerpc::relocate_section): Zero out discarded opd
2450         entry relocs.
2451
2452 2012-09-12  Ian Lance Taylor  <iant@google.com>
2453
2454         PR gold/14570
2455         * output.cc: Rename Output_data_got template parameter from size
2456         to got_size for all functions.  Compile all variants of
2457         Output_data_got.
2458         (Output_data_got::Got_entry::write): Correct use of size for
2459         symbol value.  Use local_is_tls rather than casting to
2460         Sized_relobj_file.
2461         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2462         (class Sized_relobj_file): Add do_local_is_tls.
2463         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2464
2465 2012-09-11  Alan Modra  <amodra@gmail.com>
2466
2467         PR gold/14566
2468         * layout.cc (Layout::set_segment_offsets): When using
2469         common-page-size alignment, ensure we are on a new max-page-size
2470         page.
2471         * output.cc (Output_segment::set_section_addresses): Use
2472         abi_pagesize, not common_pagesize for relro boundary.
2473         (Output_segment::set_offset): Likewise.
2474
2475 2012-09-11  Alan Modra  <amodra@gmail.com>
2476
2477         * output.h (Output_data_got::add_global_tls, add_local_tls,
2478         add_local_tls_pair): New functions.
2479         (Output_data_got::add_local_pair_with_rel): Remove second
2480         reloc param.  Expand comment.
2481         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2482         use_plt_or_tls_offset_, similarly for constructor param.
2483         (Output_data_got::Got_entry::write): Add got_index param.
2484         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2485         add_local_tls_pair): New functions.
2486         (Output_data_got::Got_entry::write): Handle tls symbols
2487         with use_plt_or_tls_offset_ set specially.
2488         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2489         (Output_data_got::do_write): Replace iterator with index, pass
2490         index to entry write function.
2491         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2492         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2493         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2494         call.
2495         * i386.cc (Target_i386::Scan::local): Likewise.
2496         * sparc.cc (Target_sparc::Scan::local): Likewise.
2497         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2498         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2499         do_tls_offset_for_global): New functions.
2500         (Target_powerpc::Scan::local): Correct TLS relocations and got
2501         entry values.
2502         (Target_powerpc::Scan::global): Don't emit unnecessary
2503         dynamic relocations on TLS GOT entries.
2504
2505 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2506
2507         * config.in: Disable sanity check for kfreebsd.
2508
2509 2012-09-10  Sterling Augustine  <saugustine@google.com>
2510
2511         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2512         (Gdb_index::pubtypes_read): New parameter.
2513         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2514         to calls.
2515         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2516         pubtypes_object_.
2517
2518 2012-09-09  Alan Modra  <amodra@gmail.com>
2519
2520         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2521         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2522         * gc.h (gc_process_relocs): Call target gc_add_reference.
2523         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2524         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2525         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2526         unnecessary cast.
2527         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2528         to cater for when we don't need code offset.  Update use.
2529         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2530         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2531         set_opd_valid): New functions.
2532         (Target_powerpc::do_gc_add_reference): New function.
2533         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2534         stashed refs.
2535         (Target_powerpc::do_gc_mark_symbol): New function.
2536
2537 2012-09-06  Cary Coutant  <ccoutant@google.com>
2538
2539         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2540         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2541         (Dwarf_die::skip_attributes): Likewise.
2542         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2543         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2544         (main): Call it.
2545         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2546
2547 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2548
2549         * testsuite/script_test_3.t: Add .got.plt output section
2550         statement.
2551         * testsuite/script_test_4.t: Likewise.
2552
2553 2012-09-05  Alan Modra  <amodra@gmail.com>
2554
2555         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2556         update all uses and lose "enum" when using type.
2557
2558 2012-09-05  Alan Modra  <amodra@gmail.com>
2559
2560         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2561         * configure: Regenerate.
2562         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2563         (plugin_final_layout.stdout): Likewise.
2564         (memory_test): Set page sizes to 0x1000.
2565         * testsuite/Makefile.in: Regenerate.
2566         * testsuite/discard_locals_test.sh: Add FIXME comment.
2567         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2568         * testsuite/pr14265.t: Add .got output section statement.
2569         * testsuite/script_test_2.t: Likewise.
2570         * testsuite/script_test_3.t: Likewise.
2571         * testsuite/script_test_4.t: Likewise.
2572         * testsuite/script_test_5.t: Likewise.
2573         * testsuite/script_test_6.t: Likewise.
2574         * testsuite/script_test_7.t: Likewise.
2575         * testsuite/script_test_9.t: Likewise.
2576
2577 2012-09-05  Alan Modra  <amodra@gmail.com>
2578
2579         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2580         (Powerpc_relocate_functions::Status): New typedef.
2581         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2582         (Target_powerpc::Scan::local): Handle REL64.
2583         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2584         for REL32 and REL64.
2585         (Target_powerpc::symval_for_branch): New function, extracted from..
2586         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2587         checks.  Report overflow errors.
2588
2589 2012-09-05  Alan Modra  <amodra@gmail.com>
2590
2591         * object.h (Sized_relobj_file::emit_relocs): Delete.
2592         (Sized_relobj_file::emit_relocs_reltype): Delete.
2593         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2594         relocate_relocs for --emit-relocs.
2595         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2596         * output.h: Update comment.
2597         (Output_segment::first_section): New function.
2598         (Output_segment::first_section_load_address): Use first_section.
2599         * output.cc (Output_segment::first_section): New function extracted..
2600         (Output_segment::first_section_load_address): ..from here.  Delete.
2601         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2602         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2603         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2604         adjust call to target.h function.
2605         * i386.cc (Target_i386): Likewise.
2606         * sparc.cc (Target_sparc): Likewise.
2607         * x86_64.cc (Target_x86_64): Likewise.
2608         * powerpc.cc (Target_powerpc): Likewise.
2609         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2610         first tls section has section symbol for optimised local dynamic
2611         output relocs.
2612         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2613         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2614         optimised tls code.
2615         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2616         Rename to relocate_relocs.  Update error message.
2617
2618 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2619
2620         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2621         --just-symbols.
2622
2623 2012-08-31  Alan Modra  <amodra@gmail.com>
2624
2625         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2626         (Powerpc_relobj::toc_base_offset): New stub function.
2627         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2628         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2629         (Target_powerpc::Relocate::enum skip_tls): New.
2630         (Target_powerpc::call_tls_get_addr_): New var.
2631         (Target_powerpc::is_branch_reloc): Move to file scope.
2632         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2633         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2634         New functions.
2635         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2636         (powerpc_info): Correct common_pagesize for ppc64.
2637         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2638         (Powerpc_relocate_functions): Add overflow check enums and functions.
2639         Add non-shift version of rela, rela_ua.  Delete all rel public
2640         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2641         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2642         addr16_ha3, addr14 functions.
2643         (Output_data_got_powerpc::add_constant_pair): New function.
2644         (Output_data_got_powerpc::got_base_offset): Likewise.
2645         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2646         (instruction constants): Sort, add some more.
2647         (Output_data_glink::do_write): Add and use Address typedef.  Use
2648         object->toc_base_offset() stub for 64-bit.
2649         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2650         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2651         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2652         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2653         Always treat .opd relocs as against locally defined symbol.
2654         Correct condition for RELATIVE relocs.
2655         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2656         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2657         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2658         calculations.  Handle TLS relocs, and more.  Add overflow
2659         checking and adjust for Powerpc_relocate_functions changes.
2660         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2661         Reinstate --emit-relocs code with FIXME.
2662
2663 2012-08-30  Alan Modra  <amodra@gmail.com>
2664
2665         * layout.cc (Layout::set_segment_offsets): Set p_align to
2666         abi_pagesize, not common_pagesize.
2667         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2668         to determine whether file header can go in segment.
2669
2670 2012-08-30  Alan Modra  <amodra@gmail.com>
2671
2672         * output.h (Output_reloc::Output_reloc <output section>): Add
2673         is_relative param.  Adjust calls.
2674         (Output_reloc::add_output_section_relative): New functions.
2675         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2676         is_relative.
2677         (Output_reloc::symbol_value): Handle SECTION_CODE.
2678
2679 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2680
2681         * gold.cc (queue_middle_tasks): Call layout again when unique
2682         segments for sections is desired.
2683         * layout.cc (Layout::Layout): Initialize new members.
2684         (Layout::get_output_section_flags): New function.
2685         (Layout::choose_output_section): Call get_output_section_flags.
2686         (Layout::layout): Make output section for mapping to a unique segment.
2687         (Layout::insert_section_segment_map): New function.
2688         (Layout::attach_allocated_section_to_segment): Make unique segment for
2689         output sections marked so.
2690         (Layout::segment_precedes): Check for unique segments when sorting.
2691         * layout.h (Layout::Unique_segment_info): New struct.
2692         (Layout::Section_segment_map): New typedef.
2693         (Layout::insert_section_segment_map): New function.
2694         (Layout::get_output_section_flags): New function.
2695         (Layout::is_unique_segment_for_sections_specified): New function.
2696         (Layout::set_unique_segment_for_sections_specified): New function.
2697         (Layout::unique_segment_for_sections_specified_): New member.
2698         (Layout::section_segment_map_): New member.
2699         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2700         Rename is_gc_pass_one to is_pass_one.
2701         Rename is_gc_pass_two to is_pass_two.
2702         Rename is_gc_or_icf to is_two_pass.
2703         Check for which pass based on whether symbols data is present.
2704         Make it two pass when unique segments for sections is desired.
2705         * output.cc (Output_section::Output_section): Initialize new
2706         members.
2707         * output.h (Output_section::is_unique_segment): New function.
2708         (Output_section::set_is_unique_segment): New function.
2709         (Output_section::is_unique_segment_): New member.
2710         (Output_section::extra_segment_flags): New function.
2711         (Output_section::set_extra_segment_flags): New function.
2712         (Output_section::extra_segment_flags_): New member.
2713         (Output_section::segment_alignment): New function.
2714         (Output_section::set_segment_alignment): New function.
2715         (Output_section::segment_alignment_): New member.
2716         (Output_segment::Output_segment): Initialize is_unique_segment_.
2717         (Output_segment::is_unique_segment): New function.
2718         (Output_segment::set_is_unique_segment): New function.
2719         (Output_segment::is_unique_segment_): New member.
2720         * plugin.cc (allow_unique_segment_for_sections): New function.
2721         (unique_segment_for_sections): New function.
2722         (Plugin::load): Add new functions to transfer vector.
2723         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2724         * Makefile.in: Regenerate.
2725         * testsuite/plugin_final_layout.sh: Check if unique segment
2726         functionality works.
2727         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2728         are available.
2729         (allow_unique_segment_for_sections): New global.
2730         (unique_segment_for_sections): New global.
2731         (claim_file_hook): Call allow_unique_segment_for_sections.
2732         (all_symbols_read_hook): Call unique_segment_for_sections.
2733
2734 2012-08-22  Cary Coutant  <ccoutant@google.com>
2735
2736         * layout.cc (Layout::include_section): Don't assert on GROUP
2737         sections with --emit-relocs.
2738
2739 2012-08-21  Cary Coutant  <ccoutant@google.com>
2740
2741         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2742         if --export-dynamic-symbol names an undef symbol.
2743
2744 2012-08-18  Alan Modra  <amodra@gmail.com>
2745
2746         * powerpc.cc: Formatting and white space.
2747         (Powerpc_relobj): Rename got2_section_ to special_.
2748         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2749         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2750         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2751         (Target_powerpc): Add Address typedef and invalid_address.  Use
2752         throughout.
2753         (Target_powerpc::is_branch_reloc): New function.
2754         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2755         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2756         for dst_mask, value and addend.
2757         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2758         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2759         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2760         uint16_t for 24-bit offset.  Use get_output_section_offset and
2761         check return.
2762         (Target_powerpc::Scan::local): Handle more relocs.
2763         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2764         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2765         Plug in toc restoring insn after plt calls.  Translate branches
2766         to function descriptor symbols to corresponding entry point.
2767         (Target_powerpc::relocate_for_relocatable): Check return from
2768         get_output_section_offset.
2769         * symtab.h: Comment typo.
2770
2771 2012-08-14  Ian Lance Taylor  <iant@google.com>
2772
2773         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2774         unsupported_relocal_local to call unsupported_reloc_global.
2775
2776 2012-08-14  Nick Clifton  <nickc@redhat.com>
2777
2778         PR ld/14265
2779         * script-sections.cc (Sections_element::output_section_name): Add
2780         keep return parameter.
2781         (Output_section_element::match_name): Add keep return parameter.
2782         Return the value of the keep_ member.
2783         * script-sections.h (class Output_section): Update
2784         output_section_name prototype.
2785         * layout.cc (Layout::keep_input_section): New public member
2786         function.
2787         (Layout::choose_output_section): Pass keep parameter to
2788         output_section_name.
2789         * layout.h (class Layout): Add keep_input_section.
2790         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2791         sections.
2792         * testsuite/Makefile.am: Add a test.
2793         * testsuite/Makefile.in: Regenerate.
2794         * testsuite/pr14265.c: Source file for the test.
2795         * testsuite/pr14265.t: Linker script for the test.
2796         * testsuite/pr14265.sh: Shell script for the test.
2797
2798 2012-08-14  Alan Modra  <amodra@gmail.com>
2799
2800         * target.h (Target::output_section_name): New function.
2801         (Target::do_output_section_name): New function.
2802         * layout.cc (Layout::choose_output_section): Call the above.
2803         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2804
2805 2012-08-14  Alan Modra  <amodra@gmail.com>
2806
2807         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2808         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2809         for replace_constant call.
2810         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2811         (Output_data_glink::do_print_to_mapfile): New function.
2812         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2813         (Target_powerpc::Relocate::relocate): Likewise.
2814
2815 2012-08-14  Alan Modra  <amodra@gmail.com>
2816
2817         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2818         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2819         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2820         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2821         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2822         here.
2823         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2824         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2825         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2826         here.
2827         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2828         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2829
2830 2012-08-12  Alan Modra  <amodra@gmail.com>
2831
2832         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2833         (glink insn constants): Use uint32_t.
2834         (Output_data_glink::add_entry): Use insert, not [] operator.
2835
2836 2012-08-11  Alan Modra  <amodra@gmail.com>
2837
2838         * object.h (Sized_relobj_file::find_shdr): New function.
2839         (Sized_relobj_file::find_special_sections): New function.
2840         * object.cc (Sized_relobj_file::find_shdr): New function.
2841         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2842         (Sized_relobj_file::find_special_sections): New function, split out..
2843         (Sized_relobj_file::do_read_symbols): ..from here.
2844         * output.h (Output_data_got::replace_constant): New function.
2845         (Output_data_got::num_entries): New function.
2846         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2847         (Output_data_got::got_offset): Protected rather than private.
2848         (Output_data_got::replace_got_entry): New function.
2849         * output.cc (Output_data_got::replace_got_entry): New function.
2850         * powerpc.cc (class Powerpc_relobj): New.
2851         (class Powerpc_relocate_functions): Delete all psymval variants or
2852         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2853         Implement _ha functions using corresponding _hi function.
2854         (Powerpc_relobj::find_special_sections): New function.
2855         (Target_powerpc::do_make_elf_object): New function.
2856         (class Output_data_got_powerpc): New.
2857         (class Output_data_glink): New.
2858         (class Powerpc_scan_relocatable_reloc): New.
2859         Many more changes througout file.
2860
2861 2012-08-09  Nick Clifton  <nickc@redhat.com>
2862
2863         * po/vi.po: Updated Vietnamese translation.
2864
2865 2012-08-07  Ian Lance Taylor  <iant@google.com>
2866
2867         * layout.cc (Layout::add_target_dynamic_tags): If
2868         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2869         plt_rel.
2870
2871 2012-07-30  Nick Clifton  <nickc@redhat.com>
2872
2873         * po/gold.pot: Updated template.
2874         * po/es.po: Updated Spanish translation.
2875
2876 2012-07-18  Cary Coutant  <ccoutant@google.com>
2877
2878         PR gold/14344
2879         * configure.ac: Add check for -gpubnames support.
2880         * configure: Regenerate.
2881         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2882         support; force -gno-pubnames.
2883         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2884         support.
2885         (gdb_index_test_4): New test.
2886         * testsuite/Makefile.in: Regenerate.
2887         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2888         * testsuite/gdb_index_test_2.sh: Likewise.
2889         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2890         * testsuite/gdb_index_test_4.sh: New script.
2891         * testsuite/gdb_index_test_comm.sh: New script with common code;
2892         don't look for space after colon.
2893
2894 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2895
2896         * gold.cc (queue_middle_tasks): Update function order only after
2897         deferred objects due to plugins are processed.
2898
2899 2012-07-11  Ian Lance Taylor  <iant@google.com>
2900
2901         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2902         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2903         (Target_arm::scan_reloc_for_stub): Likewise.
2904         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2905         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2906         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2907         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2908         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2909
2910 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2911             Ian Lance Taylor  <iant@google.com>
2912
2913         PR gold/14309
2914         * configure.ac: Test whether std::tr1::hash<off_t> works.
2915         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2916         needed.
2917         * output.h (class Output_fill): Add virtual destructor.
2918         * configure, config.in: Rebuild.
2919
2920 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2921
2922         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2923
2924 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2925
2926         * plugin.cc (Plugin::load): Handle position independent executables.
2927
2928 2012-06-06  Cary Coutant  <ccoutant@google.com>
2929
2930         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2931         add .debug_macro.
2932         (lines_only_debug_sections): Likewise.
2933         (gdb_fast_lookup_sections): New static array.
2934         (is_gdb_debug_section): Rename formal parameter.
2935         (is_lines_only_debug_section): Likewise.
2936         (is_gdb_fast_lookup_section): New function.
2937         (Layout::include_section): Check for ".zdebug_" prefix; pass
2938         section name suffix to is_gdb_debug_section, et al.; check for
2939         fast-lookup sections when building .gdb_index.
2940         * options.h (--strip-debug-gdb): Update GDB version number.
2941
2942 2012-06-06  Cary Coutant  <ccoutant@google.com>
2943
2944         * configure.ac: Add check for fallocate.
2945         * configure: Regenerate.
2946         * config.in: Regenerate.
2947
2948         * options.h (class General_options): Add --mmap-output-file and
2949         --posix-fallocate options.
2950         * output.cc: (posix_fallocate): Remove; replace with...
2951         (gold_fallocate): New function.
2952         (Output_file::map_no_anonymous): Call gold_fallocate.
2953         (Output_file::map): Check --mmap-output-file option.
2954
2955 2012-06-05  Jing Yu  <jingyu@google.com>
2956
2957         * gold.h (textdomain): Add do {} to empty while(0).
2958         (bindtextdomain): Likewise.
2959
2960 2012-06-04  Cary Coutant  <ccoutant@google.com>
2961
2962         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2963         has_dynsym_index.
2964
2965 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2966
2967         * symtab.cc (Symbol_table::define_special_symbol):
2968         Initialize *poldsym to prevent uninitialized variable errors.
2969
2970 2012-05-23  Cary Coutant  <ccoutant@google.com>
2971
2972         * layout.cc (Layout::section_name_mapping): Add rules to handle
2973         exact match on .data.rel.ro.local or .data.rel.ro.
2974         (Layout::output_section_name): Check for exact matches.
2975
2976 2012-05-23  Cary Coutant  <ccoutant@google.com>
2977
2978         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2979         more carefully.
2980
2981 2012-05-22  Cary Coutant  <ccoutant@google.com>
2982
2983         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2984         object before exporting symbol.
2985
2986 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2987
2988         * testsuite/tls_test.cc: Include "config.h" first.
2989         * testsuite/tls_test_c.c: Likewise.
2990
2991 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2992             Nick Clifton  <nickc@redhat.com>
2993
2994         PR 14072
2995         * configure.in: Add check that sysdep.h has been included before
2996         any system header files.
2997         * configure: Regenerate.
2998         * config.in: Regenerate.
2999
3000 2012-05-14  Cary Coutant  <ccoutant@google.com>
3001
3002         * layout.cc (Layout::make_output_section): Mark .tdata section
3003         as RELRO.
3004         * testsuite/relro_test.cc: Add a TLS variable.
3005
3006 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3007
3008         PR gold/14091
3009         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3010         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3011         R_X86_64_64.
3012
3013 2012-05-08  Cary Coutant  <ccoutant@google.com>
3014
3015         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3016         (lines_only_debug_sections): Likewise.
3017
3018 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3019
3020         * nacl.cc: New file.
3021         * nacl.h: New file.
3022         * Makefile.am (CCFILES, HFILES): Add them.
3023         * Makefile.in: Regenerate.
3024         * i386.cc (Output_data_plt_i386_nacl): New class.
3025         (Output_data_plt_i386_nacl_exec): New class.
3026         (Output_data_plt_i386_nacl_dyn): New class.
3027         (Target_i386_nacl): New class.
3028         (Target_selector_i386_nacl): New class.
3029         (target_selector_i386): Use it instead of Target_selector_i386.
3030         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3031         (Target_x86_64_nacl): New class.
3032         (Target_selector_x86_64_nacl): New class.
3033         (target_selector_x86_64, target_selector_x32): Use it instead of
3034         Target_selector_x86_64.
3035         * arm.cc (Output_data_plt_arm_nacl): New class.
3036         (Target_arm_nacl): New class.
3037         (Target_selector_arm_nacl): New class.
3038         (target_selector_arm, target_selector_armbe): Use it instead of
3039         Target_selector_arm.
3040
3041         * target-select.cc (select_target): Take new Input_file* and off_t
3042         arguments, pass them on to recognize method of selector.
3043         * object.cc (make_elf_sized_object): Update caller.
3044         * parameters.cc (parameters_force_valid_target): Likewise.
3045         * incremental.cc (make_sized_incremental_binary): Likewise.
3046         * target-select.h: Update decl.
3047         (Target_selector::recognize): Take new Input_file* argument,
3048         pass it on to do_recognize.
3049         (Target_selector::do_recognize): Take new Input_file* argument.
3050         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3051         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3052         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3053         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3054
3055         * target.h (Target::Target_info): New members isolate_execinstr
3056         and rosegment_gap.
3057         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3058         * arm.cc (Target_arm::arm_info): Update initializer.
3059         * i386.cc (Target_i386::i386_info): Likewise.
3060         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3061         * sparc.cc (Target_sparc::sparc_info): Likewise.
3062         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3063         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3064         * layout.cc (Layout::attach_allocated_section_to_segment):
3065         Take new const Target* argument.  If target->isolate_execinstr(), act
3066         like --rosegment.
3067         (Layout::find_first_load_seg): Take new const Target* argument;
3068         if target->isolate_execinstr(), reject PF_X segments.
3069         (Layout::relaxation_loop_body): Update caller.
3070         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3071         reset file offset to zero when we hit LOAD_SEG, and then do a second
3072         loop over the segments before LOAD_SEG to reassign offsets after
3073         addresses have been determined.  Handle target->rosegment_gap().
3074         (Layout::attach_section_to_segment): Take new const Target* argument;
3075         pass it to attach_allocated_section_to_segment.
3076         (Layout::make_output_section): Update caller.
3077         (Layout::attach_sections_to_segments): Take new const Target* argument;
3078         pass it to attach_section_to_segment.
3079         * gold.cc (queue_middle_tasks): Update caller.
3080         * layout.h (Layout): Update method decls with new arguments.
3081
3082         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3083         Target_info pointer to use.
3084         (Target_arm::do_make_data_plt): New virtual method.
3085         (Target_arm::make_data_plt): New method that calls it.
3086         (Target_arm::make_plt_entry): Use it.
3087         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3088         for the section alignment.
3089         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3090         method.
3091         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3092         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3093         method.
3094         (Output_data_plt_arm::get_plt_entry_size): Call it.
3095         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3096         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3097         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3098         method.
3099         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3100         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3101         method instead of sizeof(plt_entry).
3102         (Output_data_plt_arm::add_entry): Likewise.
3103         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3104         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3105         than static method.
3106         (Target_arm::plt_entry_size): Likewise.
3107         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3108         Move to ...
3109         (Output_data_plt_arm_standard): ... here, new class.
3110         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3111         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3112         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3113
3114         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3115         Take additional argument for the PLT entry size.
3116         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3117         Use get_plt_entry_size method rather than plt_entry_size variable.
3118         (Output_data_plt_x86_64::reserve_slot): Likewise.
3119         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3120         (Output_data_plt_x86_64::add_entry): Likewise.
3121         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3122         (Output_data_plt_x86_64::address_for_global): Likewise.
3123         (Output_data_plt_x86_64::address_for_local): Likewise.
3124         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3125         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3126         Make method non-static.
3127         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3128         method.
3129         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3130         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3131         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3132         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3133         virtual method.
3134         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3135         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3136         virtual method.
3137         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3138         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3139         virtual method.
3140         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3141         (Output_data_plt_x86_64::plt_entry_size)
3142         (Output_data_plt_x86_64::first_plt_entry)
3143         (Output_data_plt_x86_64::plt_entry)
3144         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3145         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3146         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3147         (Output_data_plt_x86_64_standard): ... here, new class.
3148         (Target_x86_64::Target_x86_64): Take optional argument for the
3149         Target_info pointer to use.
3150         (Target_x86_64::do_make_data_plt): New virtual method.
3151         (Target_x86_64::make_data_plt): New method to call it.
3152         (Target_x86_64::init_got_plt_for_update): Use that.
3153         Call this->plt_->add_eh_frame method here.
3154         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3155         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3156         rather than static method.
3157         (Target_x86_64::plt_entry_size): Likewise.
3158         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3159         rather than plt_entry_size variable.  Move guts of PLT filling to...
3160         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3161         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3162         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3163
3164         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3165         additional argument for the section alignment.
3166         Don't do add_eh_frame_for_plt here.
3167         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3168         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3169         variable.
3170         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3171         method.
3172         (Output_data_plt_i386::get_plt_entry_size): Call it.
3173         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3174         (Output_data_plt_i386::add_eh_frame): New method to call it.
3175         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3176         method.
3177         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3178         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3179         method.
3180         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3181         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3182         method instead of plt_entry_size.
3183         (Output_data_plt_i386::plt_entry_size)
3184         (Output_data_plt_i386::plt_eh_frame_fde_size)
3185         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3186         (Output_data_plt_i386_standard): ... here, new class.
3187         (Output_data_plt_i386_exec): New class.
3188         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3189         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3190         (Output_data_plt_i386::exec_plt_entry): Move to ...
3191         (Output_data_plt_i386_exec::plt_entry): ... here.
3192         (Output_data_plt_i386_dyn): New class.
3193         (Output_data_plt_i386::first_plt_entry): Move to ...
3194         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3195         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3196         (Output_data_plt_i386_dyn::plt_entry): ... here.
3197         (Target_i386::Target_i386): Take optional argument for the Target_info
3198         pointer to use.
3199         (Target_i386::do_make_data_plt): New virtual method.
3200         (Target_i386::make_data_plt): New method to call it.
3201         (Target_i386::make_plt_section): Use that.
3202         Call this->plt_->add_eh_frame method here.
3203         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3204         rather than plt_entry_size variable.
3205         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3206         (Output_data_plt_i386::address_for_local): Likewise.
3207         (Output_data_plt_i386::do_write): Likewise.
3208         Move guts of PLT filling to...
3209         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3210         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3211         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3212         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3213
3214 2012-05-01  Cary Coutant  <ccoutant@google.com>
3215
3216         * dwarf_reader.cc (Dwarf_die::read_attributes)
3217         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3218         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3219         * reduced_debug_output.cc
3220         (Output_reduced_debug_info_section::get_die_end): Remove
3221         DW_FORM_GNU_ref_index.  Add default case.
3222
3223 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3224
3225         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3226         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3227         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3228         DW_AT_high_pc as offset from DW_AT_low_pc.
3229
3230         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3231         * testsuite/Makefile.in: Regenerate.
3232         * testsuite/gdb_index_test_3.c: New test source file.
3233         * testsuite/gdb_index_test_3.sh: New test source file.
3234
3235 2012-04-25  Ian Lance Taylor  <iant@google.com>
3236
3237         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3238         pointer.
3239         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3240         as a class, not a struct.
3241         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3242         (Target_arm::apply_cortex_a8_workaround): Likewise.
3243         * gc.h: Declare Reloc_types as a struct, not a class.
3244         * object.h: Declare Symbols_data as a struct.
3245         * reloc.h: Declare Read_relocs_data as a struct.
3246         * target.h: Declare Relocate_info as a struct.
3247
3248 2012-04-24  David S. Miller  <davem@davemloft.net>
3249
3250         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3251         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3252         and R_SPARC_WPLT30.
3253
3254 2012-04-24  Cary Coutant  <ccoutant@google.com>
3255
3256         * incremental-dump.cc (find_input_containing_global): Replace
3257         magic number with symbolic constant.
3258         (dump_incremental_inputs): Update version number.
3259         * incremental.cc (Output_section_incremental_inputs): Update version
3260         number; import symbolic constants from Incremental_inputs_reader.
3261         (Incremental_inputs::create_data_sections): Align relocations
3262         section correctly for 64-bit targets.
3263         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3264         constants; add padding.
3265         (Output_section_incremental_inputs::write_header): Add assert for
3266         header_size.
3267         (Output_section_incremental_inputs::write_input_files): Add assert
3268         for input_entry_size.
3269         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3270         add assert for object_info_size, input_section_entry_size,
3271         global_sym_entry_size.
3272         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3273         for data structure sizes; use them.
3274         (Incremental_input_entry_reader): Import symbolic constants from
3275         Incremental_inputs_reader; use them.
3276
3277 2012-04-23  David S. Miller  <davem@davemloft.net>
3278
3279         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3280         and elf_flags_set_.
3281         (Target_sparc::Target_sparc): Initialize new fields.
3282         (Target_sparc::do_make_elf_object): New function.
3283         (Target_sparc::do_adjust_elf_header): New function.
3284
3285 2012-04-23  Cary Coutant  <ccoutant@google.com>
3286
3287         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3288         CU range table of gdb index.
3289
3290 2012-04-20  David S. Miller  <davem@davemloft.net>
3291
3292         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3293         instead of false.
3294
3295 2012-04-16  David S. Miller  <davem@davemloft.net>
3296
3297         * sparc.cc (Target_sparc::got_address): New function.
3298         (Sparc_relocate_functions::gdop_hix22): New function.
3299         (Sparc_relocate_functions::gdop_lox10): New function.
3300         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3301         relocs.
3302         (Target_sparc::Scan::local): Likewise if the global symbol is not
3303         preemptible and is not IFUNC.
3304         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3305         transformations for local and non-preemptible non-IFUNC global
3306         symbols.
3307
3308         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3309         writing out 64-bit part of ranges.
3310
3311         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3312         -fpic and -fpie respectively.
3313         * Makefile.in: Regenerate.
3314
3315         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3316         (Target_sparc::Target_sparc): Initialize new field.
3317         (Target_sparc::do_plt_section_for_global): New function.
3318         (Target_sparc::do_plt_section_for_local): New function.
3319         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3320         (Target_sparc::make_plt_section): New function, broken out of
3321         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3322         (Target_sparc::make_plt_entry): Call make_plt_section.
3323         (Target_sparc::make_local_ifunc_plt_entry): New function.
3324         (Target_sparc::rela_ifunc_section): New function.
3325         (Target_sparc::plt_section): Remove const.
3326         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3327         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3328         and ifunc_count_ fields.
3329         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3330         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3331         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3332         (Output_data_plt_sparc::rela_ifunc): New function.
3333         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3334         (Output_data_plt_sparc::has_ifunc_section): New function.
3335         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3336         (Output_data_plt_sparc::address_for_global): New function.
3337         (Output_data_plt_sparc::address_for_local): New function.
3338         (Output_data_plt_sparc::plt_index_to_offset): New function.
3339         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3340         and entry_count.
3341         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3342         entry_count.
3343         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3344         R_SPARC_JMP_IREL to switch.
3345         (Target_sparc::Scan::check_non_pic): Likewise.
3346         (Target_sparc::Scan::local): Handle IFUNC symbols.
3347         (Target_sparc::Scan::local): Likewise.
3348         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3349         and plt_address_for_local.
3350         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3351         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3352
3353         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3354         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3355         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3356         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3357         global relocs too.
3358         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3359         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3360         calls.
3361         * sparc.cc (Target_sparc::Scan::global): Likewise.
3362         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3363
3364 2012-04-16  Cary Coutant  <ccoutant@google.com>
3365
3366         * archive.cc (Library_base::should_include_member): Check for
3367         --export-dynamic-symbol.
3368         * options.h (class General_options): Add --export-dynamic-symbol.
3369         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3370         --export-dynamic-symbol.
3371         (Symbol_table::gc_mark_undef_symbols): Likewise.
3372         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3373
3374 2012-04-12  David S. Miller  <davem@davemloft.net>
3375
3376         * sparc.cc (Reloc::wdisp10): New relocation method.
3377         (Reloc::h34): Likewise.
3378         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3379         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3380         R_SPARC_WDISP10.
3381         (Target_sparc::Scan::local): Likewise.
3382         (Target_sparc::Scan::global): Likewise.
3383         (Target_sparc::Relocate::relocate): Likewise.
3384
3385 2012-04-09  Cary Coutant  <ccoutant@google.com>
3386
3387         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3388         low_pc == 0.
3389
3390 2012-04-06  Ian Lance Taylor  <iant@google.com>
3391
3392         * timer.cc: #include <unistd.h>.
3393
3394 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3395
3396         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3397         * config.in: Regenerate.
3398         * configure: Regenerate.
3399
3400 2012-04-05  Nick Clifton  <nickc@redhat.com>
3401
3402         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3403         (AM_LC_MESSAGES): Add.
3404         * aclocal.m4: Regenerate.
3405         * config.in: Regenerate.
3406         * configure: Regenerate.
3407
3408 2012-03-21  Cary Coutant  <ccoutant@google.com>
3409
3410         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3411         * Makefile.in: Regenerate.
3412         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3413         (Sized_elf_reloc_mapper::symbol_section): New function.
3414         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3415         (make_elf_reloc_mapper): New function.
3416         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3417         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3418         (Dwarf_abbrev_table::do_get_abbrev): New function.
3419         (Dwarf_ranges_table::read_ranges_table): New function.
3420         (Dwarf_ranges_table::read_range_list): New function.
3421         (Dwarf_pubnames_table::read_section): New function.
3422         (Dwarf_pubnames_table::read_header): New function.
3423         (Dwarf_pubnames_table::next_name): New function.
3424         (Dwarf_die::Dwarf_die): New function.
3425         (Dwarf_die::read_attributes): New function.
3426         (Dwarf_die::skip_attributes): New function.
3427         (Dwarf_die::set_name): New function.
3428         (Dwarf_die::set_linkage_name): New function.
3429         (Dwarf_die::attribute): New function.
3430         (Dwarf_die::string_attribute): New function.
3431         (Dwarf_die::int_attribute): New function.
3432         (Dwarf_die::uint_attribute): New function.
3433         (Dwarf_die::ref_attribute): New function.
3434         (Dwarf_die::child_offset): New function.
3435         (Dwarf_die::sibling_offset): New function.
3436         (Dwarf_info_reader::check_buffer): New function.
3437         (Dwarf_info_reader::parse): New function.
3438         (Dwarf_info_reader::do_parse): New function.
3439         (Dwarf_info_reader::do_read_string_table): New function.
3440         (Dwarf_info_reader::lookup_reloc): New function.
3441         (Dwarf_info_reader::get_string): New function.
3442         (Dwarf_info_reader::visit_compilation_unit): New function.
3443         (Dwarf_info_reader::visit_type_unit): New function.
3444         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3445         Sized_elf_reloc_mapper.
3446         (Sized_dwarf_line_info::symbol_section): Remove function.
3447         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3448         (Sized_dwarf_line_info::read_line_mappings): Remove object
3449         parameter, adjust callers.
3450         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3451         * dwarf_reader.h: Include <sys/types.h>.
3452         (class Track_relocs): Remove forward declaration.
3453         (class Elf_reloc_mapper): New class.
3454         (class Sized_elf_reloc_mapper): New class.
3455         (class Dwarf_abbrev_table): New class.
3456         (class Dwarf_range_list): New class.
3457         (class Dwarf_ranges_table): New class.
3458         (class Dwarf_pubnames_table): New class.
3459         (class Dwarf_die): New class.
3460         (class Dwarf_info_reader): New class.
3461         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3462         (Sized_dwarf_line_info::symbol_section): Remove member function.
3463         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3464         base class.
3465         * gdb-index.cc: New source file.
3466         * gdb-index.h: New source file.
3467         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3468         and .debug_types sections, call Layout::add_to_gdb_index.
3469         (Sized_relobj_incr::do_section_name): Implement.
3470         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3471         return type; Implement.
3472         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3473         return type.
3474         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3475         parameter list and return type.
3476         (Sized_incr_dynobj::do_section_contents): Likewise.
3477         * layout.cc: Include gdb-index.h.
3478         (Layout::Layout): Initialize gdb_index_data_.
3479         (Layout::init_fixed_output_section): Check for .gdb_index section.
3480         (Layout::add_to_gdb_index): New function. Instantiate.
3481         * layout.h: Add forward declaration for class Gdb_index.
3482         (Layout::add_to_gdb_index): New member function.
3483         (Layout::gdb_index_data_): New data member.
3484         * main.cc: Include gdb-index.h.
3485         (main): Print statistics for gdb index.
3486         * object.cc (Object::section_contents): Move code into
3487         do_section_contents.
3488         (need_decompressed_section): Check for sections needed when building
3489         gdb index.
3490         (build_compressed_section_map): Likewise.
3491         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3492         gdb index.
3493         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3494         sections; call Layout::add_to_gdb_index.
3495         (Sized_relobj_file::do_decompressed_section_contents): Call
3496         do_section_contents directly.
3497         * object.h (Object::do_section_contents): Adjust parameter list and
3498         return type.
3499         (Object::do_decompressed_section_contents): Call do_section_contents
3500         directly.
3501         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3502         return type.
3503         * options.h (class General_options): Add --gdb-index option.
3504         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3505         list and return type.
3506         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3507         * reloc.h (Track_relocs::checkpoint): New function.
3508         (Track_relocs::reset): New function.
3509
3510         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3511         New test cases.
3512         * testsuite/Makefile.in: Regenerate.
3513         * testsuite/gdb_index_test.cc: New test source file.
3514         * testsuite/gdb_index_test_1.sh: New test source file.
3515         * testsuite/gdb_index_test_2.sh: New test source file.
3516
3517 2012-03-19  Doug Kwan  <dougkwan@google.com>
3518
3519         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3520         (Target_arm::do_finalize_sections): Remove code which defines
3521         __exidx_start and __exidx_end.  Make symbol table parameter
3522         anonymous as it is not used.
3523         * gold.cc (queue_middle_tasks): Call target hook to define any
3524         target-specific symbols.
3525         * target.h (Target::define_standard_symbols): New method.
3526         (Target::do_define_standard_symbols): Same.
3527         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3528         * testsuite/Makefile.in: Regenerate.
3529         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3530         and __exidx_end.
3531         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3532         relocations are generated for __exidx_start and __exidx_end.
3533
3534 2012-03-16  Doug Kwan  <dougkwan@google.com>
3535
3536         * testsuite/Makefile.am: Disable test initpri3b.
3537         * testsuite/Makefile.in: Regenerate.
3538
3539 2012-03-15  Doug Kwan  <dougkwan@google.com>
3540
3541         * arm.cc (Target_arm::got_section): Make .got section read-only
3542         if -z now is given.
3543
3544 2012-03-15  Ian Lance Taylor  <iant@google.com>
3545
3546         PR gold/13850
3547         * layout.cc (Layout::make_output_section): Correctly mark
3548         SHT_INIT_ARRAY, et. al., as relro.
3549
3550 2012-03-14  Doug Kwan  <dougkwan@google.com>
3551
3552         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3553         dynamic relocations for protected symbols in shared objects.
3554
3555 2012-03-13  Ian Lance Taylor  <iant@google.com>
3556
3557         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3558         keep the larger alignment.
3559
3560 2012-03-12  Cary Coutant  <ccoutant@google.com>
3561
3562         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3563         handling of DW_LNE_define_file.
3564
3565 2012-03-12  Cary Coutant  <ccoutant@google.com>
3566
3567         * reduced_debug_output.cc
3568         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3569         codes to switch.
3570
3571 2012-02-29  Cary Coutant  <ccoutant@google.com>
3572
3573         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3574
3575 2012-02-29  Cary Coutant  <ccoutant@google.com>
3576
3577         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3578         Call Object::decompressed_section_contents.
3579         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3580         New dtor.
3581         (Sized_dwarf_line_info::buffer_start_): New data member.
3582         * merge.cc (Output_merge_data::do_add_input_section): Call
3583         Object::decompressed_section_contents.
3584         (Output_merge_string::do_add_input_section): Likewise.
3585         * object.cc (need_decompressed_section): New function.
3586         (build_compressed_section_map): Decompress sections needed later.
3587         (Sized_relobj_file::do_decompressed_section_contents): New function.
3588         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3589         * object.h (Object::decompressed_section_contents): New function.
3590         (Object::discard_decompressed_sections): New function.
3591         (Object::do_decompressed_section_contents): New function.
3592         (Object::do_discard_decompressed_sections): New function.
3593         (Compressed_section_info): New type.
3594         (Compressed_section_map): Include decompressed section contents.
3595         (Sized_relobj_file::do_decompressed_section_contents): New function.
3596         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3597
3598 2012-02-16  Cary Coutant  <ccoutant@google.com>
3599
3600         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3601         * testsuite/Makefile.in: Regenerate.
3602
3603 2012-02-14  Cary Coutant  <ccoutant@google.com>
3604
3605         * options.cc (General_options::finalize): Disallow -pie and -static.
3606
3607 2012-02-03  Doug Kwan  <dougkwan@google.com>
3608
3609         * arm.cc (Arm_relocate_functions::abs8,
3610         Arm_relocate_functions::abs16): Use
3611         Bits::has_signed_unsigned_overflow32.
3612         (Arm_relocate_functions::thm_abs8): Correct range of
3613         overflow check.
3614         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3615         in assertions.
3616
3617 2012-02-02  Doug Kwan  <dougkwan@google.com>
3618
3619         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3620         position independent outputs, not just shared objects.
3621
3622 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3623
3624         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3625         * configure: Regenerated.
3626
3627 2012-01-27  Ian Lance Taylor  <iant@google.com>
3628
3629         * reloc.h (Bits): New class with static functions, copied from
3630         namespace utils in arm.cc.
3631         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3632         instead.
3633
3634 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3635
3636         * incremental.cc (write_info_blocks): Correct relocation offset.
3637
3638 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3639
3640         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3641         (Relocate::tls_gd_to_le): Likewise.
3642
3643 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3644
3645         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3646
3647 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3648
3649         * configure.ac: Check if -mcmodel=medium works.
3650         * configure: Regenerated.
3651
3652 2012-01-24  Cary Coutant  <ccoutant@google.com>
3653
3654         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3655         definition and ...
3656         (read_unsigned_LEB_128_x): ... this new function.
3657         (read_signed_LEB_128): Replaced with inline definition and ...
3658         (read_signed_LEB_128_x): ... this new function.
3659         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3660         (read_unsigned_LEB_128): Add inline definition.
3661         (read_signed_LEB_128_x): New function.
3662         (read_signed_LEB_128): Add inline definition.
3663         * testsuite/Makefile.am (leb128_unittest): New unit test.
3664         * testsuite/Makefile.in: Regenerate.
3665         * testsuite/leb128_unittest.cc: New unit test.
3666
3667 2012-01-23  Ian Lance Taylor  <iant@google.com>
3668
3669         PR gold/13617
3670         * i386.cc (Target_i386::do_code_fill): When using a jmp
3671         instruction, pad with nop instructions.
3672         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3673
3674 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3675
3676         * x86_64.cc (gc_process_relocs): Add typename on types used in
3677         template.
3678         (scan_relocs): Likewise.
3679         (relocate_section): Likewise.
3680         (apply_relocation): Likewise.
3681
3682 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3683
3684         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3685         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3686         under x32.
3687
3688 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3689
3690         * x86_64.cc: Initial support for x32.
3691
3692 2012-01-03  Cary Coutant  <ccoutant@google.com>
3693
3694         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3695         Use abstract base class for GOT.
3696         * gold/output.h (class Output_data_got_base): New abstract base class.
3697         (class Output_data_got): Derive from new base class, adjust ctors.
3698         (Output_data_got::reserve_slot): Make virtual; rename to
3699         do_reserve_slot; Adjust callers.
3700         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3701         pointer to abstract base class.
3702         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3703
3704 2011-12-18  Ian Lance Taylor  <iant@google.com>
3705
3706         * object.h (Relobj::local_symbol_value): New function.
3707         (Relobj::local_plt_offset): New function.
3708         (Relobj::local_has_got_offset): New function.
3709         (Relobj::local_got_offset): New function.
3710         (Relobj::set_local_got_offset): New function.
3711         (Relobj::do_local_symbol_value): New pure virtual function.
3712         (Relobj::do_local_plt_offset): Likewise.
3713         (Relobj::do_local_has_got_offset): Likewise.
3714         (Relobj::do_local_got_offset): Likewise.
3715         (Relobj::do_set_local_got_offset): Likewise.
3716         (Sized_relobj::do_local_has_got_offset): Rename from
3717         local_has_got_offset.
3718         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3719         (Sized_relobj::do_set_local_got_offset): Rename from
3720         set_local_got_offset.
3721         (Sized_relobj_file::do_local_plt_offset): Rename from
3722         local_plt_offset.
3723         (Sized_relobj_file::do_local_symbol_value): New function.
3724         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3725         local_plt_offset.
3726         * output.cc (Output_data_got::Got_entry::write): Change object to
3727         Relobj.  Use local_symbol_value.
3728         (Output_data_got::add_global_with_rel): Change rel_dyn to
3729         Output_data_reloc_generic*.  Use add_global_generic.
3730         (Output_data_got::add_global_with_rela): Remove.  Change all
3731         callers to use add_global_with_rel.
3732         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3733         Output_data_reloc_generic*.  Use add_global_generic.
3734         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3735         callers to use add_global_pair_with_rel.
3736         (Output_data_got::add_local): Change object to Relobj*.
3737         (Output_data_got::add_local_plt): Likewise.
3738         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3739         change rel_dyn to Output_data_reloc_generic*.  Use
3740         add_local_generic.
3741         (Output_data_got::add_local_with_rela): Remove.  Change all
3742         callers to use all_local_with_rel.
3743         (Output_data_got::add_local_pair_with_rel): Change object to
3744         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3745         add_output_section_generic.
3746         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3747         callers to use add_local_pair_with_rel.
3748         (Output_data_got::reserve_local): Change object to Relobj*.
3749         * output.h: (class Output_data_reloc_generic): Add pure virtual
3750         declarations for add_global_generic, add_local_generic,
3751         add_output_section_generic.
3752         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3753         functions for Output_data_reloc_generic.  Update declarations for
3754         changes listed in output.cc.
3755         (class Output_data_got): Change template parameter to got_size.
3756         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3757         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3758         function.
3759         (Sized_relobj_incr::do_local_plt_offset): New function.
3760         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3761         add_global_generic.
3762
3763 2011-12-17  Cary Coutant  <ccoutant@google.com>
3764
3765         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3766         * resolve.cc (Symbol_table::resolve): Likewise.
3767         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3768         arrays.
3769         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3770
3771 2011-12-16  Ian Lance Taylor  <iant@google.com>
3772
3773         * output.h (Output_data_reloc_generic::add): Only call
3774         add_dynamic_reloc if this is a dynamic reloc section.
3775
3776 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3777
3778         PR gold/13505
3779         * target-reloc.h (apply_relocation): Replace <64, false> with
3780         <size, big_endian>.
3781
3782 2011-11-25  Nick Clifton  <nickc@redhat.com>
3783
3784         * po/it.po: New Italian translation.
3785
3786 2011-11-17  Sterling Augustine  <saugustine@google.com>
3787
3788         * script.cc (script_include_directive): Implement.
3789         (read_script_file): New local variables name and search_path. Update
3790         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3791         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3792         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3793
3794 2011-11-11  Sterling Augustine  <saugustine@google.com>
3795
3796         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3797         (file_or_sections_cmd): Likewise.
3798
3799 2011-11-11  Doug Kwan  <dougkwan@google.com>
3800
3801         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3802         if --just-symbols is given.
3803
3804 2011-11-10  Doug Kwan  <dougkwan@google.com>
3805
3806         PR gold/13362
3807         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3808         when processing data relocs.
3809         * reloc.h (Relocate_functions::rel_unaligned): New method.
3810         (Relocate_functions::pcrel_unaligned): Ditto.
3811         (Relocate_functions::rel32_unaligned): Ditto.
3812         (Relocate_functions::pcrel32_unaligned): Ditto.
3813
3814 2011-11-09  Doug Kwan  <dougkwan@google.com>
3815
3816         PR gold/13362
3817         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3818         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3819         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3820         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3821         (Relocate_functions::rel_unaligned): New.
3822         (Relocate_functions::rel32_unaligned): New.
3823         * target-reloc.h (relocate_for_relocatable): Add code to handle
3824         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3825         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3826         arm_unaligned_reloc_r): New targets.
3827         * testsuite/Makefile.in: Regenerate.
3828         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3829         linking.
3830
3831 2011-11-02  Ian Lance Taylor  <iant@google.com>
3832
3833         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3834         NATIVE_LINKER.
3835         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3836         * options.cc (General_options::finalize): Use library search path
3837         from configure script if specified.  If not native and no sysroot,
3838         only search TOOLLIBDIR.
3839         * options.h (Search_directory::Search_directory): Change name to
3840         const std::string&.
3841         (General_options::add_to_library_path_with_sysroot): Change arg to
3842         const std::string&.
3843         * configure, Makefile.in, config.in: Rebuild.
3844
3845 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3846
3847         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3848         we are working around the ARM1176 Erratum.
3849         * options.h (General_options::fix_arm1176): Add option.
3850         * testsuite/Makefile.am: Add testcases, and keep current ones
3851         working.
3852         * testsuite/Makefile.in: Regenerate.
3853         * testsuite/arm_fix_1176.s: New file.
3854         * testsuite/arm_fix_1176.sh: Likewise.
3855
3856 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3857
3858         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3859         may_use_blx_.
3860         (Target_arm::may_use_blx): Remove method.
3861         (Target_arm::set_may_use_blx): Likewise.
3862         (Target_arm::may_use_v4t_interworking): New method.
3863         (Target_arm::may_use_v5t_interworking): Likewise.
3864         (Target_arm::may_use_blx_): Remove member variable.
3865         (Arm_relocate_functions::arm_branch_common): Check for v5T
3866         interworking.
3867         (Arm_relocate_functions::thumb_branch_common): Likewise.
3868         (Reloc_stub::stub_type_for_reloc): Likewise.
3869         (Target_arm::do_finalize_sections): Correct interworking checks.
3870         * testsuite/Makefile.am: Add new tests.
3871         * testsuite/Makefile.in: Regenerate.
3872         * testsuite/arm_farcall_arm_arm.s: New test.
3873         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3874         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3875         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3876         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3877         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3878         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3879         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3880
3881 2011-10-31  Cary Coutant  <ccoutant@google.com>
3882
3883         PR gold/13023
3884         * expression.cc (Expression::eval_with_dot): Add
3885         is_section_dot_assignment parameter.
3886         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3887         absolute and assigning to dot within a section.
3888         * script-sections.cc
3889         (Output_section_element_assignment::set_section_addresses): Pass
3890         dot_section to set_if_absolute.
3891         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3892         as is_section_dot_assignment flag to eval_with_dot.
3893         (Output_section_element_dot_assignment::set_section_addresses):
3894         Likewise.
3895         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3896         parameter.  Also set value if relative to dot_section; set the
3897         symbol's output_section.
3898         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3899         parameter.  Adjust all callers.
3900         (Expression::eval_maybe_dot): Likewise.
3901         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3902         Adjust all callers.
3903         * testsuite/script_test_2.t: Test assignment of an absolute value
3904         to dot within an output section element.
3905
3906 2011-10-31  Cary Coutant  <ccoutant@google.com>
3907
3908         * options.h (class General_options): Add --[no-]gnu-unique options.
3909         * symtab.cc (Symbol_table::sized_write_globals): Convert
3910         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3911
3912 2011-10-31  Cary Coutant  <ccoutant@google.com>
3913
3914         PR gold/13359
3915         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3916         unnecessary assertion.
3917         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3918
3919 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3920
3921         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3922         gc_mark_symbol.
3923         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3924         gc_mark_symbol.
3925         Change to just keep the section associated with symbol.
3926         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3927         they are externally visible and --export-dynamic is turned on.
3928         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3929
3930 2011-10-19  Ian Lance Taylor  <iant@google.com>
3931
3932         PR gold/13163
3933         * script-sections.cc
3934         (Output_section_element_dot_assignment::needs_output_section): New
3935         function.
3936
3937 2011-10-19  Ian Lance Taylor  <iant@google.com>
3938
3939         PR gold/13204
3940         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3941         --section-start option was seen.
3942         * options.h (General_options::any_section_start): New function.
3943
3944 2011-10-18  David S. Miller  <davem@davemloft.net>
3945
3946         PR binutils/13301
3947         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3948         member to track relocation locations that have moved during TLS
3949         reloc optimizations.
3950         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3951         (Target_sparc::Relocate::relocate): Adjust view down by 4
3952         bytes if it matches reloc_adjust_addr_.
3953         (Target_sparc::Relocate::relocate_tls): Always move the
3954         __tls_get_addr call delay slot instruction forward 4 bytes when
3955         performing relaxation.
3956
3957 2011-10-18  Cary Coutant  <ccoutant@google.com>
3958
3959         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3960         (Output_file::map_no_anonymous): Check for non-zero
3961         return code from posix_fallocate.
3962
3963 2011-10-17  Cary Coutant  <ccoutant@google.com>
3964
3965         PR gold/13245
3966         * plugin.cc (is_visible_from_outside): Check for symbols
3967         referenced from dynamic objects.
3968         * resolve.cc (Symbol_table::resolve): Don't count references
3969         from dynamic objects as references from real ELF files.
3970         * testsuite/plugin_test_2.sh: Adjust expected result.
3971
3972 2011-10-17  Cary Coutant  <ccoutant@google.com>
3973
3974         * gold.cc: Include timer.h.
3975         (queue_middle_tasks): Stamp time.
3976         (queue_final_tasks): Likewise.
3977         * main.cc (main): Store timer in parameters.  Print timers
3978         for each pass.
3979         * parameters.cc (Parameters::Parameters): Initialize timer_.
3980         (Parameters::set_timer): New function.
3981         (set_parameters_timer): New function.
3982         * parameters.h (Parameters::set_timer): New function.
3983         (Parameters::timer): New function.
3984         (Parameters::timer_): New data member.
3985         (set_parameters_timer): New function.
3986         * timer.cc (Timer::stamp): New function.
3987         (Timer::get_pass_time): New function.
3988         * timer.h (Timer::stamp): New function.
3989         (Timer::get_pass_time): New function.
3990         (Timer::pass_times_): New data member.
3991
3992 2011-10-17  Cary Coutant  <ccoutant@google.com>
3993
3994         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3995         task for members of lib groups.
3996
3997 2011-10-17  Cary Coutant  <ccoutant@google.com>
3998
3999         PR gold/13288
4000         * fileread.cc (File_read::find_view): Add assert.
4001         (File_read::make_view): Move bounds check (replace with assert)...
4002         (File_read::find_or_make_view): ... to here.
4003
4004 2011-10-12  Cary Coutant  <ccoutant@google.com>
4005
4006         * output.cc (Output_file::open_base_file): Handle case where
4007         ::read returns less than requested size.
4008
4009 2011-10-10  Cary Coutant  <ccoutant@google.com>
4010
4011         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4012         Initialize defined_count_.
4013         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4014         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4015         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4016         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4017         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4018         * incremental.h (Sized_relobj_incr::defined_count_): New data
4019         member.
4020         (Sized_incr_dynobj::defined_count_): New data member.
4021         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4022         Return zeroes instead of internal error.
4023
4024 2011-10-10  Cary Coutant  <ccoutant@google.com>
4025
4026         PR gold/13249
4027         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4028         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4029         * output.h (class Output_reloc): Add use_plt_offset flag.
4030         (Output_reloc::type_): Adjust size of bit field.
4031         (Output_reloc::use_plt_offset_): New bit field.
4032         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4033         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4034         flag.  Adjust all callers.
4035         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4036         creating RELATIVE relocations.
4037
4038 2011-10-10  Nick Clifton  <nickc@redhat.com>
4039
4040         * po/es.po: Updated Spanish translation.
4041         * po/fi.po: Updated Finnish translation.
4042
4043 2011-10-03   Diego Novillo  <dnovillo@google.com>
4044
4045         * options.cc (parse_uint): Fix dereference of RETVAL.
4046
4047 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4048
4049         * layout.h (section_order_map_): New member.
4050         (get_section_order_map): New member function.
4051         * output.cc (Output_section::add_input_section): Check for patterns
4052         only when --section-ordering-file is specified.
4053         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4054         output_sections have been formed.
4055         * layout.cc (Layout_Layout): Initialize section_order_map_.
4056         * plugin.cc (update_section_order): Store order in order_map. Do not
4057         update the order.
4058         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4059         * testsuite/Makefile.in: Regenerate.
4060         * testsuite/plugin_section_order.c: New file.
4061         * testsuite/plugin_final_layout.cc: New file.
4062         * testsuite/plugin_final_layout.sh: New file.
4063
4064 2011-09-29  Cary Coutant  <ccoutant@google.com>
4065
4066         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4067         Check for NULL.
4068         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4069         symbols during incremental update.
4070         (Symbol_table::add_from_dynobj): Likewise.
4071
4072 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4073             Ian Lance Taylor  <iant@google.com>
4074
4075         * symtab.cc (Symbol_table::define_special_symbol): Always
4076         canonicalize version string.
4077
4078 2011-09-26  Cary Coutant  <ccoutant@google.com>
4079
4080         * gold.cc (queue_initial_tasks): Move option checks ...
4081         * options.cc (General_options::finalize): ... to here. Disable
4082         some options; make others fatal.
4083
4084 2011-09-26  Cary Coutant  <ccoutant@google.com>
4085
4086         gcc PR lto/47247
4087         * plugin.cc (get_symbols_v2): New function.
4088         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4089         (is_referenced_from_outside): New function.
4090         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4091         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4092         (get_symbols): Pass version parameter.
4093         (get_symbols_v2): New function.
4094         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4095         parameter.
4096         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4097         (onload): Add LDPT_GET_SYMBOLS_V2.
4098         (all_symbols_read_hook): Use get_symbols_v2; check for
4099         LDPR_PREVAILING_DEF_IRONLY_EXP.
4100         * testsuite/plugin_test_3.sh: Update expected results.
4101
4102 2011-09-23  Simon Baldwin  <simonb@google.com>
4103
4104         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4105         configuration options.
4106         * configure: Regenerate.
4107         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4108         * Makefile.in: Regenerate.
4109         * testsuite/Makefile.in: Regenerate.
4110
4111 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4112
4113         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4114
4115 2011-09-19  Cary Coutant  <ccoutant@google.com>
4116
4117         * incremental.cc (can_incremental_update): Fix typo in comment.
4118         * incremental.h (can_incremental_update): Likewise.
4119
4120 2011-09-18  Cary Coutant  <ccoutant@google.com>
4121
4122         * incremental.cc (can_incremental_update): New function.
4123         * incremental.h (can_incremental_update): New function.
4124         * layout.cc (Layout::init_fixed_output_section): Call it.
4125         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4126         * object.cc (Sized_relobj_file::do_layout): Call
4127         can_incremental_update.
4128
4129 2011-09-13  Cary Coutant  <ccoutant@google.com>
4130
4131         * configure.ac: Check for glibc support for gnu_indirect_function
4132         support with static linking, setting automake conditional
4133         IFUNC_STATIC.
4134         * Makefile.in: Regenerate.
4135         * configure: Regenerate.
4136
4137         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4138         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4139         for IFUNC_STATIC.
4140         * testsuite/Makefile.in: Regenerate.
4141
4142 2011-09-13  Cary Coutant  <ccoutant@google.com>
4143
4144         * incremental.cc (Sized_relobj_incr::do_layout): Call
4145         report_comdat_group for kept comdat sections.
4146         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4147         * testsuite/Makefile.in: Regenerate.
4148         * testsuite/incr_comdat_test_1.cc: New source file.
4149         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4150         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4151         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4152
4153 2011-09-13  Ian Lance Taylor  <iant@google.com>
4154
4155         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4156         variable external_symbols_offset.
4157
4158 2011-09-12  Ian Lance Taylor  <iant@google.com>
4159
4160         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4161         triggered if object has no symbols.
4162
4163 2011-09-09  David S. Miller  <davem@davemloft.net>
4164
4165         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4166         (Output_fill_debug_line::do_write): Likewise.
4167
4168 2011-08-29  Cary Coutant  <ccoutant@google.com>
4169
4170         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4171         casts to match formatting specs.
4172         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4173
4174 2011-08-26  Cary Coutant  <ccoutant@google.com>
4175
4176         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4177         remaining hole size when allocating.
4178         (Layout::make_output_section): Set fill methods for debug sections.
4179         * layout.h (Free_list::Free_list_node): Move from private to
4180         public.
4181         (Free_list::set_min_hole_size): New function.
4182         (Free_list::begin, Free_list::end): New functions.
4183         (Free_list::min_hole_): New data member.
4184         * output.cc: Include dwarf.h.
4185         (Output_fill_debug_info::do_minimum_hole_size): New function.
4186         (Output_fill_debug_info::do_write): New function.
4187         (Output_fill_debug_line::do_minimum_hole_size): New function.
4188         (Output_fill_debug_line::do_write): New function.
4189         (Output_section::Output_section): Initialize new data member.
4190         (Output_section::set_final_data_size): Ensure patch space is larger
4191         than minimum hole size.
4192         (Output_section::do_write): Fill holes in debug sections.
4193         * output.h (Output_fill): New class.
4194         (Output_fill_debug_info): New class.
4195         (Output_fill_debug_line): New class.
4196         (Output_section::set_free_space_fill): New function.
4197         (Output_section::free_space_fill_): New data member.
4198         * testsuite/Makefile.am (incremental_test_3): Add
4199         --incremental-patch option.
4200         (incremental_test_4): Likewise.
4201         (incremental_test_5): Likewise.
4202         (incremental_test_6): Likewise.
4203         (incremental_copy_test): Likewise.
4204         (incremental_common_test_1): Likewise.
4205         * testsuite/Makefile.in: Regenerate.
4206
4207 2011-08-26  Nick Clifton  <nickc@redhat.com>
4208
4209         * po/es.po: Updated Spanish translation.
4210
4211 2011-08-01  Cary Coutant  <ccoutant@google.com>
4212
4213         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4214         * gold/testsuite/Makefile.in: Regenerate.
4215         * gold/testsuite/justsyms_exec.c: New source file.
4216         * gold/testsuite/justsyms_lib.c: New source file.
4217
4218 2011-08-01  Cary Coutant  <ccoutant@google.com>
4219
4220         * layout.cc (Layout::set_segment_offsets): Don't realign text
4221         segment if -Ttext was specified.
4222         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4223         file type.
4224         * object.h (Sized_relobj_file::e_type): New function.
4225         (Sized_relobj_file::e_type_): New data member.
4226         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4227         base address for ET_EXEC files.
4228         * target.cc (Target::do_make_elf_object_implementation): Allow
4229         ET_EXEC files with --just-symbols option.
4230
4231 2011-07-28  Cary Coutant  <ccoutant@google.com>
4232
4233         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4234         Add thread_number parameter.
4235         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4236         * workqueue-threads.cc
4237         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4238         current thread if its thread number is greater than desired thread
4239         count.
4240         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4241         Add thread_number parameter.
4242         (Workqueue::should_cancel_thread): Likewise.
4243         (Workqueue::find_runnable_or_wait): Pass thread_number to
4244         should_cancel_thread.
4245         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4246         parameter.
4247
4248 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4249
4250         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4251         only after checking if it cannot be forced local.
4252         * symtab.h (is_externally_visible): Check if the symbol is not forced
4253         local.
4254
4255 2011-07-15  Ian Lance Taylor  <iant@google.com>
4256
4257         * options.h (class General_options): Add --print-output-format.
4258         Move -EL next to -EB, for  better --help output.
4259         * target-select.cc: Include <cstdio>, "options.h", and
4260         "parameters.h".
4261         (Target_selector::do_target_bfd_name): New function.
4262         (print_output_format): New function.
4263         * target-select.h (class Target_selector): Update declarations.
4264         (Target_selector::target_bfd_name): New function.
4265         (print_output_format): Declare.
4266         * main.cc: Include "target-select.h".
4267         (main): Handle --print-output-format.
4268         * gold.cc: Include "target-select.h".
4269         (queue_initial_tasks): Handle --print-output-format when there are
4270         no input files.
4271         * parameters.cc (parameters_force_valid_target): Give a better
4272         error message if -EB/-EL does not match target.
4273         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4274         function.
4275
4276 2011-07-15  Ian Lance Taylor  <iant@google.com>
4277
4278         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4279         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4280         (Output_data_plt_i386::do_write): Write address of .dynamic
4281         section to first entry in .got.plt section.
4282         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4283         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4284         Initialize layout_.
4285         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4286         section to first entry in .got.plt section.
4287         * layout.h (Layout::dynamic_section): New function.
4288
4289 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4290
4291         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4292         to claim_file call.
4293         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4294         input_section_position_, and input_section_glob_.
4295         (read_layout_from_file): Call function section_ordering_specified.
4296         * layout.h (is_section_ordering_specified): New function.
4297         (section_ordering_specified): New function.
4298         (section_ordering_specified_): New boolean member.
4299         * main.cc(main): Call load_plugins after layout object is defined.
4300         * output.cc (Output_section::add_input_section): Use
4301         function section_ordering_specified to check if section ordering is
4302         needed.
4303         * output.cc (Output_section::add_relaxed_input_section): Use
4304         function section_ordering_specified to check if section ordering is
4305         needed.
4306         (Output_section::update_section_layout): New function.
4307         (Output_section::sort_attached_input_sections): Check if input section
4308         must be reordered.
4309         * output.h (Output_section::update_section_layout): New function.
4310         * plugin.cc (get_section_count): New function.
4311         (get_section_type): New function.
4312         (get_section_name): New function.
4313         (get_section_contents): New function.
4314         (update_section_order): New function.
4315         (allow_section_ordering): New function.
4316         (Plugin::load): Add the new interfaces to the transfer vector.
4317         (Plugin_manager::load_plugins): New parameter.
4318         (Plugin_manager::all_symbols_read): New parameter.
4319         (Plugin_manager::claim_file): New parameter. Save the elf object for
4320         unclaimed objects.
4321         (Plugin_manager::get_elf_object): New function.
4322         (Plugin_manager::get_view): Change to directly use the bool to check
4323         if get_view is called from claim_file_hook.
4324         * plugin.h (input_objects): New function
4325         (Plugin__manager::load_plugins): New parameter.
4326         (Plugin_manager::claim_file): New parameter.
4327         (Plugin_manager::get_elf_object): New function.
4328         (Plugin_manager::in_claim_file_handler): New function.
4329         (Plugin_manager::in_claim_file_handler_): New member.
4330         (layout): New function.
4331         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4332         handler with an extra parameter. Make the elf object before calling
4333         claim_file handler.
4334         * testsuite/plugin_test.c (get_section_count): New function pointer.
4335         (get_section_type): New function pointer.
4336         (get_section_name): New function pointer.
4337         (get_section_contents): New function pointer.
4338         (update_section_order): New function pointer.
4339         (allow_section_ordering): New function pointer.
4340         (onload): Check if the new interfaces exist.
4341
4342 2011-07-13  Ian Lance Taylor  <iant@google.com>
4343
4344         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4345         relro section.
4346         * x86_64.cc (Target_x86_64::got_section): Likewise.
4347         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4348         (relro_now_test_SOURCES): New variable.
4349         (relro_now_test_DEPENDENCIES): New variable.
4350         (relro_now_test_LDFLAGS): New variable.
4351         (relro_now_test_LDADD): New variable.
4352         (relro_now_test.so): New target.
4353         * testsuite/Makefile.in: Rebuild.
4354
4355 2011-07-12  Ian Lance Taylor  <iant@google.com>
4356
4357         PR gold/12980
4358         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4359         GLOB_DAT relocation rather than a RELATIVE relocation for a
4360         protected symbol when creating a shared library.
4361         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4362         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4363         * testsuite/protected_main_1.cc (main): Test that protected
4364         function has same address.
4365
4366 2011-07-11  Ian Lance Taylor  <iant@google.com>
4367
4368         PR gold/12979
4369         * options.h (class General_options): Add -Bgroup.
4370         * options.cc (General_options::finalize): If -Bgroup is set,
4371         default to --unresolved-symbols=report-all.
4372         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4373         * target-reloc.h (issue_undefined_symbol_error): Handle
4374         --unresolved-symbols=report-all.
4375
4376 2011-07-08  Ian Lance Taylor  <iant@google.com>
4377
4378         PR gold/11985
4379         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4380         if linker script discards key sections.
4381         (Layout::create_dynamic_symtab): Likewise.
4382         (Layout::assign_local_dynsym_offsets): Likewise.
4383         (Layout::sized_create_version_sections): Likewise.
4384         (Layout::create_interp): Likewise.
4385         (Layout::finish_dynamic_section): Likewise.
4386         (Layout::set_dynamic_symbol_size): Likewise.
4387
4388 2011-07-08  Ian Lance Taylor  <iant@google.com>
4389
4390         PR gold/12386
4391         * options.h (class General_options): Add --unresolved-symbols.
4392         * target-reloc.h (issue_undefined_symbol_error): Check
4393         --unresolved-symbols.  Add comments.
4394
4395 2011-07-08  Ian Lance Taylor  <iant@google.com>
4396
4397         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4398         expression more complex.
4399
4400 2011-07-08  Ian Lance Taylor  <iant@google.com>
4401
4402         PR gold/11317
4403         * target-reloc.h (issue_undefined_symbol_error): New inline
4404         function, broken out of relocate_section.
4405         (relocate_section): Call issue_undefined_symbol_error.
4406         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4407         there is no TLS segment if we are about to issue an undefined
4408         symbol error.
4409         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4410
4411 2011-07-08  Ian Lance Taylor  <iant@google.com>
4412
4413         PR gold/12279
4414         * resolve.cc (Symbol_table::should_override): Add fromtype
4415         parameter.  Change all callers.  Give error when linking together
4416         TLS and non-TLS symbol.
4417         (Symbol_table::should_override_with_special): Add fromtype
4418         parameter.  Change all callers.
4419         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4420         there is no TLS segment if we have reported some errors.
4421         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4422
4423 2011-07-08  Ian Lance Taylor  <iant@google.com>
4424
4425         PR gold/12372
4426         * target.h (Target::plt_address_for_global): New function.
4427         (Target::plt_address_for_local): New function.
4428         (Target::plt_section_for_global): Remove.
4429         (Target::plt_section_for_local): Remove.
4430         (Target::do_plt_address_for_global): New virtual function.
4431         (Target::do_plt_address_for_local): New virtual function.
4432         (Target::do_plt_section_for_global): Remove.
4433         (Target::do_plt_section_for_local): Remove.
4434         (Target::register_global_plt_entry): Add Symbol_table and Layout
4435         parameters.
4436         * output.cc (Output_data_got::Got_entry::write): Use
4437         plt_address_for_global and plt_address_for_local.
4438         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4439         address of output section.
4440         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4441         got_irelative_, and irelative_count_ fields.  Update
4442         declarations.
4443         (Output_data_plt_i386::has_irelative_section): New function.
4444         (Output_data_plt_i386::entry_count): Add irelative_count_.
4445         (Output_data_plt_i386::set_final_data_size): Likewise.
4446         (class Target_i386): Add got_irelative_ and rel_irelative_
4447         fields.  Update declarations.
4448         (Target_i386::Target_i386): Initialize new fields.
4449         (Target_i386::do_plt_address_for_global): New function replacing
4450         do_plt_section_for_global.
4451         (Target_i386::do_plt_address_for_local): New function replacing
4452         do_plt_section_for_local.
4453         (Target_i386::got_section): Create got_irelative_.
4454         (Target_i386::rel_irelative_section): New function.
4455         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4456         fields.  Don't define __rel_iplt_{start,end}.
4457         (Output_data_plt_i386::add_entry): Add symtab and layout
4458         parameters.  Change all callers.  Use different PLT and GOT for
4459         IFUNC symbols.
4460         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4461         layout parameters.  Change all callers.  Use different PLT and
4462         GOT.
4463         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4464         (Output_data_plt_i386::rel_irelative): New function.
4465         (Output_data_plt_i386::address_for_global): New function.
4466         (Output_data_plt_i386::address_for_local): New function.
4467         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4468         IRELATIVE GOT when changing IFUNC GOT entries.
4469         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4470         reloc.
4471         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4472         if we didn't create an IRELATIVE GOT.
4473         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4474         plt_address_for_local.
4475         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4476         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4477         got_irelative_, and irelative_count_ fields.  Update
4478         declarations.
4479         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4480         Initialize new fields.  Remove symtab parameter.  Change all
4481         callers.
4482         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4483         irelative_count_.
4484         (Output_data_plt_x86_64::has_irelative_section): New function.
4485         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4486         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4487         fields.  Update declarations.
4488         (Target_x86_64::Target_x86_64): Initialize new fields.
4489         (Target_x86_64::do_plt_address_for_global): New function replacing
4490         do_plt_section_for_global.
4491         (Target_x86_64::do_plt_address_for_local): New function replacing
4492         do_plt_section_for_local.
4493         (Target_x86_64::got_section): Create got_irelative_.
4494         (Target_x86_64::rela_irelative_section): New function.
4495         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4496         all callers.  Don't create __rel_iplt_{start,end}.
4497         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4498         parameters.  Change all callers.  Use different PLT and GOT for
4499         IFUNC symbols.
4500         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4501         layout parameters.  Change all callers.  Use different PLT and
4502         GOT.
4503         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4504         parameters.  Change all callers.  Use different PLT and GOT for
4505         IFUNC symbols.
4506         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4507         (Output_data_plt_x86_64::rela_irelative): New function.
4508         (Output_data_plt_x86_64::address_for_global): New function.
4509         (Output_data_plt_x86_64::address_for_local): New function.
4510         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4511         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4512         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4513         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4514         parameters.
4515         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4516         reloc.
4517         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4518         symbols if we didn't create an IRELATIVE GOT.
4519         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4520         plt_address_for_local.
4521         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4522         * testsuite/ifuncvar1.c: New test file.
4523         * testsuite/ifuncvar2.c: New test file.
4524         * testsuite/ifuncvar3.c: New test file.
4525         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4526         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4527         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4528         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4529         * testsuite/Makefile.in: Rebuild.
4530
4531 2011-07-07  Cary Coutant  <ccoutant@google.com>
4532
4533         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4534         (two_file_test_1_ndebug.o): Likewise.
4535         (two_file_test_1b_ndebug.o): Likewise.
4536         (two_file_test_2_ndebug.o): Likewise.
4537         (two_file_test_main_ndebug.o): Likewise.
4538         (incremental_test_2): Link with no-debug versions.
4539
4540 2011-07-06  Cary Coutant  <ccoutant@google.com>
4541
4542         * gold/incremental.cc
4543         (Output_section_incremental_inputs::write_info_blocks): Check for
4544         hidden and internal symbols.
4545
4546 2011-07-06  Cary Coutant  <ccoutant@google.com>
4547
4548         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4549         Check disposition for startup file.
4550         (Incremental_inputs::report_command_line): Ignore
4551         --incremental-startup-unchanged option.
4552         * options.cc (General_options::parse_incremental_startup_unchanged):
4553         New function.
4554         (General_options::General_options): Initialize new data member.
4555         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4556         (General_options): Add --incremental-startup-unchanged option.
4557         (General_options::incremental_startup_disposition): New function.
4558         (General_options::incremental_startup_disposition_): New data member.
4559
4560 2011-07-06  Cary Coutant  <ccoutant@google.com>
4561
4562         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4563         input file index to Script_info ctor.
4564         (Sized_incremental_binary::do_file_has_changed): Find the
4565         command-line argument for files named in scripts.
4566         * incremental.h (Script_info::Script_info): New ctor
4567         with input file index.
4568         (Script_info::input_file_index): New function.
4569         (Script_info::input_file_index_): New data member.
4570         (Incremental_binary::get_library): Add const.
4571         (Incremental_binary::get_script_info): Add const.
4572         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4573         * testsuite/Makefile.am (incremental_test_5): New test case.
4574         (incremental_test_6): New test case.
4575         * testsuite/Makefile.in: Regenerate.
4576
4577 2011-07-06  Cary Coutant  <ccoutant@google.com>
4578
4579         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4580         debug output when command lines differ.
4581
4582 2011-07-06  Cary Coutant  <ccoutant@google.com>
4583
4584         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4585         --incremental-patch option.
4586         * layout.cc (Free_list::allocate): Extend allocation beyond original
4587         end if enabled.
4588         (Layout::make_output_section): Mark sections that should get
4589         patch space.
4590         * options.cc (parse_percent): New function.
4591         * options.h (parse_percent): New function.
4592         (DEFINE_percent): New macro.
4593         (General_options): Add --incremental-patch option.
4594         * output.cc (Output_section::Output_section): Initialize new data
4595         members.
4596         (Output_section::add_input_section): Print section name when out
4597         of patch space.
4598         (Output_section::add_output_section_data): Likewise.
4599         (Output_section::set_final_data_size): Add patch space when
4600         doing --incremental-full.
4601         (Output_section::do_reset_address_and_file_offset): Remove patch
4602         space.
4603         (Output_segment::set_section_list_addresses): Print debug output
4604         only if --incremental-update.
4605         * output.h (Output_section::set_is_patch_space_allowed): New function.
4606         (Output_section::is_patch_space_allowed_): New data member.
4607         (Output_section::patch_space_): New data member.
4608         * parameters.cc (Parameters::incremental_full): New function.
4609         * parameters.h (Parameters::incremental_full): New function
4610         * testsuite/Makefile.am (incremental_test_2): Add test for
4611         --incremental-patch option.
4612         * testsuite/Makefile.in: Regenerate.
4613         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4614         (t18): Remove function body.
4615
4616 2011-07-05  Doug Kwan  <dougkwan@google.com>
4617
4618         PR gold/12771
4619         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4620         Arm_Address type for relocation result.
4621         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4622         overflow check.
4623         (Arm_relocate_functions::abs32): Use unaligned access.
4624         (Arm_relocate_functions::rel32): Ditto.
4625         (Arm_relocate_functions::prel31): Ditto.
4626         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4627         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4628         static data relocations.
4629         * testsuite/Makefile.in: Regnerate.
4630         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4631
4632 2011-07-05  Ian Lance Taylor  <iant@google.com>
4633
4634         PR gold/12392
4635         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4636         symbols if necessary.
4637         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4638
4639 2011-07-05  Ian Lance Taylor  <iant@google.com>
4640
4641         PR gold/12952
4642         * resolve.cc (Symbol::override_base_with_special): Simply override
4643         version with special symbol version, ignoring previous version.
4644
4645 2011-07-05  Ian Lance Taylor  <iant@google.com>
4646
4647         * object.cc (Sized_relobj_file::include_section_group): Add
4648         information to comment about signature location.
4649
4650 2011-07-02  Ian Lance Taylor  <iant@google.com>
4651
4652         PR gold/12957
4653         * options.h (class General_options): Add -f and -F.
4654         * options.cc (General_options::finalize): Fatal error if -f/-F
4655         are used without -shared.
4656         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4657
4658 2011-07-02  Ian Lance Taylor  <iant@google.com>
4659
4660         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4661
4662 2011-07-01  Ian Lance Taylor  <iant@google.com>
4663
4664         PR gold/12525
4665         PR gold/12952
4666         * resolve.cc (Symbol::override_base_with_special): Don't override
4667         the version if the overriding symbol has a different name.
4668         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4669         all callers.  If we give an error about an undefined version,
4670         define the base version if necessary.
4671         * dynobj.h (class Versions): Update declaration.
4672         * testsuite/weak_alias_test_5.cc: New file.
4673         * testsuite/weak_alias_test.script: New file.
4674         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4675         and versioned_alias have the right value, and call t2.
4676         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4677         weak_alias_test_5.so.
4678         (weak_alias_test_LDADD): Likewise.
4679         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4680         * testsuite/Makefile.in: Rebuild.
4681
4682 2011-07-01  Ian Lance Taylor  <iant@google.com>
4683
4684         PR gold/12525
4685         * options.h (class General_options): Support -z notext.
4686         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4687         -Wl,-z,notext.
4688         (two_file_shared_nonpic.so): Likewise.
4689         (two_file_shared_mixed.so): Likewise.
4690         (two_file_shared_mixed_1.so): Likewise.
4691         (weak_undef_lib_nonpic.so): Likewise.
4692         (alt/weak_undef_lib_nonpic.so): Likewise.
4693         (tls_test_shared_nonpic.so): Likewise.
4694         * testsuite/Makefile.in: Rebuild.
4695
4696 2011-07-01  Ian Lance Taylor  <iant@google.com>
4697
4698         PR gold/12525
4699         * configure.ac: Test whether static linking works, setting
4700         the automake conditional HAVE_STATIC.
4701         * testsuite/Makefile.am: Disable tests using -static if
4702         HAVE_STATIC is not true.
4703         * configure, testsuite/Makefile.in: Rebuild.
4704
4705 2011-07-01  Ian Lance Taylor  <iant@google.com>
4706
4707         PR gold/12525
4708         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4709         Assert if we see DW_EH_PE_indirect.
4710         * target.h (Target::ehframe_datarel_base): New function.
4711         (Target::do_ehframe_datarel_base): New target function.
4712         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4713         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4714         function.
4715
4716 2011-07-01  Ian Lance Taylor  <iant@google.com>
4717
4718         PR gold/12571
4719         * options.h (class General_options): Add
4720         --ld-generated-unwind-info.
4721         * ehframe.cc (Fde::write): Add address parameter.  Change all
4722         callers.  If associated with PLT, fill in address and size.
4723         (Cie::set_output_offset): Only add merge mapping if there is an
4724         object.
4725         (Cie::write): Add address parameter.  Change all callers.
4726         (Eh_frame::add_ehframe_for_plt): New function.
4727         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4728         input_offset_ fields into union u_, with new plt field.
4729         (Fde::Fde): Adjust for new union field.
4730         (Fde::Fde) [Output_data version]: New constructor.
4731         (Fde::add_mapping): Only add merge mapping if there is an object.
4732         (class Cie): Update declarations.
4733         (class Eh_frame): Declare add_ehframe_for_plt.
4734         * layout.cc (Layout::layout_eh_frame): Break out code into
4735         make_eh_frame_section, and call it.
4736         (Layout::make_eh_frame_section): New function.
4737         (Layout::add_eh_frame_for_plt): New function.
4738         * layout.h (class Layout): Update declarations.
4739         * merge.cc (Merge_map::add_mapping): Add assertion.
4740         * i386.cc: Include "dwarf.h".
4741         (class Output_data_plt_i386): Make first_plt_entry,
4742         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4743         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4744         and plt_eh_frame_fde.
4745         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4746         boundary.  Call add_eh_frame_for_plt if appropriate.
4747         * x86_64.cc: Include "dwarf.h".
4748         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4749         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4750         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4751         and plt_eh_frame_fde.
4752         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4753         appropriate.
4754
4755 2011-06-29  Ian Lance Taylor  <iant@google.com>
4756
4757         PR gold/12629
4758         * object.cc (Sized_relobj_file::layout_section): Change shdr
4759         parameter to be const.
4760         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4761         out of do_layout.
4762         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4763         appropriate.  Call layout_eh_frame_section.
4764         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4765         sections.
4766         * object.h (class Sized_relobj_file): Update declarations.
4767
4768 2011-06-29  Ian Lance Taylor  <iant@google.com>
4769
4770         PR gold/12652
4771         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4772         modifier.
4773         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4774
4775 2011-06-29  Ian Lance Taylor  <iant@google.com>
4776
4777         PR gold/12675
4778         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4779         SHT_X86_64_UNWIND.
4780         * layout.cc (Layout::layout_eh_frame): Likewise.
4781
4782 2011-06-29  Ian Lance Taylor  <iant@google.com>
4783
4784         PR gold/12695
4785         * layout.cc (Layout::symtab_section_shndx): New function.
4786         * layout.h (class Layout): Declare symtab_section_shndx.
4787         * output.cc (Output_section::write_header): Call it.
4788
4789 2011-06-29  Ian Lance Taylor  <iant@google.com>
4790
4791         PR gold/12818
4792         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4793         symbols which are not used in a relocation.
4794
4795 2011-06-28  Ian Lance Taylor  <iant@google.com>
4796
4797         PR gold/12898
4798         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4799         script create indistinguishable segments.
4800         (Layout::set_segment_offsets): Use stable_sort when sorting
4801         segments.  Pass this to Compare_segments constructor.
4802         * layout.h (class Layout): Make segment_precedes non-static.
4803         (class Compare_segments): Change from struct to class.  Add
4804         layout_ field.  Add constructor.
4805         * script-sections.cc
4806         (Script_sections::attach_sections_using_phdrs_clause): Rename
4807         local orphan to is_orphan.  Don't report failure to put empty
4808         section in segment.  On attachment failure, report name of
4809         section, and attach to first PT_LOAD segment.
4810
4811 2011-06-28  Ian Lance Taylor  <iant@google.com>
4812
4813         PR gold/12934
4814         * target-select.cc (Target_selector::Target_selector): Add
4815         emulation parameter.  Change all callers.
4816         (select_target_by_bfd_name): Rename from select_target_by_name.
4817         Change all callers.
4818         (select_target_by_emulation): New function.
4819         (supported_emulation_names): New function.
4820         * target-select.h (class Target_selector): Add emulation_ field.
4821         Update declarations.
4822         (Target_selector::recognize_by_bfd_name): Rename from
4823         recognize_by_name.  Change all callers.
4824         (Target_selector::supported_bfd_names): Rename from
4825         supported_names.  Change all callers.
4826         (Target_selector::recognize_by_emulation): New function.
4827         (Target_selector::supported_emulations): New function.
4828         (Target_selector::emulation): New function.
4829         (Target_selector::do_recognize_by_bfd_name): Rename from
4830         do_recognize_by_name.  Change all callers.
4831         (Target_selector::do_supported_bfd_names): Rename from
4832         do_supported_names.  Change all callers.
4833         (Target_selector::do_recognize_by_emulation): New function.
4834         (Target_selector::do_supported_emulations): New function.
4835         (select_target_by_bfd_name): Change name in declaration.
4836         (select_target_by_emulation): Declare.
4837         (supported_emulation_names): Declare.
4838         * parameters.cc (parameters_force_valid_target): Try to find
4839         target based on emulation from -m option.
4840         * options.h (class General_options): Change doc string for -m.
4841         * options.cc (help): Print emulations.
4842         (General_options::parse_V): Likewise.
4843         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4844         Add emulation parameter.  Change all callers.
4845
4846 2011-06-28  Ian Lance Taylor  <iant@google.com>
4847
4848         * target.h (class Target): Add osabi_ field.
4849         (Target::osabi): New function.
4850         (Target::set_osabi): New function.
4851         (Target::Target): Initialize osabi_.
4852         (Target::do_adjust_elf_header): Make pure virtual.
4853         (Sized_target::do_adjust_elf_header): Declare.
4854         * target.cc (Sized_target::do_adjust_elf_header): New function.
4855         (class Sized_target): Instantiate all versions.
4856         * freebsd.h (class Target_freebsd): Remove.
4857         (Target_selector_freebsd::do_recognize): Call set_osabi on
4858         Target.
4859         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4860         (Target_selector_freebsd::set_osabi): Remove.
4861         * i386.cc (class Target_i386): Inherit from Sized_target rather
4862         than Target_freebsd.
4863         * x86_64.cc (class Target_x86_64): Likewise.
4864
4865 2011-06-28  Ian Lance Taylor  <iant@google.com>
4866
4867         * target.h (Target::can_check_for_function_pointers): Rewrite.
4868         Make non-virtual.
4869         (Target::can_icf_inline_merge_sections): Likewise.
4870         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4871         (Target::Target_info): Add can_icf_inline_merge_sections field.
4872         (Target::do_can_check_for_function_pointers): New virtual
4873         function.
4874         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4875         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4876         from can_check_for_function_pointers, move in file.
4877         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4878         section_may_have_icf_unsafe_poineters, move in file.
4879         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4880         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4881         Rename from can_check_for_function_pointers, move in file.
4882         (Target_i386::can_icf_inline_merge_sections): Remove.
4883         (Target_i386::i386_info): Initialize
4884         can_icf_inline_merge_sections.
4885         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4886         Initialize can_icf_inline_merge_sections.
4887         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4888         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4889         Rename from can_check_for_function_pointers, move in file.
4890         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4891         (Target_x86_64::x86_64_info): Initialize
4892         can_icf_inline_merge_sections.
4893         * testsuite/testfile.cc (Target_test::test_target_info):
4894         Likewise.
4895         * icf.cc (get_section_contents): Correct formatting.
4896
4897 2011-06-27  Ian Lance Taylor  <iant@google.com>
4898
4899         * symtab.cc (Symbol::versioned_name): New function.
4900         (Symbol_table::add_to_final_symtab): Use versioned_name when
4901         appropriate.
4902         (Symbol_table::sized_write_symbol): Likewise.
4903         * symtab.h (class Symbol): Declare versioned_name.
4904         * stringpool.h (class Stringpool_template): Add variant of add
4905         which takes a std::basic_string.
4906         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4907         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4908         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4909         (ver_test_12.o): New target.
4910         * testsuite/Makefile.in: Rebuild.
4911
4912 2011-06-27  Doug Kwan  <dougkwan@google.com>
4913
4914         * arm.cc (Arm_relocate_functions::thm_jump8,
4915         Arm_relocate_functions::thm_jump11): Use a wider signed
4916         type to compute offset.
4917         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4918         arm_thm_jump8.
4919         * testsuite/Makefile.in: Regenerate.
4920         * testsuite/arm_branch_in_range.sh: Check test results of
4921         arm_thm_jump11 and arm_thm_jump8.
4922         * testsuite/arm_thm_jump11.s: New test source file.
4923         * testsuite/arm_thm_jump11.t: New linker script.
4924         * testsuite/arm_thm_jump8.s: New test source file.
4925         * testsuite/arm_thm_jump8.t: New linker script.
4926
4927 2011-06-24  Ian Lance Taylor  <iant@google.com>
4928
4929         * layout.cc: Include "object.h".
4930         (ctors_sections_in_init_array): New static variable.
4931         (Layout::is_ctors_in_init_array): New function.
4932         (Layout::layout): Add entry to ctors_sections_in_init_array if
4933         appropriate.
4934         * layout.h (class Layout): Declare is_ctors_in_init_array.
4935         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4936         is_ctors_reverse_view is set.
4937         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4938         all callers.  Set is_ctors_reverse_view field of View_size.
4939         (Sized_relobj_file::reverse_words): New function.
4940         * object.h (Sized_relobj_file::View_size): Add
4941         is_ctors_reverse_view field.
4942         (class Sized_relobj_file): Update declarations.
4943         * testsuite/initpri3.c: New test.
4944         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4945         initpri3b.
4946         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4947         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4948         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4949         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4950         * testsuite/Makefile.in: Rebuild.
4951
4952 2011-06-24  Cary Coutant  <ccoutant@google.com>
4953
4954         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4955         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4956         (debug_msg_cdebug.err): New targets.
4957         * testsuite/Makefile.in: Regenerate.
4958         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4959         Fix checks for link with shared library.
4960
4961 2011-06-24  Doug Kwan  <dougkwan@google.com>
4962
4963         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4964         skip empty text sections.
4965         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4966
4967 2011-06-22  Ian Lance Taylor  <iant@google.com>
4968
4969         PR gold/12910
4970         * options.h (class General_options): Add --ctors-in-init-array.
4971         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4972         friends as SHT_PROGBITS for merging sections.
4973         (Layout::layout): Remove special handling of .init_array and
4974         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4975         and .dtors if ctors_in_init_array.
4976         (Layout::make_output_section): Force correct section types for
4977         .init_array and friends.  Don't sort if doing relocatable link,
4978         Don't sort .ctors and .dtors if ctors_in_init_array.
4979         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4980         (Layout::output_section_name): Add relobj parameter.  Change all
4981         callers.  Handle .ctors. and .dtors. in code rather than table.
4982         Handle .ctors and .dtors if ctors_in_init_array.
4983         (Layout::match_file_name): New function, moved from output.cc.
4984         * layout.h (class Layout): Update declarations.
4985         * output.cc: Include "layout.h".
4986         (Input_section_sort_entry::get_priority): New function.
4987         (Input_section_sort_entry::match_file_name): Just call
4988         Layout::match_file_name.
4989         (Output_section::Input_section_sort_init_fini_compare::operator()):
4990         Handle .ctors and .dtors.  Sort by explicit priority rather than
4991         by name.
4992         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4993         * testsuite/initpri2.c: New test.
4994         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4995         (check_PROGRAMS): Add initpri2.
4996         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4997         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4998         * configure, testsuite/Makefile.in: Rebuild.
4999
5000 2011-06-19  Ian Lance Taylor  <iant@google.com>
5001
5002         PR gold/12880
5003         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5004         .interp section to a PT_INTERP segment even if we have seen a
5005         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5006         clause in a linker script.
5007         (Layout::finalize): Don't create a .interp section if we've
5008         already create a PT_INTERP segment.
5009         (Layout::create_interp): Always call choose_output_section (revert
5010         patch of 2011-06-17).  Don't create PT_INTERP segment.
5011         * script-sections.cc
5012         (Script_sections::create_note_and_tls_segments): Add a .interp
5013         section to a PT_INTERP segment even if we have seen a
5014         --dynamic-linker option.
5015
5016 2011-06-18  Ian Lance Taylor  <iant@google.com>
5017
5018         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5019         merely because a non-PT_LOAD segment has a dynamic reloc.
5020
5021 2011-06-18  Ian Lance Taylor  <iant@google.com>
5022
5023         * layout.cc (Layout::finish_dynamic_section): Don't create
5024         DT_FLAGS entry if not needed.
5025
5026 2011-06-18  Ian Lance Taylor  <iant@google.com>
5027
5028         PR gold/12745
5029         * layout.cc (Layout::layout_eh_frame): Correct handling of
5030         writable .eh_frame section.
5031
5032 2011-06-17  Ian Lance Taylor  <iant@google.com>
5033
5034         PR gold/12893
5035         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5036         symbol is redefined with the exact same object and value.
5037
5038 2011-06-17  Ian Lance Taylor  <iant@google.com>
5039
5040         PR gold/12880
5041         * layout.h (class Layout): Add interp_segment_ field.
5042         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5043         (Layout::attach_allocated_section_to_segment): If making shared
5044         library, put .interp section in PT_INTERP segment.
5045         (Layout::finalize): Also call create_interp if -dynamic-linker
5046         option was used.
5047         (Layout::create_interp): Assert that there is no PT_INTERP
5048         segment.  If not using a SECTIONS clause, use make_output_section.
5049         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5050         * script-sections.cc
5051         (Script_sections::create_note_and_tls_segments): If making shared
5052         library, put .interp section in PT_INTERP segment.
5053
5054 2011-06-17  Ian Lance Taylor  <iant@google.com>
5055
5056         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5057         when making a shared library.
5058
5059 2011-06-17  Ian Lance Taylor  <iant@google.com>
5060
5061         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5062         parameter.  Change all callers.  Don't issue warning about PC32
5063         against locally defined symbol.
5064
5065 2011-06-16  Ian Lance Taylor  <iant@google.com>
5066
5067         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5068         occurs in same object.
5069
5070 2011-06-14  Alan Modra  <amodra@gmail.com>
5071
5072         * po/POTFILES.in: Regenerate.
5073
5074 2011-06-09  Ian Lance Taylor  <iant@google.com>
5075
5076         * script-sections.cc
5077         (Orphan_output_section::set_section_addresses): For a relocatable
5078         link set address to 0.
5079
5080 2011-06-09  Cary Coutant  <ccoutant@google.com>
5081
5082         PR gold/12804
5083         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5084         used with --compress-debug-sections.
5085         * gold/object.cc (Sized_relobj_file::do_layout): Report
5086         uncompressed size of compressed input sections.
5087
5088 2011-06-08  Cary Coutant  <ccoutant@google.com>
5089
5090         PR gold/12804
5091         * testsuite/two_file_test_2_v1.cc: Change initialization of
5092         v2 to keep it in .data.
5093
5094 2011-06-07  Cary Coutant  <ccoutant@google.com>
5095
5096         * common.cc (Symbol_table::do_allocate_commons_list): Call
5097         gold_fallback.
5098         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5099         (Errors::fallback): New function.
5100         (gold_fallback): New function.
5101         * errors.h (Errors::fallback): New function.
5102         * gold.cc (gold_exit): Change status parameter to enum; adjust
5103         all callers.
5104         (queue_initial_tasks): Call gold_fallback.
5105         * gold.h: Include cstdlib.
5106         (Exit_status): New enum type.
5107         (gold_exit): Change status parameter to enum.
5108         (gold_fallback): New function.
5109         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5110         (Layout::create_symtab_sections): Likewise.
5111         (Layout::create_shdrs): Likewise.
5112         * main.cc (main): Adjust call to gold_exit.
5113         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5114         (Output_data_got::add_got_entry_pair): Likewise.
5115         (Output_section::add_input_section): Likewise.
5116         (Output_section::add_output_section_data): Likewise.
5117         (Output_segment::set_section_list_addresses): Likewise.
5118         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5119
5120 2011-06-07  Cary Coutant  <ccoutant@google.com>
5121
5122         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5123         for incremental links.
5124         * output.cc (Output_segment::set_section_list_addresses): Remove
5125         FIXME and test for TLS or BSS.
5126
5127 2011-06-07  Cary Coutant  <ccoutant@google.com>
5128
5129         * testsuite/Makefile.am: Add incremental_copy_test,
5130         incremental_common_test_1.
5131         * testsuite/Makefile.in: Regenerate.
5132         * testsuite/common_test_1_v1.c: New source file.
5133         * testsuite/common_test_1_v2.c: New source file.
5134         * testsuite/copy_test_v1.cc: New source file.
5135
5136 2011-06-07  Cary Coutant  <ccoutant@google.com>
5137
5138         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5139         update, allocate common from bss section's free list.
5140         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5141         linker-defined symbols.
5142         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5143         Skip GOT and PLT entries that are no longer referenced.
5144         (Output_section_incremental_inputs::write_info_blocks): Mark
5145         linker-defined symbols.
5146         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5147         * output.cc (Output_section::allocate): New function.
5148         * output.h (Output_section::allocate): New function.
5149         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5150         linker-defined symbols.
5151         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5152         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5153         (Symbol::init_base_output_data): Likewise.
5154         (Symbol::init_base_output_segment): Likewise.
5155         (Symbol::init_base_constant): Likewise.
5156         (Sized_symbol::init_output_data): Likewise.
5157         (Sized_symbol::init_output_segment): Likewise.
5158         (Sized_symbol::init_constant): Likewise.
5159         (Symbol_table::do_define_in_output_data): Likewise.
5160         (Symbol_table::do_define_in_output_segment): Likewise.
5161         (Symbol_table::do_define_as_constant): Likewise.
5162         * symtab.h (Symbol::is_predefined): New function.
5163         (Symbol::init_base_output_data): Add is_predefined parameter.
5164         (Symbol::init_base_output_segment): Likewise.
5165         (Symbol::init_base_constant): Likewise.
5166         (Symbol::is_predefined_): New data member.
5167         (Sized_symbol::init_output_data): Add is_predefined parameter.
5168         (Sized_symbol::init_output_segment): Likewise.
5169         (Sized_symbol::init_constant): Likewise.
5170         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5171
5172 2011-06-07  Cary Coutant  <ccoutant@google.com>
5173
5174         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5175         instead of emit_copy_reloc.
5176         (Copy_relocs::emit_copy_reloc): Refactor.
5177         (Copy_relocs::make_copy_reloc): New function.
5178         (Copy_relocs::add_copy_reloc): Remove.
5179         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5180         section.
5181         (Copy_relocs::make_copy_reloc): New function.
5182         (Copy_relocs::add_copy_reloc): Remove.
5183         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5184         unchanged input files.
5185         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5186         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5187         Reserve BSS space for COPY relocations.
5188         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5189         (Output_section_incremental_inputs::write_info_blocks): Record
5190         whether a symbol is copied from a shared object.
5191         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5192         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5193         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5194         (Incremental_input_entry_reader::get_output_symbol_index): Add
5195         is_copy parameter.
5196         (Incremental_binary::emit_copy_relocs): New function.
5197         (Incremental_binary::do_emit_copy_relocs): New function.
5198         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5199         new data member.
5200         (Sized_incremental_binary::add_copy_reloc): New function.
5201         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5202         (Sized_incremental_binary::Copy_reloc): New struct.
5203         (Sized_incremental_binary::Copy_relocs): New typedef.
5204         (Sized_incremental_binary::copy_relocs_): New data member.
5205         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5206         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5207         * target.h (Sized_target::emit_copy_reloc): New function.
5208         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5209
5210 2011-06-02  Cary Coutant  <ccoutant@google.com>
5211
5212         PR gold/12163
5213         * gold/archive.cc (Archive::Archive): Initialize new data member.
5214         (Archive::include_all_members): Return if archive has already been
5215         included.
5216         * gold/archive.h (Archive::include_all_members_): New data member.
5217
5218 2011-06-02  Nick Clifton  <nickc@redhat.com>
5219
5220         * dynobj.h: Fix spelling mistake in comment.
5221         * output.cc: Likewise.
5222
5223 2011-05-31  Doug Kwan  <dougkwan@google.com>
5224             Asier Llano
5225
5226         PR gold/12826
5227         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5228         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5229         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5230         redundant arm_exidx_test.so.
5231         * testsuite/Makefile.in: Regenerate.
5232         (check_SCRIPTS): Add pr12826.sh
5233         (check_DATA): Add pr12826.stdout
5234         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5235         * testsuite/pr12826.sh: New file.
5236         * testsuite/pr12826_1.s: Ditto.
5237         * testsuite/pr12826_1.s: Ditto.
5238
5239 2011-05-30  Ian Lance Taylor  <iant@google.com>
5240
5241         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5242         sections.
5243
5244 2011-05-29  Ian Lance Taylor  <iant@google.com>
5245
5246         PR gold/12804
5247         * testsuite/Makefile.am: Use different file name for two_file_test
5248         temporary file for each incremental test.
5249         * testsuite/Makefile.in: Rebuild.
5250
5251 2011-05-29  Ian Lance Taylor  <iant@google.com>
5252
5253         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5254         binary input file is empty.
5255
5256 2011-05-27  Ian Lance Taylor  <iant@google.com>
5257
5258         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5259         (ver_test_9.so): Likewise.
5260         * testsuite/Makefile.in: Rebuild.
5261
5262 2011-05-26 Cary Coutant  <ccoutant@google.com>
5263
5264         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5265         * incremental.cc (Incremental_inputs::report_input_section): Fix
5266         comment, indentation.
5267         (Incremental_inputs::report_comdat_group): New function.
5268         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5269         of data for incremental input file entry.
5270         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5271         group count, COMDAT group signatures.
5272         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5273         an unchanged input file.
5274         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5275         Initialize new data member.
5276         (Incremental_object_entry::add_comdat_group): New function.
5277         (Incremental_object_entry::get_comdat_group_count): New function.
5278         (Incremental_object_entry::get_comdat_signature_key): New function.
5279         (Incremental_object_entry::groups_): New data member.
5280         (Incremental_inputs::report_comdat_group): New function.
5281         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5282         data for incremental input file entry.
5283         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5284         (Incremental_input_entry_reader::get_input_section): Adjust size of
5285         data for incremental input file entry.
5286         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5287         (Incremental_input_entry_reader::get_comdat_group_signature): New
5288         function.
5289         * object.cc (Sized_relobj::include_section_group): Report kept
5290         COMDAT groups for incremental links.
5291
5292 2011-05-24  David Meyer  <pdox@google.com>
5293
5294         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5295         with name parameter.  Add found_name parameter.
5296         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5297         * dirsearch.h (class Dirsearch): Update declaration.
5298
5299 2011-05-24  Ian Lance Taylor  <iant@google.com>
5300
5301         * archive.cc (Library_base::should_include_member): Pull in object
5302         from archive if it defines the entry symbol.
5303         * parameters.cc (Parameters::entry): New function.
5304         * parameters.h (class Parameters): Declare entry.
5305         * output.h (class Output_file_header): Remove entry_ field.
5306         * output.cc (Output_file_header::Output_file_header): Remove entry
5307         parameter.  Change all callers.
5308         (Output_file_header::entry): Use parameters->entry.
5309         * gold.cc (queue_middle_tasks): Likewise.
5310         * plugin.cc (Plugin_hook::run): Likewise.
5311
5312 2011-05-24 Cary Coutant  <ccoutant@google.com>
5313
5314         * gold.cc (queue_initial_tasks): Pass incremental base filename
5315         to Output_file::open_base_file; don't print error message.
5316         * incremental-dump.cc (main): Adjust call to
5317         Output_file::open_for_modification.
5318         * incremental-dump.cc (main): Likewise.
5319         * incremental.cc (Incremental_inputs::report_command_line):
5320         Ignore --incremental-base option when comparing command lines.
5321         Ignore parameter when given as separate argument.
5322         * options.h (class General_options): Add --incremental-base.
5323         * output.cc (Output_file::Output_file):
5324         (Output_file::open_base_file): Add base_name and writable parameters;
5325         read base file into new file; print error message here.
5326         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5327         callers.
5328         * output.h (Output_file::open_for_modification): Rename to...
5329         (Output_file::open_base_file): ...this; add base_name and
5330         writable parameters; adjust all callers.
5331         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5332         callers.
5333         * testsuite/Makefile.am (incremental_test_4): Test
5334         --incremental-base.
5335         * testsuite/Makefile.in: Regenerate.
5336
5337 2011-05-24 Cary Coutant  <ccoutant@google.com>
5338
5339         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5340         incremental_test_4.
5341         * testsuite/Makefile.in: Regenerate.
5342         * testsuite/two_file_test_1_v1.cc: New test source file.
5343         * testsuite/two_file_test_1b_v1.cc: New test source file.
5344         * testsuite/two_file_test_2_v1.cc: New test source file.
5345
5346 2011-05-24 Cary Coutant  <ccoutant@google.com>
5347
5348         * dynobj.h (Dynobj::do_dynobj): New function.
5349         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5350         flag and soname for shared objects.
5351         * incremental.cc (Incremental_inputs::report_object): Make
5352         either Incremental_object_entry or Incremental_dynobj_entry; add
5353         soname to string table.
5354         (Incremental_inputs::report_input_section): Add assertion.
5355         (Output_section_incremental_inputs::set_final_data_size): Adjust
5356         type of input file entry for shared libraries; adjust size of
5357         shared library info entry.
5358         (Output_section_incremental_inputs::write_input_files): Write
5359         as_needed flag for shared libraries.
5360         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5361         of input file entry for shared libraries; write soname.
5362         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5363         soname from incremental info.
5364         * incremental.h (enum Incremental_input_flags): Add
5365         INCREMENTAL_INPUT_AS_NEEDED.
5366         (Incremental_input_entry::Incremental_input_entry): Initialize new
5367         data member.
5368         (Incremental_input_entry::set_as_needed): New function.
5369         (Incremental_input_entry::as_needed): New function.
5370         (Incremental_input_entry::do_dynobj_entry): New function.
5371         (Incremental_input_entry::as_needed_): New data member.
5372         (Incremental_object_entry::Incremental_object_entry): Don't check
5373         for shared library.
5374         (Incremental_object_entry::do_type): Likewise.
5375         (class Incremental_dynobj_entry): New class.
5376         (Incremental_input_entry_reader::as_needed): New function.
5377         (Incremental_input_entry_reader::get_soname): New function.
5378         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5379         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5380         size of shared library info entry.
5381         * layout.cc (Layout::finish_dynamic_section): Don't test for
5382         incremental link when adding DT_NEEDED entries.
5383         * object.h (Object::Object): Initialize new data member.
5384         (Object::dynobj): New function.
5385         (Object::set_as_needed): New function.
5386         (Object::as_needed): New function.
5387         (Object::do_dynobj): New function.
5388         (Object::as_needed_): New data member.
5389
5390 2011-05-24 Cary Coutant  <ccoutant@google.com>
5391
5392         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5393         info; adjust display of GOT entries.
5394         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5395         vector of input objects; remove file_status_.
5396         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5397         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5398         got_plt reader; call target hooks to reserve GOT entries.
5399         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5400         of input file info header and GOT info entry.
5401         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5402         relocation info.
5403         (Got_plt_view_info::got_descriptor): Remove.
5404         (Got_plt_view_info::sym_index): New data member.
5405         (Got_plt_view_info::input_index): New data member.
5406         (Local_got_offset_visitor::visit): Write input file index.
5407         (Global_got_offset_visitor::visit): Write 0 for input file index.
5408         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5409         with sym_index and input_index.
5410         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5411         incremental info GOT entry; replace got_descriptor with input_index.
5412         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5413         map from input file index to object.
5414         (Sized_relobj_incr::do_layout): Replace direct data member reference
5415         with accessor function.
5416         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5417         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5418         Adjust size of input file info header.
5419         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5420         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5421         (Incremental_input_entry_reader::get_input_section): Adjust size of
5422         input file info header.
5423         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5424         of incremental info GOT entry.
5425         (Incremental_got_plt_reader::get_got_desc): Remove.
5426         (Incremental_got_plt_reader::get_got_symndx): New function.
5427         (Incremental_got_plt_reader::get_got_input_index): New function.
5428         (Sized_incremental_binary::Sized_incremental_binary): Remove
5429         file_status_; add input_objects_.
5430         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5431         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5432         (Sized_incremental_binary::file_is_unchanged): Remove.
5433         (Sized_incremental_binary::set_input_object): New function.
5434         (Sized_incremental_binary::input_object): New function.
5435         (Sized_incremental_binary::file_status_): Remove.
5436         (Sized_incremental_binary::input_objects_): New data member.
5437         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5438         references.
5439         (Sized_relobj_incr::invalid_address): Move to base class.
5440         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5441         class.
5442         (Sized_relobj_incr::do_output_section_offset): Likewise.
5443         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5444         (Sized_relobj_incr::section_offsets_): Likewise.
5445         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5446         function.
5447         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5448         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5449         with accessor function.
5450         (Sized_relobj_file::do_layout): Likewise.
5451         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5452         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5453         (Sized_relobj_file::compute_final_local_value): Replace refs to
5454         section_offsets_ with accessor function.
5455         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5456         * object.h (Relobj::Relobj): Initialize new data members.
5457         (Relobj::add_dyn_reloc): New function.
5458         (Relobj::first_dyn_reloc): New function.
5459         (Relobj::dyn_reloc_count): New function.
5460         (Relobj::first_dyn_reloc_): New data member.
5461         (Relobj::dyn_reloc_count_): New data member.
5462         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5463         references.
5464         (Sized_relobj::Address): New typedef.
5465         (Sized_relobj::invalid_address): Move here from child class.
5466         (Sized_relobj::Sized_relobj): Initialize new data members.
5467         (Sized_relobj::sized_relobj): New function.
5468         (Sized_relobj::is_output_section_offset_invalid): Move here from
5469         child class.
5470         (Sized_relobj::get_output_section_offset): Likewise.
5471         (Sized_relobj::local_has_got_offset): Likewise.
5472         (Sized_relobj::local_got_offset): Likewise.
5473         (Sized_relobj::set_local_got_offset): Likewise.
5474         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5475         (Sized_relobj::clear_got_offsets): New function.
5476         (Sized_relobj::section_offsets): Move here from child class.
5477         (Sized_relobj::do_output_section_offset): Likewise.
5478         (Sized_relobj::do_set_section_offset): Likewise.
5479         (Sized_relobj::Local_got_offsets): Likewise.
5480         (Sized_relobj::local_got_offsets_): Likewise.
5481         (Sized_relobj::section_offsets_): Likewise.
5482         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5483         references.
5484         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5485         class.
5486         (Sized_relobj_file::sized_relobj): New function
5487         (Sized_relobj_file::local_has_got_offset): Move to base class.
5488         (Sized_relobj_file::local_got_offset): Likewise.
5489         (Sized_relobj_file::set_local_got_offset): Likewise.
5490         (Sized_relobj_file::get_output_section_offset): Likewise.
5491         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5492         (Sized_relobj_file::do_output_section_offset): Likewise.
5493         (Sized_relobj_file::do_set_section_offset): Likewise.
5494         (Sized_relobj_file::Local_got_offsets): Likewise.
5495         (Sized_relobj_file::local_got_offsets_): Likewise.
5496         (Sized_relobj_file::section_offsets_): Likewise.
5497         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5498         (all constructors).
5499         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5500         (Output_reloc::get_symbol_index): Likewise.
5501         (Output_reloc::local_section_offset): Likewise.
5502         (Output_reloc::get_address): Likewise.
5503         (Output_reloc::symbol_value): Likewise.
5504         (Output_data_got::reserve_slot): Move to class definition.
5505         (Output_data_got::reserve_local): New function.
5506         (Output_data_got::reserve_slot_for_global): Remove.
5507         (Output_data_got::reserve_global): New function.
5508         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5509         (all constructors, two instantiations).
5510         (Output_reloc::get_relobj): New function (two instantiations).
5511         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5512         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5513         (Output_data_reloc::add_global): Adjust type of relobj.
5514         (Output_data_reloc::add_global_relative): Likewise.
5515         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5516         (Output_data_reloc::add_local): Likewise.
5517         (Output_data_reloc::add_local_relative): Likewise.
5518         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5519         (Output_data_reloc::add_local_section): Likewise.
5520         (Output_data_reloc::add_output_section): Likewise.
5521         (Output_data_reloc::add_absolute): Likewise.
5522         (Output_data_reloc::add_target_specific): Likewise.
5523         (Output_data_got::reserve_slot): Move definition here.
5524         (Output_data_got::reserve_local): New function.
5525         (Output_data_got::reserve_global): New function.
5526         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5527         section_offsets_ with accessor function.
5528         (Sized_relobj_file::write_sections): Likewise.
5529         (Sized_relobj_file::do_relocate_sections): Likewise.
5530         * target.h (Sized_target::reserve_local_got_entry): New function.
5531         (Sized_target::reserve_global_got_entry): New function.
5532         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5533         (Target_x86_64::reserve_global_got_entry): New function.
5534         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5535
5536 2011-05-23 Cary Coutant  <ccoutant@google.com>
5537
5538         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5539         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5540         bit when checking got_type.
5541         * incremental.cc (Sized_incremental_binary::setup_readers):
5542         Store symbol table and string table locations; initialize bit vector
5543         of file status flags.
5544         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5545         unchanged files.
5546         (Sized_incremental_binary::do_process_got_plt): New function.
5547         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5548         (Output_section_incremental_inputs::set_final_data_size): Record
5549         file index for each input file.
5550         (Output_section_incremental_inputs::write_got_plt): Store file index
5551         instead of input entry offset for each GOT entry.
5552         * incremental.h
5553         (Incremental_input_entry::Incremental_input_entry): Initialize new
5554         data member.
5555         (Incremental_input_entry::set_offset): Store file index.
5556         (Incremental_input_entry::get_file_index): New function.
5557         (Incremental_input_entry::file_index_): New data member.
5558         (Incremental_binary::process_got_plt): New function.
5559         (Incremental_binary::do_process_got_plt): New function.
5560         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5561         data members.
5562         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5563         (Sized_incremental_binary::set_file_is_unchanged): New function.
5564         (Sized_incremental_binary::file_is_unchanged): New function.
5565         (Sized_incremental_binary::do_process_got_plt): New function.
5566         (Sized_incremental_binary::file_status_): New data member.
5567         (Sized_incremental_binary::main_symtab_loc_): New data member.
5568         (Sized_incremental_binary::main_strtab_loc_): New data member.
5569         * output.cc (Output_data_got::Got_entry::write): Add case
5570         RESERVED_CODE.
5571         (Output_data_got::add_global): Call add_got_entry.
5572         (Output_data_got::add_global_plt): Likewise.
5573         (Output_data_got::add_global_with_rel): Likewise.
5574         (Output_data_got::add_global_with_rela): Likewise.
5575         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5576         (Output_data_got::add_global_pair_with_rela): Likewise.
5577         (Output_data_got::add_local): Call add_got_entry.
5578         (Output_data_got::add_local_plt): Likewise.
5579         (Output_data_got::add_local_with_rel): Likewise.
5580         (Output_data_got::add_local_with_rela): Likewise.
5581         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5582         (Output_data_got::add_local_pair_with_rela): Likewise.
5583         (Output_data_got::reserve_slot): New function.
5584         (Output_data_got::reserve_slot_for_global): New function.
5585         (Output_data_got::add_got_entry): New function.
5586         (Output_data_got::add_got_entry_pair): New function.
5587         (Output_section::add_output_section_data): Edit FIXME.
5588         * output.h
5589         (Output_section_data_build::Output_section_data_build): New
5590         constructor with size parameter.
5591         (Output_data_space::Output_data_space): Likewise.
5592         (Output_data_got::Output_data_got): Initialize new data member; new
5593         constructor with size parameter.
5594         (Output_data_got::add_constant): Call add_got_entry.
5595         (Output_data_got::reserve_slot): New function.
5596         (Output_data_got::reserve_slot_for_global): New function.
5597         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5598         (Output_data_got::add_got_entry): New function.
5599         (Output_data_got::add_got_entry_pair): New function.
5600         (Output_data_got::free_list_): New data member.
5601         * target.h (Sized_target::init_got_plt_for_update): New function.
5602         (Sized_target::register_global_plt_entry): New function.
5603         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5604         Initialize new data member; call init; add constructor with PLT count.
5605         (Output_data_plt_x86_64::init): New function.
5606         (Output_data_plt_x86_64::add_relocation): New function.
5607         (Output_data_plt_x86_64::reserve_slot): New function.
5608         (Output_data_plt_x86_64::free_list_): New data member.
5609         (Target_x86_64::init_got_plt_for_update): New function.
5610         (Target_x86_64::register_global_plt_entry): New function.
5611         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5612         incremental updates.
5613         (Output_data_plt_x86_64::add_relocation): New function.
5614         * testsuite/object_unittest.cc (Object_test): Set default options.
5615
5616 2011-05-16  Ian Lance Taylor  <iant@google.com>
5617
5618         * options.h (class General_options): Make -i a synonym for -r.
5619
5620 2011-05-16  Ian Lance Taylor  <iant@google.com>
5621
5622         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5623
5624 2011-05-10 Cary Coutant  <ccoutant@google.com>
5625
5626         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5627         strip_all (-s).
5628
5629 2011-05-06  Ian Lance Taylor  <iant@google.com>
5630
5631         * layout.cc (Layout::layout): If the output section flags change,
5632         update the ordering.
5633
5634 2011-04-25 Cary Coutant  <ccoutant@google.com>
5635
5636         * incremental-dump.cc (dump_incremental_inputs): Print local
5637         symbol info for each input file.
5638         * incremental.cc
5639         (Output_section_incremental_inputs::set_final_data_size): Add local
5640         symbol info to input file entries in incremental info.
5641         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5642         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5643         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5644         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5645         implementation.
5646         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5647         (Sized_incr_relobj::do_relocate): Write the local symbols.
5648         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5649         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5650         Adjust size of input file header.
5651         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5652         (Incremental_inputs_reader::get_local_symbol_count): New function.
5653         (Incremental_inputs_reader::get_input_section): Adjust size of input
5654         file header.
5655         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5656         (Sized_incr_relobj::This): New typedef.
5657         (Sized_incr_relobj::sym_size): New const data member.
5658         (Sized_incr_relobj::Local_symbol): New struct.
5659         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5660         (Sized_incr_relobj::do_local_symbol_offset): New function.
5661         (Sized_incr_relobj::local_symbol_count_): New data member.
5662         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5663         (Sized_incr_relobj::local_symbol_index_): New data member.
5664         (Sized_incr_relobj::local_symbol_offset_): New data member.
5665         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5666         (Sized_incr_relobj::local_symbols_): New data member.
5667         * object.h (Relobj::output_local_symbol_count): New function.
5668         (Relobj::local_symbol_offset): New function.
5669         (Relobj::do_output_local_symbol_count): New function.
5670         (Relobj::do_local_symbol_offset): New function.
5671         (Sized_relobj::do_output_local_symbol_count): New function.
5672         (Sized_relobj::do_local_symbol_offset): New function.
5673
5674 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5675
5676         * descriptors.cc (set_close_on_exec): New function.
5677         (Descriptors::open): Use set_close_on_exec.
5678         * output.cc (S_ISLNK): Define if not defined.
5679
5680 2011-04-22 Cary Coutant  <ccoutant@google.com>
5681
5682         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5683         global symbol map.
5684         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5685         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5686         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5687         relocations.
5688         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5689         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5690         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5691         * incremental.h
5692         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5693         function.
5694         (Incremental_binary::apply_incremental_relocs): New function.
5695         (Incremental_binary::do_apply_incremental_relocs): New function.
5696         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5697         data member.
5698         (Sized_incremental_binary::add_global_symbol): New function.
5699         (Sized_incremental_binary::global_symbol): New function.
5700         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5701         (Sized_incremental_binary::symbol_map_): New data member.
5702         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5703         * target.h (Sized_target::apply_relocation): New function.
5704         * target-reloc.h (apply_relocation): New function.
5705         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5706
5707 2011-04-22  Doug Kwan  <dougkwan@google.com>
5708
5709         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5710         flag of a SHT_ARM_EXIDX section.
5711         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5712         * testsuite/Makefile.in: Regenerate.
5713         * testsuite/arm_exidx_test.s: New file.
5714         * testsuite/arm_exidx_test.sh: Same.
5715
5716 2011-04-20 Cary Coutant  <ccoutant@google.com>
5717
5718         PR gold/12689
5719         * archive.h (Incremental_archive_entry::Archive_member):
5720         Initialize arg_serial_ (second constructor).
5721
5722 2011-04-17  Ian Lance Taylor  <iant@google.com>
5723
5724         * object.cc (Relocate_info::location): Simplify location string.
5725         * errors.cc (Errors::error_at_location): Don't print program
5726         name.
5727         (Errors::warning_at_location): Likewise.
5728         (Errors::undefined_symbol): Likewise.
5729         * testsuite/debug_msg.sh: Update accordingly.
5730
5731 2011-04-14 Cary Coutant  <ccoutant@google.com>
5732
5733         * gold/layout.cc (Layout::symtab_section_offset): New function.
5734         * gold/layout.h (Layout::symtab_section_offset): New function.
5735         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5736
5737 2011-04-12  Ian Lance Taylor  <iant@google.com>
5738
5739         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5740         with MREMAP_MAYMOVE.
5741         * output.h (class Output_file): Add map_is_allocated_ field.
5742         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5743         not available, provide stubs.  If mremap is not available, #define
5744         it to gold_mremap.
5745         (MREMAP_MAYMOVE): Define if not defined.
5746         (Output_file::Output_file): Initialize map_is_allocated_.
5747         (Output_file::resize): Check map_is_allocated_.
5748         (Output_file::map_anonymous): If mmap fails, use malloc.
5749         (Output_file::unmap): Don't do anything for an anonymous map.
5750         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5751         is not available, provide stubs.
5752         (File_read::View::~View): Use free rather than delete[].
5753         (File_read::make_view): Use malloc rather than new[].  If mmap
5754         fails, use malloc.
5755         (File_read::find_or_make_view): Use malloc rather than new[].
5756         * gold.h: Remove HAVE_REMAP code.
5757         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5758         exists.  Rename mremap to gold_mremap.  If mmap is not available
5759         don't do anything.
5760         * configure, config.in: Rebuild.
5761
5762 2011-04-11  Ian Lance Taylor  <iant@google.com>
5763
5764         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5765         initialize local variable v.
5766
5767 2011-04-11  Cary Coutant  <ccoutant@google.com>
5768
5769         * archive.cc (Archive::include_member): Adjust call to
5770         report_object.
5771         (Add_archive_symbols::run): Track argument serial numbers.
5772         (Lib_group::include_member): Likewise.
5773         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5774         * archive.h (Incremental_archive_entry::Archive_member):
5775         Initialize arg_serial_.
5776         (Archive_member::arg_serial_): New data member.
5777         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5778         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5779         incremental link.
5780         (Sized_dynobj::do_for_all_local_got_entries): New function.
5781         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5782         function.
5783         * fileread.cc (get_mtime): New function.
5784         * fileread.h (get_mtime): New function.
5785         * gold.cc (queue_initial_tasks): Check for incremental update.
5786         (process_incremental_input): New function.
5787         (queue_middle_tasks): Don't force valid target for incremental
5788         update.
5789         * incremental-dump.cc (find_input_containing_global): Adjust
5790         size of symbol info entry.
5791         (dump_incremental_inputs): Dump argument serial number and
5792         in_system_directory flag; bias shndx by 1; print symbol names
5793         when dumping per-file symbol lists; use new symbol info readers.
5794         * incremental.cc
5795         (Output_section_incremental_inputs:update_data_size): New function.
5796         (Sized_incremental_binary::setup_readers): Setup input readers
5797         for each input file; build maps for files added from libraries
5798         and scripts.
5799         (Sized_incremental_binary::check_input_args): New function.
5800         (Sized_incremental_binary::do_check_inputs): Build map of argument
5801         serial numbers to input arguments.
5802         (Sized_incremental_binary::do_file_has_changed): Rename
5803         do_file_is_unchanged to this; compare file modification times.
5804         (Sized_incremental_binary::do_init_layout): New function.
5805         (Sized_incremental_binary::do_reserve_layout): New function.
5806         (Sized_incremental_binary::do_get_input_reader): Remove.
5807         (Sized_incremental_binary::get_symtab_view): New function.
5808         (Incremental_checker::can_incrementally_link_output_file): Remove.
5809         (Incremental_inputs::report_command_line): Exclude --debug options.
5810         (Incremental_inputs::report_archive_begin): Add parameter; track
5811         argument serial numbers; don't put input file entry for archive
5812         before archive members.
5813         (Incremental_inputs::report_archive_end): Put input file entry
5814         for archive after archive members.
5815         (Incremental_inputs::report_object): Add parameter; track argument
5816         serial numbers and in_system_directory flag.
5817         (Incremental_inputs::report_script): Add parameter; track argument
5818         serial numbers.
5819         (Output_section_incremental_inputs::set_final_data_size): Adjust
5820         size of symbol info entry; check for forwarding symbols.
5821         (Output_section_incremental_inputs::write_input_files): Write
5822         in_system_directory flag and argument serial number.
5823         (Output_section_incremental_inputs::write_info_blocks): Map section
5824         indices between incremental info and original input file; store
5825         input section index for each symbol.
5826         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5827         change operator() to visit().
5828         (class Global_got_offset_visitor): Likewise.
5829         (class Global_symbol_visitor_got_plt):
5830         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5831         classes.
5832         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5833         (Sized_incr_relobj::do_read_symbols): New function.
5834         (Sized_incr_relobj::do_layout): New function.
5835         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5836         (Sized_incr_relobj::do_add_symbols): New function.
5837         (Sized_incr_relobj::do_should_include_member): New function.
5838         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5839         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5840         (Sized_incr_relobj::do_section_size): New function.
5841         (Sized_incr_relobj::do_section_name): New function.
5842         (Sized_incr_relobj::do_section_contents): New function.
5843         (Sized_incr_relobj::do_section_flags): New function.
5844         (Sized_incr_relobj::do_section_entsize): New function.
5845         (Sized_incr_relobj::do_section_address): New function.
5846         (Sized_incr_relobj::do_section_type): New function.
5847         (Sized_incr_relobj::do_section_link): New function.
5848         (Sized_incr_relobj::do_section_info): New function.
5849         (Sized_incr_relobj::do_section_addralign): New function.
5850         (Sized_incr_relobj::do_initialize_xindex): New function.
5851         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5852         (Sized_incr_relobj::do_read_relocs): New function.
5853         (Sized_incr_relobj::do_gc_process_relocs): New function.
5854         (Sized_incr_relobj::do_scan_relocs): New function.
5855         (Sized_incr_relobj::do_count_local_symbols): New function.
5856         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5857         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5858         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5859         (Sized_incr_relobj::do_relocate): New function.
5860         (Sized_incr_relobj::do_set_section_offset): New function.
5861         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5862         (Sized_incr_dynobj::do_read_symbols): New function.
5863         (Sized_incr_dynobj::do_layout): New function.
5864         (Sized_incr_dynobj::do_add_symbols): New function.
5865         (Sized_incr_dynobj::do_should_include_member): New function.
5866         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5867         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5868         (Sized_incr_dynobj::do_section_size): New function.
5869         (Sized_incr_dynobj::do_section_name): New function.
5870         (Sized_incr_dynobj::do_section_contents): New function.
5871         (Sized_incr_dynobj::do_section_flags): New function.
5872         (Sized_incr_dynobj::do_section_entsize): New function.
5873         (Sized_incr_dynobj::do_section_address): New function.
5874         (Sized_incr_dynobj::do_section_type): New function.
5875         (Sized_incr_dynobj::do_section_link): New function.
5876         (Sized_incr_dynobj::do_section_info): New function.
5877         (Sized_incr_dynobj::do_section_addralign): New function.
5878         (Sized_incr_dynobj::do_initialize_xindex): New function.
5879         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5880         (make_sized_incremental_object): New function.
5881         (Incremental_library::copy_unused_symbols): New function.
5882         (Incremental_library::do_for_all_unused_symbols): New function.
5883         * incremental.h (enum Incremental_input_flags): New type.
5884         (class Incremental_checker): Remove.
5885         (Incremental_input_entry::Incremental_input_entry): Add argument
5886         serial number.
5887         (Incremental_input_entry::arg_serial): New function.
5888         (Incremental_input_entry::set_is_in_system_directory): New function.
5889         (Incremental_input_entry::is_in_system_directory): New function.
5890         (Incremental_input_entry::arg_serial_): New data member.
5891         (Incremental_input_entry::is_in_system_directory_): New data member.
5892         (class Script_info): Move here from script.h.
5893         (Script_info::Script_info): Add filename parameter.
5894         (Script_info::filename): New function.
5895         (Script_info::filename_): New data member.
5896         (Incremental_script_entry::Incremental_script_entry): Add argument
5897         serial number.
5898         (Incremental_object_entry::Incremental_object_entry): Likewise.
5899         (Incremental_object_entry::add_input_section): Build list of input
5900         sections with map to original shndx.
5901         (Incremental_object_entry::get_input_section_index): New function.
5902         (Incremental_object_entry::shndx_): New data member.
5903         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5904         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5905         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5906         serial number.
5907         (Incremental_inputs::report_archive_begin): Likewise.
5908         (Incremental_inputs::report_object): Likewise.
5909         (Incremental_inputs::report_script): Likewise.
5910         (class Incremental_global_symbol_reader): New class.
5911         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5912         and store flags and input file type.
5913         (Incremental_input_entry_reader::arg_serial): New function.
5914         (Incremental_input_entry_reader::type): Extract type from flags.
5915         (Incremental_input_entry_reader::is_in_system_directory): New function.
5916         (Incremental_input_entry_reader::get_input_section_count): Call
5917         accessor function for type.
5918         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5919         function for type; adjust size of global symbol entry.
5920         (Incremental_input_entry_reader::get_global_symbol_count): Call
5921         accessor function for type.
5922         (Incremental_input_entry_reader::get_object_count): Likewise.
5923         (Incremental_input_entry_reader::get_object_offset): Likewise.
5924         (Incremental_input_entry_reader::get_member_count): Likewise.
5925         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5926         (Incremental_input_entry_reader::get_member_offset): Likewise.
5927         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5928         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5929         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5930         (Incremental_input_entry_reader::get_global_symbol_reader): New
5931         function.
5932         (Incremental_input_entry_reader::get_output_symbol_index): New
5933         function.
5934         (Incremental_input_entry_reader::type_): Remove.
5935         (Incremental_input_entry_reader::flags_): New data member.
5936         (Incremental_inputs_reader::input_file_offset): New function.
5937         (Incremental_inputs_reader::input_file_index): New function.
5938         (Incremental_inputs_reader::input_file): Call input_file_offset.
5939         (Incremental_inputs_reader::input_file_at_offset): New function.
5940         (Incremental_relocs_reader::get_r_type): Reformat.
5941         (Incremental_relocs_reader::get_r_shndx): Reformat.
5942         (Incremental_relocs_reader::get_r_offset): Reformat.
5943         (Incremental_relocs_reader::data): New function.
5944         (Incremental_binary::Incremental_binary): Initialize new data members.
5945         (Incremental_binary::check_inputs): Add cmdline parameter.
5946         (Incremental_binary::file_is_unchanged): Remove.
5947         (Input_reader::arg_serial): New function.
5948         (Input_reader::get_unused_symbol_count): New function.
5949         (Input_reader::get_unused_symbol): New function.
5950         (Input_reader::do_arg_serial): New function.
5951         (Input_reader::do_get_unused_symbol_count): New function.
5952         (Input_reader::do_get_unused_symbol): New function.
5953         (Incremental_binary::input_file_count): New function.
5954         (Incremental_binary::get_input_reader): Change signature to use
5955         index instead of filename.
5956         (Incremental_binary::file_has_changed): New function.
5957         (Incremental_binary::get_input_argument): New function.
5958         (Incremental_binary::get_library): New function.
5959         (Incremental_binary::get_script_info): New function.
5960         (Incremental_binary::init_layout): New function.
5961         (Incremental_binary::reserve_layout): New function.
5962         (Incremental_binary::output_file): New function.
5963         (Incremental_binary::do_check_inputs): New function.
5964         (Incremental_binary::do_file_is_unchanged): Remove.
5965         (Incremental_binary::do_file_has_changed): New function.
5966         (Incremental_binary::do_init_layout): New function.
5967         (Incremental_binary::do_reserve_layout): New function.
5968         (Incremental_binary::do_input_file_count): New function.
5969         (Incremental_binary::do_get_input_reader): Change signature.
5970         (Incremental_binary::input_args_map_): New data member.
5971         (Incremental_binary::library_map_): New data member.
5972         (Incremental_binary::script_map_): New data member.
5973         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5974         new data members.
5975         (Sized_incremental_binary::output_section): New function.
5976         (Sized_incremental_binary::inputs_reader): Add const.
5977         (Sized_incremental_binary::symtab_reader): Add const.
5978         (Sized_incremental_binary::relocs_reader): Add const.
5979         (Sized_incremental_binary::got_plt_reader): Add const.
5980         (Sized_incremental_binary::get_symtab_view): New function.
5981         (Sized_incremental_binary::Inputs_reader): New typedef.
5982         (Sized_incremental_binary::Input_entry_reader): New typedef.
5983         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5984         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5985         (Sized_incremental_binary::do_file_has_changed): New function.
5986         (Sized_incremental_binary::do_init_layout): New function.
5987         (Sized_incremental_binary::do_reserve_layout): New function.
5988         (Sized_input_reader::Inputs_reader): Remove.
5989         (Sized_input_reader::Input_entry_reader): Remove.
5990         (Sized_input_reader::do_arg_serial): New function.
5991         (Sized_input_reader::do_get_unused_symbol_count): New function.
5992         (Sized_input_reader::do_get_unused_symbol): New function.
5993         (Sized_incremental_binary::do_input_file_count): New function.
5994         (Sized_incremental_binary::do_get_input_reader): Change signature;
5995         use index instead of filename.
5996         (Sized_incremental_binary::section_map_): New data member.
5997         (Sized_incremental_binary::input_entry_readers_): New data member.
5998         (class Sized_incr_relobj): New class.
5999         (class Sized_incr_dynobj): New class.
6000         (make_sized_incremental_object): New function.
6001         (class Incremental_library): New class.
6002         * layout.cc (Free_list::num_lists): New static data member.
6003         (Free_list::num_nodes): New static data member.
6004         (Free_list::num_removes): New static data member.
6005         (Free_list::num_remove_visits): New static data member.
6006         (Free_list::num_allocates): New static data member.
6007         (Free_list::num_allocate_visits): New static data member.
6008         (Free_list::init): New function.
6009         (Free_list::remove): New function.
6010         (Free_list::allocate): New function.
6011         (Free_list::dump): New function.
6012         (Free_list::print_stats): New function.
6013         (Layout_task_runner::run): Resize output file for incremental updates.
6014         (Layout::Layout): Initialize new data members.
6015         (Layout::set_incremental_base): New function.
6016         (Layout::init_fixed_output_section): New function.
6017         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6018         incremental updates.
6019         (Layout::create_gold_note): Do not create gold note section for
6020         incremental updates.
6021         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6022         for incremental updates.
6023         (Layout::set_section_offsets): For incremental updates, allocate space
6024         from free list.
6025         (Layout::create_symtab_sections): Layout with offsets relative to
6026         start of section; for incremental updates, allocate space from free
6027         list.
6028         (Layout::create_shdrs): For incremental updates, allocate space from
6029         free list.
6030         (Layout::finish_dynamic_section): For incremental updates, do not
6031         check --as-needed (fixed in subsequent patch).
6032         * layout.h (class Free_list): New class.
6033         (Layout::set_incremental_base): New function.
6034         (Layout::incremental_base): New function.
6035         (Layout::init_fixed_output_section): New function.
6036         (Layout::allocate): New function.
6037         (Layout::incremental_base_): New data member.
6038         (Layout::free_list_): New data member.
6039         * main.cc (main): Print Free_list statistics.
6040         * object.cc (Relobj::finalize_incremental_relocs): Add
6041         clear_counts parameter; clear counts only when clear_counts is set.
6042         (Sized_relobj::Sized_relobj): Initialize new base class.
6043         (Sized_relobj::do_layout): Don't report special sections.
6044         (Sized_relobj::do_for_all_local_got_entries): New function.
6045         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6046         symtab_off to all symbol table offsets.
6047         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6048         * object.h (class Got_offset_list): Move to top of file.
6049         (Object::Object): Allow case where input_file == NULL.
6050         (Object::~Object): Likewise.
6051         (Object::input_file): Assert that input_file != NULL.
6052         (Object::lock): Allow case where input_file == NULL.
6053         (Object::unlock): Likewise.
6054         (Object::is_locked): Likewise.
6055         (Object::token): Likewise.
6056         (Object::release): Likewise.
6057         (Object::is_incremental): New function.
6058         (Object::get_mtime): New function.
6059         (Object::for_all_local_got_entries): New function.
6060         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6061         (Object::set_is_in_system_directory): New function.
6062         (Object::is_in_system_directory): New function.
6063         (Object::do_is_incremental): New function.
6064         (Object::do_get_mtime): New function.
6065         (Object::do_for_all_local_got_entries): New function.
6066         (Object::is_in_system_directory_): New data member.
6067         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6068         (class Sized_relobj_base): New class.
6069         (class Sized_relobj): Derive from Sized_relobj_base.
6070         (class Sized_relobj::Symbols): Redeclare from base class.
6071         (class Sized_relobj::local_got_offset_list): Remove.
6072         (class Sized_relobj::Output_sections): Redeclare from base class.
6073         (class Sized_relobj::do_for_all_local_got_entries): New function.
6074         (class Sized_relobj::write_local_symbols): Add offset parameter.
6075         (class Sized_relobj::local_symbol_offset_): Update comment.
6076         (class Sized_relobj::local_dynsym_offset_): Update comment.
6077         * options.cc (Input_arguments::add_file): Remove const.
6078         * options.h (Input_file_argument::Input_file_argument):
6079         Initialize arg_serial_ (all constructors).
6080         (Input_file_argument::set_arg_serial): New function.
6081         (Input_file_argument::arg_serial): New function.
6082         (Input_file_argument::arg_serial_): New data member.
6083         (Input_arguments::Input_arguments): Initialize file_count_.
6084         (Input_arguments::add_file): Remove const.
6085         (Input_arguments::number_of_input_files): New function.
6086         (Input_arguments::file_count_): New data member.
6087         (Command_line::number_of_input_files): Call
6088         Input_arguments::number_of_input_files.
6089         * output.cc (Output_segment_headers::Output_segment_headers):
6090         Set current size.
6091         (Output_section::Input_section::current_data_size): New function.
6092         (Output_section::Output_section): Initialize new data members.
6093         (Output_section::add_input_section): Don't do merge sections for
6094         an incremental link; allocate space from free list for an
6095         incremental update.
6096         (Output_section::add_output_section_data): Allocate space from
6097         free list for an incremental update.
6098         (Output_section::update_data_size): New function.
6099         (Output_section::set_fixed_layout): New function.
6100         (Output_section::reserve): New function.
6101         (Output_segment::set_section_addresses): Remove const.
6102         (Output_segment::set_section_list_addresses): Remove const; allocate
6103         space from free list for an incremental update.
6104         (Output_segment::set_offset): Adjust size of RELRO segment for an
6105         incremental update.
6106         * output.h (Output_data::current_data_size): Move here from
6107         child classes.
6108         (Output_data::pre_finalize_data_size): New function.
6109         (Output_data::update_data_size): New function.
6110         (Output_section_headers::update_data_size): new function.
6111         (Output_section_data_build::current_data_size): Move to Output_data.
6112         (Output_data_strtab::update_data_size): New function.
6113         (Output_section::current_data_size): Move to Output_data.
6114         (Output_section::set_fixed_layout): New function.
6115         (Output_section::has_fixed_layout): New function.
6116         (Output_section::reserve): New function.
6117         (Output_section::update_data_size): New function.
6118         (Output_section::has_fixed_layout_): New data member.
6119         (Output_section::free_list_): New data member.
6120         (Output_segment::set_section_addresses): Remove const.
6121         (Output_segment::set_section_list_addresses): Remove const.
6122         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6123         New function.
6124         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6125         New function.
6126         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6127         parameter when calling Add_symbols constructor; store argument
6128         serial number for members of a lib group.
6129         (Add_symbols::locks): Allow case where token == NULL.
6130         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6131         (Read_member::~Read_member): New function.
6132         (Read_member::is_runnable): New function.
6133         (Read_member::locks): New function.
6134         (Read_member::run): New function.
6135         (Check_script::~Check_script): New function.
6136         (Check_script::is_runnable): New function.
6137         (Check_script::locks): New function.
6138         (Check_script::run): New function.
6139         (Check_library::~Check_library): New function.
6140         (Check_library::is_runnable): New function.
6141         (Check_library::locks): New function.
6142         (Check_library::run): New function.
6143         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6144         (Add_symbols::library_): New data member.
6145         (class Read_member): New class.
6146         (class Check_script): New class.
6147         (class Check_library): New class.
6148         * reloc.cc (Read_relocs::is_runnable): Allow case where
6149         token == NULL.
6150         (Read_relocs::locks): Likewise.
6151         (Scan_relocs::locks): Likewise.
6152         (Relocate_task::locks): Likewise.
6153         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6154         to clear counters.
6155         (Sized_relobj::incremental_relocs_scan): Fix comment.
6156         (Sized_relobj::do_relocate): Pass output file offset to
6157         write_local_symbols.
6158         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6159         from class declaration.
6160         * script.cc (read_input_script): Allocate Script_info; pass
6161         argument serial number to report_script.
6162         * script.h (class Script_info): Move to incremental.h.
6163         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6164         * symtab.h (Symbol_table::add_from_incrobj): New function.
6165         (Symbol_table::set_file_offset): New function.
6166
6167 2011-04-05  Cary Coutant  <ccoutant@google.com>
6168
6169         * incremental-dump.cc (dump_incremental_inputs): Change signature
6170         to take a Sized_incremental_binary; change caller.  Use readers
6171         in Sized_incremental_binary.
6172         * incremental.cc
6173         (Sized_incremental_binary::find_incremental_inputs_sections):
6174         Rename do_find_incremental_inputs_sections to this.
6175         (Sized_incremental_binary::setup_readers): New function.
6176         (Sized_incremental_binary::do_check_inputs): Check
6177         has_incremental_info_ flag; move setup code to setup_readers;
6178         use input readers.
6179         (Sized_incremental_binary::do_file_is_unchanged): New function.
6180         (Sized_incremental_binary::do_get_input_reader): New function.
6181         * incremental.h (class Incremental_binary): Move to end of file.
6182         (Incremental_binary::file_is_unchanged): New function.
6183         (Incremental_binary::do_file_is_unchanged): New function.
6184         (Incremental_binary::Input_reader): New class.
6185         (Incremental_binary::get_input_reader): New function.
6186         (class Sized_incremental_binary): Move to end of file.
6187         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6188         input section reader classes.
6189         (Sized_incremental_binary::has_incremental_info): New function.
6190         (Sized_incremental_binary::inputs_reader): New function.
6191         (Sized_incremental_binary::symtab_reader): New function.
6192         (Sized_incremental_binary::relocs_reader): New function.
6193         (Sized_incremental_binary::got_plt_reader): New function.
6194         (Sized_incremental_binary::do_file_is_unchanged): New function.
6195         (Sized_incremental_binary::Sized_input_reader): New class.
6196         (Sized_incremental_binary::get_input_reader): New function.
6197         (Sized_incremental_binary::find_incremental_inputs_sections):
6198         Rename do_find_incremental_inputs_sections to this.
6199         (Sized_incremental_binary::setup_readers): New function.
6200         (Sized_incremental_binary::has_incremental_info_): New data member.
6201         (Sized_incremental_binary::inputs_reader_): New data member.
6202         (Sized_incremental_binary::symtab_reader_): New data member.
6203         (Sized_incremental_binary::relocs_reader_): New data member.
6204         (Sized_incremental_binary::got_plt_reader_): New data member.
6205         (Sized_incremental_binary::current_input_file_): New data member.
6206
6207 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6208
6209         PR gold/12640
6210         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6211         violation.
6212
6213 2011-03-30  Cary Coutant  <ccoutant@google.com>
6214
6215         * archive.cc (Archive::include_member): Adjust call to report_object.
6216         (Add_archive_symbols::run): Add script_info to call to
6217         report_archive_begin.
6218         (Lib_group::include_member): Adjust call to report_object.
6219         (Add_lib_group_symbols::run): Adjust call to report_object.
6220         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6221         blocks.  Add object count for script input files.
6222         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6223         script_info parameter; change all callers.
6224         (Incremental_inputs::report_object): Add script_info parameter;
6225         change all callers.
6226         (Incremental_inputs::report_script): Store backpointer to
6227         incremental info entry.
6228         (Output_section_incremental_inputs::set_final_data_size): Record
6229         additional information for scripts.
6230         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6231         * incremental.h (Incremental_script_entry::add_object): New function.
6232         (Incremental_script_entry::get_object_count): New function.
6233         (Incremental_script_entry::get_object): New function.
6234         (Incremental_script_entry::objects_): New data member; adjust
6235         constructor.
6236         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6237         (Incremental_inputs::report_object): Add script_info parameter.
6238         (Incremental_inputs_reader::get_object_count): New function.
6239         (Incremental_inputs_reader::get_object_offset): New function.
6240         * options.cc (Input_arguments::add_file): Return reference to
6241         new input argument.
6242         * options.h (Input_argument::set_script_info): New function.
6243         (Input_argument::script_info): New function.
6244         (Input_argument::script_info_): New data member; adjust all
6245         constructors.
6246         (Input_file_group::add_file): Return reference to new input argument.
6247         (Input_file_lib::add_file): Likewise.
6248         (Input_arguments::add_file): Likewise.
6249         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6250         * script.cc (Parser_closure::Parser_closure): Add script_info
6251         parameter; adjust all callers.
6252         (Parser_closure::script_info): New function.
6253         (Parser_closure::script_info_): New data member.
6254         (read_input_script): Report scripts earlier to incremental info.
6255         (script_add_file): Set script_info in Input_argument.
6256         (script_add_library): Likewise.
6257         * script.h (Script_options::Script_info): Rewrite class.
6258
6259 2011-03-29  Cary Coutant  <ccoutant@google.com>
6260
6261         * archive.cc (Library_base::should_include_member): Move
6262         method here from class Archive.
6263         (Archive::Archive): Initialize base class.
6264         (Archive::should_include_member): Move to base class.
6265         (Archive::do_for_all_unused_symbols): New function.
6266         (Add_archive_symbols::run): Remove redundant access to
6267         incremental_inputs.
6268         (Lib_group::Lib_group): Initialize base class.
6269         (Lib_group::do_filename): New function.
6270         (Lib_group::include_member): Pass pointer to Lib_group to
6271         report_object.
6272         (Lib_group::do_for_all_unused_symbols): New function.
6273         (Add_lib_group_symbols::run): Report archive information for
6274         incremental links.
6275         * archive.h (class Library_base): New base class.
6276         (class Archive): Derive from Library_base.
6277         (Archive::filename): Move to base class.
6278         (Archive::set_incremental_info): Likewise.
6279         (Archive::incremental_info): Likewise.
6280         (Archive::Should_include): Likewise.
6281         (Archive::should_include_member): Likewise.
6282         (Archive::Armap_entry): Remove.
6283         (Archive::Unused_symbol_iterator): Remove.
6284         (Archive::unused_symbols_begin): Remove.
6285         (Archive::unused_symbols_end): Remove.
6286         (Archive::do_filename): New function.
6287         (Archive::do_get_mtime): New function.
6288         (Archive::do_for_all_unused_symbols): New function.
6289         (Archive::task_): Move to base class.
6290         (Archive::incremental_info_): Likewise.
6291         (class Lib_group): Derive from Library_base.
6292         (Lib_group::do_filename): New function.
6293         (Lib_group::do_get_mtime): New function.
6294         (Lib_group::do_for_all_unused_symbols): New function.
6295         (Lib_group::task_): Move to base class.
6296         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6297         function.
6298         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6299         function.
6300         * incremental.cc (Incremental_inputs::report_archive_begin):
6301         Use Library_base; call library's get_mtime; add incremental inputs
6302         entry before members.
6303         (class Unused_symbol_visitor): New class.
6304         (Incremental_inputs::report_archive_end): Use Library_base; use
6305         visitor class to record unused symbols; don't add incremental inputs
6306         entry after members.
6307         (Incremental_inputs::report_object): Use Library_base.
6308         * incremental.h
6309         (Incremental_archive_entry::Incremental_archive_entry): Remove
6310         unused Archive parameter.
6311         (Incremental_inputs::report_archive_begin): Use Library_base.
6312         (Incremental_inputs::report_archive_end): Likewise.
6313         (Incremental_inputs::report_object): Likewise.
6314         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6315         function.
6316         * object.h (Object::for_all_global_symbols): New function.
6317         (Object::do_for_all_global_symbols): New function.
6318         (Sized_relobj::do_for_all_global_symbols): New function.
6319         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6320         function.
6321         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6322         function.
6323
6324 2011-03-27  Ian Lance Taylor  <iant@google.com>
6325
6326         * archive.cc (Archive::interpret_header): Return -1 if something
6327         goes wrong.  Change callers accordingly.
6328
6329 2011-03-25  Cary Coutant  <ccoutant@google.com>
6330
6331         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6332         * testsuite/Makefile.in: Regenerate.
6333
6334 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6335
6336         * plugin.cc (get_view): New.
6337         (Plugin::load): Pass get_view to the plugin.
6338         (Plugin_manager::get_view): New.
6339
6340 2011-03-21  Ian Lance Taylor  <iant@google.com>
6341
6342         * testsuite/final_layout.sh: Rewrite to not use dc.
6343         * testsuite/relro_test.sh: Fail if dc is not present.
6344
6345 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6346
6347         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6348         Change == to -eq.
6349         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6350         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6351         Change == to -eq.
6352         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6353         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6354
6355 2011-03-14  Ian Lance Taylor  <iant@google.com>
6356
6357         * script-sections.cc (Sort_output_sections::script_compare):
6358         Rename from is_before, change return type.
6359         (Sort_output_sections::operator()): Adjust accordingly.
6360
6361 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6362
6363         PR gold/12572
6364         * testsuite/odr_violation2.cc: Add comment to make all error line
6365         numbers double digits.
6366         * testsuite/debug_msg.sh: Adjust expected errors.
6367
6368 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6369
6370         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6371         but mark earlier ones as non-canonical
6372         (offset_to_iterator): Update search target and example
6373         (do_addr2line): Return extra lines in a vector*
6374         (format_file_lineno): Extract from do_addr2line
6375         (one_addr2line): Add vector* out-param
6376         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6377         when a lineno entry appeared last for its instruction
6378         (Dwarf_line_info): Add vector* out-param
6379         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6380         * symtab.cc (Odr_violation_compare): Include the lineno in the
6381         comparison again.
6382         (linenos_from_loc): New. Combine the canonical line for an
6383         address with its other lines.
6384         (True_if_intersect): New. Helper functor to make
6385         std::set_intersection a query.
6386         (detect_odr_violations): Compare sets of lines instead of just
6387         one line for each function. This became less deterministic, but
6388         has fewer false positives.
6389         * symtab.h: Declarations.
6390         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6391         mix an optimized and non-optimized object in the same binary
6392         (odr_violation2.so): Same.
6393         * testsuite/Makefile.in: Regenerate from Makefile.am.
6394         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6395         * testsuite/debug_msg.sh: Update line numbers and add
6396         assertions.
6397         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6398         non-optimized context.
6399         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6400         isn't inlined, and use OdrDerived in an optimized context.
6401         * testsuite/odr_header1.h: Defines OdrDerived, where
6402         optimization will change the
6403         first-instruction-in-the-destructor's file and line number.
6404         * testsuite/odr_header2.h: Defines OdrBase.
6405
6406 2011-03-09  Ian Lance Taylor  <iant@google.com>
6407
6408         * fileread.cc (File_read::clear_views): Don't delete the whole
6409         file view.
6410
6411 2011-03-08  Ian Lance Taylor  <iant@google.com>
6412
6413         PR gold/12525
6414         * fileread.cc: #include <climits>.
6415         (GOLD_IOV_MAX): Define.
6416         (File_read::read_multiple): Limit number of entries by iov_max.
6417         * fileread.h (class File_read): Always set max_readv_entries to
6418         128.
6419
6420 2011-03-07  Ian Lance Taylor  <iant@google.com>
6421
6422         PR gold/12525
6423         * options.h (class General_options): Add -dy and -dn.
6424
6425 2011-03-02  Cary Coutant  <ccoutant@google.com>
6426
6427         * testsuite/script_test_9.t: Add TLS segment.
6428
6429 2011-03-02  Simon Baldwin  <simonb@google.com>
6430
6431         * configure.ac: Add check for gnu_indirect_function support in
6432         the toolchain building binutils.
6433         * configure: Rebuild.
6434
6435 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6436
6437         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6438         plugin only symbols.
6439         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6440         in plugin files as not needed in the symbol table.
6441
6442 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6443
6444         * output.cc (Output_section::add_input_section): Delay fill
6445         generation for section ordering.
6446
6447 2011-02-09  Ian Lance Taylor  <iant@google.com>
6448
6449         PR gold/12316
6450         * object.h (class Sized_relobj): Remove clear_local_symbols.
6451         * reloc.cc (Sized_relobj::do_relocate): Don't call
6452         clear_local_symbols.
6453
6454 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6455
6456         * plugin.cc (is_visible_from_outside): Return true for symbols
6457         in the -u option.
6458
6459 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6460
6461         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6462         filename.
6463
6464 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6465
6466         * icf.h (is_section_foldable_candidate): Change type of parameter
6467         to std::string.
6468         * icf.cc (Icf::find_identical_sections): Change type of local variable
6469         section_name to be std::string.
6470         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6471
6472 2011-01-25  Ian Lance Taylor  <iant@google.com>
6473
6474         * script.cc (script_add_extern): Rewrite to use
6475         add_symbol_reference.
6476
6477 2011-01-25  Doug Kwan  <dougkwan@google.com>
6478
6479         * icf.cc (get_section_contents): Always lock section's object.
6480
6481 2011-01-24  Ian Lance Taylor  <iant@google.com>
6482
6483         * options.h (class General_options): Accept
6484         --no-detect-odr-violations.
6485
6486 2011-01-24  Ian Lance Taylor  <iant@google.com>
6487
6488         * version.cc (version_string): Bump to 1.11.
6489
6490 2011-01-24  Ian Lance Taylor  <iant@google.com>
6491
6492         * plugin.cc (class Plugin_rescan): Define new class.
6493         (Plugin_manager::claim_file): Set any_claimed_.
6494         (Plugin_manager::save_archive): New function.
6495         (Plugin_manager::save_input_group): New function.
6496         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6497         necessary.
6498         (Plugin_manager::new_undefined_symbol): New function.
6499         (Plugin_manager::rescan): New function.
6500         (Plugin_manager::rescannable_defines): New function.
6501         (Plugin_manager::add_input_file): Set any_added_.
6502         * plugin.h (class Plugin_manager): define new fields rescannable_,
6503         undefined_symbols_, any_claimed_, and any_added_.  Declare
6504         Plugin_rescan as friend.  Declare new functions.
6505         (Plugin_manager::Rescannable): Define type.
6506         (Plugin_manager::Rescannable_list): Define type.
6507         (Plugin_manager::Undefined_symbol_list): Define type.
6508         (Plugin_manager::Plugin_manager): Initialize new fields.
6509         * archive.cc (Archive::defines_symbol): New function.
6510         (Add_archive_symbols::run): Pass archive to plugins if any.
6511         * archive.h (class Archive): Declare defines_symbol.
6512         * readsyms.cc (Input_group::~Input_group): New function.
6513         (Finish_group::run): Pass input_group to plugins if any.
6514         * readsyms.h (class Input_group): Declare destructor.
6515         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6516         any.
6517
6518 2011-01-10  Ian Lance Taylor  <iant@google.com>
6519
6520         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6521         section as relro.
6522         (Layout::set_segment_offsets): Reset increase_relro before calling
6523         set_section_addresses a second time.
6524
6525 2011-01-04  Cary Coutant  <ccoutant@google.com>
6526
6527         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6528         sections before NOBITS sections.
6529
6530 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6531
6532         * version.cc (print_version): Update copyright to 2011.
6533
6534 2010-12-23  Cary Coutant  <ccoutant@google.com>
6535
6536         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6537         of OS to this->add.  Add OD parameter to second form of the function.
6538
6539 2010-12-20  Ian Lance Taylor  <iant@google.com>
6540
6541         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6542         second of two consecutive entries with same offset.
6543
6544 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6545
6546         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6547         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6548         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6549         to avoid unneeded links against $(LDADD).
6550         * testsuite/Makefile.in: Regenerate.
6551
6552 2010-12-15  Ian Lance Taylor  <iant@google.com>
6553
6554         PR gold/12324
6555         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6556         for R_X86_64_32 and R_X86_64_PC32.
6557         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6558         ver_matching_def_pic.o.
6559         (ver_matching_def_pic.o): New target.
6560
6561 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6562
6563         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6564         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6565         Move definition before File_read::View member definitions.
6566         (File_read::View::~View): Initialize and hold lock before
6567         updating current_mapped_bytes.
6568
6569 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6570
6571         * dwarf_reader.cc: Remove outdated comment.
6572         * gold-threads.cc: Fix typo in error message.
6573         * archive.cc: Fix typos in comments.
6574         * archive.h: Likewise.
6575         * arm-reloc-property.cc: Likewise.
6576         * arm-reloc-property.h: Likewise.
6577         * arm-reloc.def: Likewise.
6578         * arm.cc: Likewise.
6579         * attributes.h: Likewise.
6580         * cref.cc: Likewise.
6581         * ehframe.cc: Likewise.
6582         * fileread.h: Likewise.
6583         * gold.h: Likewise.
6584         * i386.cc: Likewise.
6585         * icf.cc: Likewise.
6586         * incremental.h: Likewise.
6587         * int_encoding.cc: Likewise.
6588         * layout.h: Likewise.
6589         * main.cc: Likewise.
6590         * merge.h: Likewise.
6591         * object.cc: Likewise.
6592         * object.h: Likewise.
6593         * options.cc: Likewise.
6594         * readsyms.cc: Likewise.
6595         * reduced_debug_output.cc: Likewise.
6596         * reloc.cc: Likewise.
6597         * script-sections.cc: Likewise.
6598         * sparc.cc: Likewise.
6599         * symtab.h: Likewise.
6600         * target-reloc.h: Likewise.
6601         * target.cc: Likewise.
6602         * target.h: Likewise.
6603         * timer.cc: Likewise.
6604         * timer.h: Likewise.
6605         * x86_64.cc: Likewise.
6606
6607 2010-12-09  Cary Coutant  <ccoutant@google.com>
6608
6609         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6610         stack.
6611         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6612         parameter; change all callers.
6613         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6614         * options.h (warn_execstack): New option.
6615
6616 2010-12-07  Doug Kwan  <dougkwan@google.com>
6617
6618         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6619         like function call relocations.
6620
6621 2010-12-07  Ian Lance Taylor  <iant@google.com>
6622
6623         * archive.cc (Archive::get_elf_object_for_member): Permit
6624         punconfigured to be NULL.
6625         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6626         (Archive::include_member): Pass NULL to get_elf_object_for_member
6627         if we searched for the archive and this is the first included
6628         object.
6629
6630 2010-12-01  Ian Lance Taylor  <iant@google.com>
6631
6632         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6633         track_relocs_type_ field.
6634         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6635         Set track_relocs_type_.
6636         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6637         contents when using RELA relocs.
6638         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6639         reloc_map_.
6640         * reloc.cc (Track_relocs::next_addend): New function.
6641         * reloc.h (class Track_relocs): Declare next_addend.
6642
6643 2010-12-01  Ian Lance Taylor  <iant@google.com>
6644
6645         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6646         virtual destructor.
6647
6648 2010-12-01  Ian Lance Taylor  <iant@google.com>
6649
6650         * README: Update compilers known to work and fail.
6651
6652 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6653
6654         * configure.in: For --enable-gold, handle value `default' instead of
6655         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6656         not the default.
6657         * configure: Regenerate.
6658
6659 2010-11-18  Doug Kwan  <dougkwan@google.com>
6660
6661         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6662         and right_alignment to be zero.  Store result alignment only if it is
6663         greater than existing alignment.
6664
6665 2010-11-16  Cary Coutant  <ccoutant@google.com>
6666
6667         PR gold/12220
6668         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6669         Check for ".zdebug_line".
6670
6671 2010-11-16  Doug Kwan  <dougkwan@google.com>
6672             Cary Coutant  <ccoutant@google.com>
6673
6674         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6675         by reference; adjust all callers.
6676         * output.cc (Output_segment::set_section_addresses): Adjust references
6677         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6678         list is empty.
6679         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6680         end at page boundary.
6681
6682 2010-11-16  Cary Coutant  <ccoutant@google.com>
6683
6684         PR gold/12220
6685         * layout.cc (Layout::choose_output_section): Transform names of
6686         compressed sections even when using a script with a SECTIONS clause.
6687         (Layout::output_section_name): Remove code to transform
6688         compressed debug section names.
6689         * output.cc (Output_section::add_input_section): Use uncompressed
6690         section size when tracking input sections.
6691
6692 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6693
6694         * symtab.h (Symbol::NON_PIC_REF): Remove.
6695         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6696         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6697         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6698         (Symbol::use_plt_offset): Take a flags argument and pass it
6699         directly to needs_dynamic_reloc.  Restrict check for undefined
6700         weak symbols to function calls.
6701         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6702         (Target_arm::Scan::global): Use it.
6703         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6704         (Target_arm::Relocate::relocate): Likewise.
6705         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6706         parameter with an r_type parameter.  Use get_reference_flags
6707         to get the flags.
6708         (Target_arm::Relocate::relocate): Update accordingly.
6709         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6710         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6711         (Target_i386::Scan::global): Likewise.
6712         (Target_i386::Relocate::relocate): Likewise.
6713         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6714         parameter with an r_type parameter.  Use get_reference_flags
6715         to get the flags.
6716         (Target_i386::Relocate::relocate): Update accordingly.
6717         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6718         (Target_powerpc::Scan::global): Use it.
6719         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6720         (Target_powerpc::Relocate::relocate): Likewise.
6721         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6722         (Target_sparc::Scan::global): Use it.
6723         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6724         (Target_sparc::Relocate::relocate): Likewise.
6725         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6726         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6727         (Target_x86_64::Scan::global): Likewise.
6728         (Target_x86_64::Relocate::relocate): Likewise.
6729
6730 2010-11-08  Doug Kwan  <dougkwan@google.com>
6731             Cary Coutant  <ccoutant@google.com>
6732
6733         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6734         (Arm_exidx_merge_section::section_contents_): New data member.
6735         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6736         (Arm_input_section::~Arm_input_section): De-allocate memory.
6737         (Arm_input_section::original_contents_): New data member.
6738         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6739         in parameters instead of calling Object::section_contents without
6740         locking.
6741         (Arm_output_section::group_section): New parameter TASK.  Pass it
6742         to callees that need locking objects.
6743         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6744         to lock EXIDX input sections.  Fix a formatting issue.  Call
6745         Arm_exidx_merged_section::build_contents to create merged section
6746         contents.
6747         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6748         to lock object of stub table owner.
6749         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6750         TEXT_SIZE to initialize data member TEXT_SIZE_.
6751         (Arm_exidx_input_section::addralign): Fix typo in comment.
6752         (Arm_exidx_input_section::text_size): New method.
6753         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6754         that require locking objects.  Lock objects before scanning for stubs
6755         and updating local symbols.
6756         (Arm_input_section<big_endian>::init): Copy contents of original
6757         input section.
6758         (Arm_input_section<big_endian>::do_write): Use saved contents of
6759         original input section instead of calling Object::section_contents
6760         without locking.
6761         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6762         size without calling Object::section_size().
6763         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6764         for size.  Allocate a buffer for merged EXIDX entries.
6765         (Arm_exidx_merged_section::build_contents): New method.
6766         (Arm_exidx_merged_section::do_write): Move merge section contents
6767         building code to Arm_exidx_merged_section::build_contetns.  Write
6768         out contetns in buffer instead of building it on the fly.
6769         (Arm_relobj::make_exidx_input_section): Also pass text section size
6770         to Arm_exidx_input_section constructor.
6771         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6772         (Arm_dynobj::do_read_symbols): Fix memory leak.
6773         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6774         * target.h: (class Task): Add forward declaration.
6775         (Target::relax): Add new parameter TASK and pass it to
6776         Target::do_relax().
6777         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6778
6779 2010-11-05  Cary Coutant  <ccoutant@google.com>
6780
6781         PR gold/10708
6782         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6783         object when reading from the file.
6784         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6785         second layout pass.
6786         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6787         when reading section contents.
6788         (get_section_contents): Likewise.
6789         (icf::find_identical_sections): Likewise.
6790         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6791         object when reading from the file.
6792         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6793         the object when doing deferred section layout.
6794
6795 2010-11-03  Nick Clifton  <nickc@redhat.com>
6796
6797         PR gold/12001
6798         * script.h (class Symbol_assignment: name): New member.  Returns
6799         the name of the symbol.
6800         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6801         Returns true if the given symbol name is on the list of
6802         assignments wating to be processed.
6803         * archive.cc (should_incldue_member): If the symbol is undefined,
6804         check to see if it is on the list of symbols pending assignment.
6805
6806 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6807
6808         * script-sections.cc (Script_sections::find_memory_region): Check
6809         for a NULL output section pointer.
6810
6811 2010-10-29  Doug Kwan  <dougkwan@google.com>
6812
6813         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6814         Output_section::add_relaxed_input_section.
6815         * output.cc (Output_section::add_relaxed_input_section): Add new
6816         arguments LAYOUT and NAME.  Set section order index.
6817         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6818         Copy section order index.
6819         * output.h (Output_section::add_relaxed_input_section): Add new
6820         arguments LAYOUT and NAME.
6821
6822 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6823
6824         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6825         NATIVE_OR_CROSS_LINKER.
6826         * testsuite/Makefile.in: Regenerate.
6827
6828 2010-10-20  Doug Kwan  <dougkwan@google.com>
6829
6830         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6831         without SHF_LINK_ORDER flags.
6832         * layout.cc (Layout::choose_output_section): Do not filter
6833         SHF_LINK_ORDER flag in a relocatable link.
6834
6835 2010-10-17  Cary Coutant  <ccoutant@google.com>
6836
6837         * output.h (Output_segment::set_section_addresses): Change function
6838         signature.  Update all callers.
6839         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6840         sections.
6841         (Output_segment::set_section_addresses): Align after last TLS
6842         section.  Add padding before last relro section instead of after.
6843
6844 2010-10-17  Doug Kwan  <dougkwan@google.com>
6845
6846         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6847         GOT output section to be writable.
6848
6849 2010-10-14  Cary Coutant  <ccoutant@google.com>
6850
6851         * debug.h (DEBUG_INCREMENTAL): New flag.
6852         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6853         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6854         mode.
6855         * incremental.cc (report_command_line): Ignore all forms of
6856         --incremental.
6857         * layout.cc (Layout::Layout): Check parameters for incremental link
6858         mode.
6859         * options.cc (General_options::parse_incremental): New function.
6860         (General_options::parse_no_incremental): New function.
6861         (General_options::parse_incremental_full): New function.
6862         (General_options::parse_incremental_update): New function.
6863         (General_options::incremental_mode_): New data member.
6864         (General_options::finalize): Check incremental_mode_.
6865         * options.h (General_options): Update help text for --incremental.
6866         Add --no-incremental, --incremental-full, --incremental-update.
6867         (General_options::Incremental_mode): New enum type.
6868         (General_options::incremental_mode): New function.
6869         (General_options::incremental_mode_): New data member.
6870         * parameters.cc (Parameters::incremental_mode_): New data member.
6871         (Parameters::set_options): Set incremental_mode_.
6872         (Parameters::set_incremental_full): New function.
6873         (Parameters::incremental): New function.
6874         (Parameters::incremental_update): New function.
6875         (set_parameters_incremental_full): New function.
6876         * parameters.h (Parameters::set_incremental_full): New function.
6877         (Parameters::incremental): New function.
6878         (Parameters::incremental_update): New function.
6879         (Parameters::incremental_mode_): New data member.
6880         (set_parameters_incremental_full): New function.
6881         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6882         incremental link mode.
6883         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6884         (Sized_relobj::do_relocate_sections): Likewise.
6885         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6886         option.
6887         * testsuite/Makefile.in: Regenerate.
6888         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6889
6890 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6891
6892         * script-sections.h (class Script_sections): Make
6893         Sections_elements typedef public.
6894         * script-sections.cc (class Sort_output_sections): Add elements_
6895         field.  Add constructor which sets it; change all callers.
6896         (Sort_output_sections::is_before): New function.
6897         (Sort_output_sections::operator()): Call is_before.
6898         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6899         conditional.
6900         * testsuite/script_test_10.sh: New test. Test script section
6901         order.
6902         * testsuite/script_test_10.t: Likewise.
6903         * testsuite/script_test_10.s: Likewise.
6904         * testsuite/Makefile.am: Wrap the cross linker tests and the
6905         common tests into NATIVE_OR_CROSS_LINKER.
6906         (check_SCRIPTS): Add script_test_10.sh.
6907         (check_DATA): Add script_test_10.stdout.
6908         (script_test_10.o, script_test_10): New targets.
6909         (script_test_10.stdout): New target.
6910         * configure, testsuite/Makefile.in: Regenerate.
6911
6912 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6913
6914         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6915         error for the deprecated relocations.
6916         (Target_arm::Scan::global): Likewise.
6917         (Target_arm::Relocate::relocate): Likewise.
6918
6919 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6920
6921         * fileread.cc (Input_file::find_file): Initialize *found_name
6922         and *namep when using the fallback search for case 4.
6923
6924 2010-10-11  Cary Coutant  <ccoutant@google.com>
6925
6926         * options.h (class General_options): Redefine -z lazy as an alias for
6927         the negation of -z now.
6928
6929 2010-10-11  Ian Lance Taylor  <iant@google.com>
6930
6931         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6932         binding.
6933
6934 2010-10-06  Nick Clifton  <nickc@redhat.com>
6935
6936         * script-sections.cc(class Memory_region): Remove
6937         current_lma_offset_ field.  Rename current_vma_offset_ to
6938         current_offset_.  Add last_section_ field.
6939         (Memory_region::get_current_vma_address): Rename to
6940         get_current_address.
6941         (Memory_region::get_current_lma_address): Delete.
6942         (Memory_region::increment_vma_offset): Rename to
6943         increment_offset.
6944         (Memory_region::increment_lma_offset): Delete.
6945         (Memory_region::attributes_compatible): New method.  Returns
6946         true if the provided section is compatible with the region.
6947         (Memory_region::get_last_section): New method.  Returns the last
6948         section to use the region.
6949         (Memory_region::set_last_section): New method.  Stores the last
6950         section to use the region.
6951         (Script_sections::block_in_region): New method.  Returns true if
6952         a block of memory is contained within a region.
6953         (Script_sections::find_memory_region): New method.  Locates a
6954         memory region to be used to set a VMA or LMA address.
6955         (Output_section_definition::set_section_addresses): Add code to
6956         check for addresses set by memory regions.
6957         (Output_segment::set_section_addresses): Remove memory region
6958         walking code.
6959         (Script_sections::create_segment): Add a warning if a header
6960         segment is created outside of any region.
6961         * script-sections.h (class Script_sections): Add prototypes for
6962         find_memory_region and block_in_region methods.
6963         * testsuite/memory_test.s: Use .long instead of .word.
6964         * testsuite/memory_test.t: Add some more output sections.
6965         * testsuite/memory_test.sh: Update expected output.
6966
6967 2010-10-02  Doug Kwan  <dougkwan@google.com>
6968
6969         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6970         defintion to symtab.h
6971         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6972         declaration to defintion.
6973
6974 2010-10-01  Nick Clifton  <nickc@redhat.com>
6975
6976         * expression.cc (eval): Replace dummy argument with NULL.
6977         (eval_maybe_dot): Check for a NULL result section pointer.
6978         (Symbol_expression::value): Likewise.
6979         (Dot_expression::value): Likewise.
6980         (BINARY_EXPRESSION): Likewise.
6981         (Max_expression::value): Likewise.
6982         (Min_expression::value): Likewise.
6983         (Absolute_expression::value): Likewise.
6984         (Addr_expression::value_from_output_section): Likewise.
6985         (Loaddddr_expression::value_from_output_section): Likewise.
6986         (Segment_start_expression::value): Likewise.
6987         * script-sections.cc
6988         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6989         argument with NULL.
6990         (Sections_elememt_dot_assignment::set_section_addresses):
6991         Likewise.
6992         (Output_data_expression::do_write_to_buffer): Likewise.
6993         (Output_section_definition::finalize_symbols): Likewise.
6994         (Output_section_definition::set_section_addresses): Likewise.
6995
6996 2010-09-30  Doug Kwan  <dougkwan@google.com>
6997
6998         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6999
7000 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7001
7002         * target.h (Target::can_icf_inline_merge_sections): New virtual
7003         function.
7004         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7005         virtual function.
7006         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7007         virtual function.
7008         * icf.cc (get_section_contents): Inline merge sections only when
7009         target allows it.
7010
7011 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7012
7013         * configure: Regenerate.
7014
7015 2010-09-17  Ian Lance Taylor  <iant@google.com>
7016
7017         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7018         * testsuite/Makefile.am (memory_test.o): New target.
7019         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7020         memory_test.t.
7021         * testsuite/Makefile.in: Rebuild.
7022
7023 2010-09-17  Doug Kwan  <dougkwan@google.com>
7024
7025         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7026         defintion if relocation uses GOT entries of the symbol.
7027         * testsuite/icf_safe_test.sh: Fix test.
7028         * testsuite/icf_safe_so_test.sh: Fix test.
7029
7030 2010-09-16  Cary Coutant  <ccoutant@google.com>
7031
7032         * script_sections.cc (class Memory_region): Remove "NULL" from
7033         vector initializations.
7034
7035 2010-09-15  Cary Coutant  <ccoutant@google.com>
7036
7037         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7038         Resolve forwarding symbols.
7039
7040 2010-09-15  Doug Kwan  <dougkwan@google.com>
7041
7042         * gold/testsuite/script_test_3.t: Add ARM special sections.
7043         * gold/testsuite/script_test_4.t: Same.
7044         * gold/testsuite/script_test_5.t: Same.
7045         * gold/testsuite/script_test_6.t: Same.
7046         * gold/testsuite/script_test_7.t: Same.
7047         * gold/testsuite/script_test_7.t: Same.
7048         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7049
7050 2010-09-14  Cary Coutant  <ccoutant@google.com>
7051
7052         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7053         (Target_x86_64::Relocate::relocate_tls): Replace check for
7054         saw_tls_block_reloc_ with test for executable section.
7055
7056 2010-09-12  Cary Coutant  <ccoutant@google.com>
7057
7058         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7059         position-independent executables to shared libraries need dynamic
7060         relocations.
7061         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7062         position-independent executables.
7063         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7064         * testsuite/Makefile.in: Regenerate.
7065
7066 2010-09-10  Nick Clifton  <nickc@redhat.com>
7067
7068         PR gold/11997
7069         * testsuite/memory_test.t: Discard any sections that are not
7070         needed.
7071
7072 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7073
7074         PR gold/11996
7075         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7076         "This::" to work around a bug in gcc 4.2.
7077
7078         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7079
7080 2010-09-09  Rafael Espindola  <espindola@google.com>
7081
7082         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7083         sections with different PF_X flags in the same segment.
7084         (Layout::find_first_load_seg): Search all segments to find the first
7085         one.
7086         * options.h (rosegment): New.
7087
7088 2010-09-08  Rafael Espindola  <espindola@google.com>
7089
7090         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7091
7092 2010-09-08  Doug Kwan  <dougkwan@google.com>
7093
7094         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7095         (Arm_relobj::do_relocate_sections): Add new parameter for output
7096         file to match the parent.
7097         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7098         of local symbols instead of input values.  Update code to track
7099         changes in gold::relocate_section.
7100         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7101         (Sized_relobj::compute_final_local_value_internal): New methods.
7102         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7103         body into private version of Sized_relobj::compute_final_local_value.
7104         Call the inline method.
7105         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7106         merged symbol value if there is one.
7107         (Symbol_value::has_output_value): New method defintiion.
7108         (Sized_relobj::Compute_final_local_value_status): New enum type.
7109         (Sized_relobj::compute_final_local_value): New methods.
7110         (Sized_relobj::compute_final_local_value_internal): New methods.
7111         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7112         and arm_cortex_a8.sh.
7113         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7114         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7115         New tests.
7116         * Makefile.in: Regenerate.
7117         * testsuite/arm_bl_out_of_range.s: Update test.
7118         * testsuite/thumb_bl_out_of_range.s: Ditto.
7119         * testsuite/thumb_blx_out_of_range.s: Ditto.
7120         * testsuite/arm_branch_out_of_range.sh: New file.
7121         * testsuite/arm_cortex_a8.sh: Ditto.
7122         * testsuite/arm_cortex_a8_b.s: Ditto.
7123         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7124         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7125         * testsuite/arm_cortex_a8_bl.s: Ditto.
7126         * testsuite/arm_cortex_a8_blx.s: Ditto.
7127         * testsuite/arm_cortex_a8_local.s: Ditto.
7128         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7129         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7130
7131 2010-09-08  Rafael Espindola  <espindola@google.com>
7132
7133         * Makefile.am (memory_test.stdout): Run readelf with -W.
7134         * Makefile.in: Regenerate.
7135         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7136         64 bit output.
7137
7138 2010-09-08  Rafael Espindola  <espindola@google.com>
7139
7140         * script-sections.cc (Script_sections::add_memory_region): Convert
7141         field precision to int.
7142         * script.cc (script_set_section_region, script_set_section_region):
7143         Convert field precision to int.
7144
7145 2010-09-08  Rafael Espindola  <espindola@google.com>
7146
7147         * arm.cc (do_finalize_sections): Create the __exidx_start and
7148         __exdix_end symbols even when the section is missing.
7149
7150 2010-09-08  Nick Clifton  <nickc@redhat.com>
7151
7152         * README: Remove claim that MEMORY is not supported.
7153         * expression.cc (script_exp_function_origin)
7154         (script_exp_function_length): Move from here to ...
7155         * script.cc: ... here.
7156         (script_set_section_region, script_add_memory)
7157         (script_parse_memory_attr, script_include_directive): New
7158         functions.
7159         * script-sections.cc
7160         (class Memory_region): New class.
7161         (class Output_section_definition): Add set_memory_region,
7162         set_section_vma, set_section_lma and get_section_name methods.
7163         (class Script_Sections): Add add_memory_region,
7164         find_memory_region, find_memory_region_origin,
7165         find_memory_region_length and set_memory_region methods.
7166         Have set_section_addresses method walk the list of set memory
7167         regions.
7168         Extend the print methos to display memory regions.
7169         * script-sections.h: Add prototypes for new methods.
7170         Add enum for MEMORY region attributes.
7171         * yyscript.y: Add support for parsing MEMORY regions.
7172         * script-c.h: Add prototypes for new functions.
7173         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7174         * testsuite/Makefile.in: Regenerate.
7175         * testsuite/memory_test.sh: New script.
7176         * testsuite/memory_test.s: New assembler source file.
7177         * testsuite/memory_test.t: New linker script.
7178
7179 2010-08-27  Doug Kwan  <dougkwan@google.com>
7180
7181         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7182         reference override an existing dynamic weak reference.
7183         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7184         * testsuite/Makefile.in: Regenerate.
7185         * testsuite/dyn_weak_ref.sh: New file.
7186         * testsuite/dyn_weak_ref_1.c: Ditto.
7187         * testsuite/dyn_weak_ref_2.c: Ditto.
7188
7189 2010-08-27  Ian Lance Taylor  <iant@google.com>
7190
7191         * incremental.h (class Incremental_input_entry): Add virtual
7192         destructor.
7193
7194 2010-08-27  Ian Lance Taylor  <iant@google.com>
7195
7196         * testsuite/start_lib_test_3.c: Mark t3 as used.
7197
7198 2010-08-27  Nick Clifton  <nickc@redhat.com>
7199
7200         * options.cc (version_script): Fix small typo in previous
7201         whitespace tidyup.
7202
7203 2010-08-25  Nick Clifton  <nickc@redhat.com>
7204
7205         * archive.cc: Formatting fixes: Remove whitespace between
7206         typename and following asterisk.  Remove whitespace between
7207         function name and opening parenthesis.
7208         * archive.h: Likewise.
7209         * arm.cc: Likewise.
7210         * attributes.cc: Likewise.
7211         * attributes.h: Likewise.
7212         * common.cc: Likewise.
7213         * copy-relocs.cc: Likewise.
7214         * dirsearch.h: Likewise.
7215         * dynobj.cc: Likewise.
7216         * ehframe.cc: Likewise.
7217         * ehframe.h: Likewise.
7218         * expression.cc: Likewise.
7219         * fileread.cc: Likewise.
7220         * fileread.h: Likewise.
7221         * gc.h: Likewise.
7222         * gold-threads.cc: Likewise.
7223         * gold.cc: Likewise.
7224         * i386.cc: Likewise.
7225         * icf.h: Likewise.
7226         * incremental-dump.cc: Likewise.
7227         * incremental.cc: Likewise.
7228         * layout.cc: Likewise.
7229         * layout.h: Likewise.
7230         * main.cc: Likewise.
7231         * merge.cc: Likewise.
7232         * merge.h: Likewise.
7233         * object.cc: Likewise.
7234         * object.h: Likewise.
7235         * options.cc: Likewise.
7236         * options.h: Likewise.
7237         * output.cc: Likewise.
7238         * output.h: Likewise.
7239         * plugin.cc: Likewise.
7240         * plugin.h: Likewise.
7241         * powerpc.cc: Likewise.
7242         * reloc.cc: Likewise.
7243         * script-c.h: Likewise.
7244         * script-sections.cc: Likewise.
7245         * script.cc: Likewise.
7246         * stringpool.cc: Likewise.
7247         * symtab.cc: Likewise.
7248         * symtab.h: Likewise.
7249         * target.cc: Likewise.
7250         * timer.cc: Likewise.
7251         * timer.h: Likewise.
7252         * version.cc: Likewise.
7253         * x86_64.cc: Likewise.
7254
7255 2010-08-24  Nick Clifton  <nickc@redhat.com>
7256
7257         PR 11899
7258         * layout.cc (segment_precedes): Sort segments by their physical
7259         addresses, if they have been set.
7260
7261 2010-08-23  Cary Coutant  <ccoutant@google.com>
7262
7263         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7264         symbols data.
7265         (Lib_group::include_member): Unlock object after deleting its
7266         symbols data.
7267         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7268         the bug fixed here.
7269
7270 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7271             Cary Coutant  <ccoutant@google.com>
7272
7273         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7274         constructor, and set_blocker.
7275         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7276         readsyms_blocker_.
7277         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7278         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7279         * testsuite/Makefile.am (start_lib_test): New test case.
7280         * testsuite/Makefile.in: Regenerate.
7281         * testsuite/start_lib_test_main.c: New file.
7282         * testsuite/start_lib_test_1.c: New file.
7283         * testsuite/start_lib_test_2.c: New file.
7284         * testsuite/start_lib_test_3.c: New file.
7285
7286 2010-08-19  Ian Lance Taylor  <iant@google.com>
7287
7288         * Makefile.in: Rebuild with automake 1.11.1.
7289         * aclocal.m4: Likewise.
7290         * testsuite/Makefile.in: Likewise.
7291
7292 2010-08-19  Ian Lance Taylor  <iant@google.com>
7293
7294         PR 10893
7295         * i386.cc (class Output_data_plt_i386): Update declarations.
7296         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7297         local_ifuncs_ fields.
7298         (Target_i386::do_plt_section_for_global): New function.
7299         (Target_i386::do_plt_section_for_local): New function.
7300         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7301         parameter; change all callers.  Initialize global_ifuncs_ and
7302         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7303         __rel_iplt_end.
7304         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7305         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7306         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7307         symbols.
7308         (Target_i386::make_plt_section): New function, broken out of
7309         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7310         (Target_i386::make_plt_entry): Call make_plt_section.
7311         (Target_i386::make_local_ifunc_plt_entry): New function.
7312         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7313         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7314         R_386_IRELATIVE to switch.
7315         (Target_i386::Scan::global): Likewise.
7316         (Target_i386::Relocate::relocate): Likewise.
7317         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7318         switch.
7319         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7320         (Target_x86_64::do_plt_section_for_global): New function.
7321         (Target_x86_64::do_plt_section_for_local): New function.
7322         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7323         parameter; change all callers.  If doing a static link define
7324         __rela_iplt_start and __rela_iplt_end.
7325         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7326         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7327         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7328         to point to .plt.
7329         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7330         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7331         switch.
7332         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7333         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7334         R_X86_64_IRELATIVE to switch.
7335         (Target_x86_64::Scan::global): Likewise.
7336         (Target_x86_64::Relocate::relocate): Likewise.
7337         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7338         switch.
7339         * target.h (class Target): Add plt_section_for_global and
7340         plt_section_for_local functions.  Add do_plt_section_for_global
7341         and do_plt_section_for_local virtual functions.
7342         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7343         clarifying comments.
7344         (Symbol::use_plt_offset): Handle IFUNC symbol.
7345         * object.cc (Sized_relobj::Sized_relobj): Initialize
7346         local_plt_offsets_.
7347         (Sized_relobj::local_has_plt_offset): New function.
7348         (Sized_relobj::local_plt_offset): New function.
7349         (Sized_relobj::set_local_plt_offset): New function.
7350         (Sized_relobj::do_count): Handle IFUNC symbol.
7351         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7352         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7353         is_ifunc_symbol functions.
7354         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7355         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7356         local_plt_offsets_ field.
7357         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7358         * output.h (class Output_section_data): Add non-const
7359         output_section function.
7360         (class Output_data_got): Update declarations.
7361         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7362         Add use_plt_offset parameter to global and local constructors.
7363         Change all callers.  Change local_sym_index_ field to 31 bits.
7364         Change GSYM_CODE and CONSTANT_CODE accordingly.
7365         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7366         doing a static link don't set sh_link field.
7367         (Output_data_got::Got_entry::write): Use PLT offset if
7368         appropriate.
7369         (Output_data_got::add_global_plt): New function.
7370         (Output_data_got::add_local_plt): New function.
7371         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7372         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7373         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7374         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7375         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7376         IFUNC conditional.
7377         * testsuite/ifunc-sel.h: New file.
7378         * testsuite/ifuncmain1.c: New file.
7379         * testsuite/ifuncmain1vis.c: New file.
7380         * testsuite/ifuncmod1.c: New file.
7381         * testsuite/ifuncdep2.c: New file.
7382         * testsuite/ifuncmain2.c: New file.
7383         * testsuite/ifuncmain3.c: New file.
7384         * testsuite/ifuncmod3.c: New file.
7385         * testsuite/ifuncmain4.c: New file.
7386         * testsuite/ifuncmain5.c: New file.
7387         * testsuite/ifuncmod5.c: New file.
7388         * testsuite/ifuncmain6pie.c: New file.
7389         * testsuite/ifuncmod6.c: New file.
7390         * testsuite/ifuncmain7.c: New file.
7391         * configure, testsuite/Makefile.in: Rebuild.
7392
7393 2010-08-18  Ian Lance Taylor  <iant@google.com>
7394
7395         * incremental.cc
7396         (Output_section_incremental_inputs::write_input_files): Add cast
7397         to avoid signed/unsigned comparison warning.
7398         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7399
7400 2010-08-12  Cary Coutant  <ccoutant@google.com>
7401
7402         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7403
7404 2010-08-13  Ian Lance Taylor  <iant@google.com>
7405
7406         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7407
7408 2010-08-12  Cary Coutant  <ccoutant@google.com>
7409             Doug Kwan  <dougkwan@google.com>
7410
7411         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7412         defintion overrides non-weak undef, remember that the original undef
7413         is not weak.
7414         * symtab.cc (Symbol_table::sized_write_global): For undef without
7415         an original weak binding, set binding to global in output.
7416         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7417         * testsuite/Makefile.in: Regenerate.
7418         * testsuite/strong_ref_weak_def.sh: New file.
7419         * testsuite/strong_ref_weak_def_1.c: Ditto.
7420         * testsuite/strong_ref_weak_def_2.c: Ditto.
7421
7422 2010-08-12  Cary Coutant  <ccoutant@google.com>
7423
7424         * testsuite/incremental_test.sh: Rewrite.
7425         * testsuite/incremental_test_1.c: Rewrite.
7426         * testsuite/incremental_test_2.c: Rewrite.
7427
7428 2010-08-12  Cary Coutant  <ccoutant@google.com>
7429
7430         * arm.cc (Target_arm::got_size): Add const.
7431         (Target_arm::got_entry_count): New function.
7432         (Target_arm::plt_entry_count): New function.
7433         (Target_arm::first_plt_entry_offset): New function.
7434         (Target_arm::plt_entry_size): New function.
7435         (Output_data_plt_arm::entry_count): New function.
7436         (Output_data_plt_arm::first_plt_entry_offset): New function.
7437         (Output_data_plt_arm::get_plt_entry_size): New function.
7438         * i386.cc (Target_i386::got_size): Add const.
7439         (Target_i386::got_entry_count): New function.
7440         (Target_i386::plt_entry_count): New function.
7441         (Target_i386::first_plt_entry_offset): New function.
7442         (Target_i386::plt_entry_size): New function.
7443         (Output_data_plt_i386::entry_count): New function.
7444         (Output_data_plt_i386::first_plt_entry_offset): New function.
7445         (Output_data_plt_i386::get_plt_entry_size): New function.
7446         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7447         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7448         * incremental.cc: Include target.h.
7449         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7450         parameter.  Adjust all callers.  Find incremental_got_plt section.
7451         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7452         section.
7453         (Output_section_incremental_inputs::set_final_data_size): Calculate
7454         size of incremental_got_plt section.
7455         (Output_section_incremental_inputs::do_write): Write the
7456         incremental_got_plt section.
7457         (Got_plt_view_info): New struct.
7458         (Local_got_offset_visitor): New class.
7459         (Global_got_offset_visitor): New class.
7460         (Global_symbol_visitor_got_plt): New class.
7461         (Output_section_incremental_inputs::write_got_plt): New function.
7462         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7463         Add parameter.  Adjust all callers.
7464         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7465         (Incremental_inputs::got_plt_section): New function.
7466         (Incremental_inputs::got_plt_section_): New data member.
7467         (Incremental_got_plt_reader): New class.
7468         * layout.cc (Layout::create_incremental_info_sections): Add the
7469         incremental_got_plt section.
7470         * object.h (Got_offset_list::get_list): New function.
7471         (Got offset_list::for_all_got_offsets): New function.
7472         (Sized_relobj::local_got_offset_list): New function.
7473         * powerpc.cc (Target_powerpc::got_size): Add const.
7474         (Target_powerpc::got_entry_count): New function.
7475         (Target_powerpc::plt_entry_count): New function.
7476         (Target_powerpc::first_plt_entry_offset): New function.
7477         (Target_powerpc::plt_entry_size): New function.
7478         (Output_data_plt_powerpc::entry_count): New function.
7479         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7480         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7481         * sparc.cc (Target_sparc::got_size): Add const.
7482         (Target_sparc::got_entry_count): New function.
7483         (Target_sparc::plt_entry_count): New function.
7484         (Target_sparc::first_plt_entry_offset): New function.
7485         (Target_sparc::plt_entry_size): New function.
7486         (Output_data_plt_sparc::entry_count): New function.
7487         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7488         (Output_data_plt_sparc::get_plt_entry_size): New function.
7489         * symtab.h (Symbol::got_offset_list): New function.
7490         (Symbol_table::for_all_symbols): New function.
7491         * target.h (Sized_target::got_entry_count): New function.
7492         (Sized_target::plt_entry_count): New function.
7493         (Sized_target::plt_entry_size): New function.
7494         * x86_64.cc (Target_x86_64::got_size): Add const.
7495         (Target_x86_64::got_entry_count): New function.
7496         (Target_x86_64::plt_entry_count): New function.
7497         (Target_x86_64::first_plt_entry_offset): New function.
7498         (Target_x86_64::plt_entry_size): New function.
7499         (Output_data_plt_x86_64::entry_count): New function.
7500         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7501         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7502
7503 2010-08-12  Cary Coutant  <ccoutant@google.com>
7504
7505         * archive.cc: Include incremental.h.
7506         (Archive::Archive): Initialize incremental_info_.
7507         (Archive::include_member): Record archive members in incremental info.
7508         (Add_archive_symbols::run): Record begin and end of an archive in
7509         incremental info.
7510         (Lib_group::include_member): Record objects in incremental info.
7511         * archive.h (Incremental_archive_entry): Forward declaration.
7512         (Archive::set_incremental_info): New member function.
7513         (Archive::incremental_info): New member function.
7514         (Archive::Unused_symbol_iterator): New class.
7515         (Archive::unused_symbols_begin): New member function.
7516         (Archive::unused_symbols_end): New member function.
7517         (Archive::incremental_info_): New data member.
7518         * incremental-dump.cc (find_input_containing_global): New function.
7519         (dump_incremental_inputs): Dump new incremental info sections.
7520         * incremental.cc: Include symtab.h.
7521         (Output_section_incremental_inputs): New class.
7522         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7523         new incremental info sections.
7524         (Sized_incremental_binary::do_check_inputs): Likewise.
7525         (Incremental_inputs::report_archive): Remove.
7526         (Incremental_inputs::report_archive_begin): New function.
7527         (Incremental_inputs::report_archive_end): New function.
7528         (Incremental_inputs::report_object): New function.
7529         (Incremental_inputs::finalize_inputs): Remove.
7530         (Incremental_inputs::report_input_section): New function.
7531         (Incremental_inputs::report_script): Rewrite.
7532         (Incremental_inputs::finalize): Do nothing but finalize string table.
7533         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7534         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7535         (Incremental_inputs::create_data_sections): New function.
7536         (Incremental_inputs::relocs_entsize): New function.
7537         (Output_section_incremental_inputs::set_final_data_size): New function.
7538         (Output_section_incremental_inputs::do_write): New function.
7539         (Output_section_incremental_inputs::write_header): New function.
7540         (Output_section_incremental_inputs::write_input_files): New function.
7541         (Output_section_incremental_inputs::write_info_blocks): New function.
7542         (Output_section_incremental_inputs::write_symtab): New function.
7543         * incremental.h (Incremental_script_entry): Forward declaration.
7544         (Incremental_object_entry): Forward declaration.
7545         (Incremental_archive_entry): Forward declaration.
7546         (Incremental_inputs): Forward declaration.
7547         (Incremental_inputs_header_data): Remove.
7548         (Incremental_inputs_header): Remove.
7549         (Incremental_inputs_header_write): Remove.
7550         (Incremental_inputs_entry_data): Remove.
7551         (Incremental_inputs_entry): Remove.
7552         (Incremental_inputs_entry_write): Remove.
7553         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7554         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7555         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7556         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7557         Likewise.
7558         (Incremental_input_entry): New class.
7559         (Incremental_script_entry): New class.
7560         (Incremental_object_entry): New class.
7561         (Incremental_archive_entry): New class.
7562         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7563         (Incremental_inputs::report_inputs): Remove.
7564         (Incremental_inputs::report_archive): Remove.
7565         (Incremental_inputs::report_archive_begin): New function.
7566         (Incremental_inputs::report_archive_end): New function.
7567         (Incremental_inputs::report_object): Change prototype.
7568         (Incremental_inputs::report_input_section): New function.
7569         (Incremental_inputs::report_script): Change prototype.
7570         (Incremental_inputs::get_reloc_count): New function.
7571         (Incremental_inputs::set_reloc_count): New function.
7572         (Incremental_inputs::create_data_sections): New function.
7573         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7574         (Incremental_inputs::inputs_section): New function.
7575         (Incremental_inputs::symtab_section): New function.
7576         (Incremental_inputs::relocs_section): New function.
7577         (Incremental_inputs::get_stringpool): Add const.
7578         (Incremental_inputs::command_line): Add const.
7579         (Incremental_inputs::inputs): Remove.
7580         (Incremental_inputs::command_line_key): New function.
7581         (Incremental_inputs::input_file_count): New function.
7582         (Incremental_inputs::input_files): New function.
7583         (Incremental_inputs::relocs_entsize): New function.
7584         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7585         (Incremental_inputs::finalize_inputs): Remove.
7586         (Incremental_inputs::Input_info): Remove.
7587         (Incremental_inputs::lock_): Remove.
7588         (Incremental_inputs::inputs_): Change type.
7589         (Incremental_inputs::inputs_map_): Remove.
7590         (Incremental_inputs::current_object_entry_): New data member.
7591         (Incremental_inputs::inputs_section_): New data member.
7592         (Incremental_inputs::symtab_section_): New data member.
7593         (Incremental_inputs::relocs_section_): New data member.
7594         (Incremental_inputs::reloc_count_): New data member.
7595         (Incremental_inputs_reader): New class.
7596         (Incremental_symtab_reader): New class.
7597         (Incremental_relocs_reader): New class.
7598         * layout.cc (Layout::finalize): Move finalization of incremental info
7599         and creation of incremental info sections to follow finalization of
7600         symbol table.  Set offsets for postprocessing sections.
7601         (Layout::create_incremental_info_sections): Call
7602         Incremental_inputs::create_data_sections.  Add incremental symtab
7603         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7604         sections to layout after input sections.
7605         * layout.h (struct Timespec): Forward declaration.
7606         (Layout::incremental_inputs): Add const.
7607         (Layout::create_incremental_info_sections): Add parameter.
7608         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7609         * object.cc: Include incremental.h.
7610         (Relobj::finalize_incremental_relocs): New function.
7611         (Sized_relobj::do_layout): Record input sections in incremental info.
7612         * object.h (Object::output_section): New function.
7613         (Object::output_section_offset): Moved from Relobj.
7614         (Object::get_incremental_reloc_base): New function.
7615         (Object::get_incremental_reloc_count): New function.
7616         (Object::do_output_section): New function.
7617         (Object::do_output_section_offset): Moved from Relobj.
7618         (Object::do_get_incremental_reloc_base): New function.
7619         (Object::do_get_incremental_reloc_count): New function.
7620         (Object::Object): Initialize new data members.
7621         (Relobj::output_section): Renamed do_output_section and moved to
7622         protected.
7623         (Relobj::output_section_offset): Moved to Object.
7624         (Relobj::do_get_incremental_reloc_base): New function.
7625         (Relobj::do_get_incremental_reloc_count): New function.
7626         (Relobj::allocate_incremental_reloc_counts): New function.
7627         (Relobj::count_incremental_reloc): New function.
7628         (Relobj::finalize_incremental_relocs): New function.
7629         (Relobj::next_incremental_reloc_index): New function.
7630         (Relobj::reloc_counts_): New data member.
7631         (Relobj::reloc_bases_): New data member.
7632         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7633         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7634         (Sized_relobj::incremental_relocs_scan): New function.
7635         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7636         (Sized_relobj::incremental_relocs_write): New function.
7637         (Sized_relobj::incremental_relocs_write_reltype): New function.
7638         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7639         incremental link.
7640         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7641         archives and object files elsewhere.
7642         (Add_symbols::run): Report object files here.
7643         (Finish_group::run): Report end of archive at end of group.
7644         * reloc.cc: Include layout.h, incremental.h.
7645         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7646         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7647         (Sized_relobj::incremental_relocs_scan): New function.
7648         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7649         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7650         (Sized_relobj::incremental_relocs_write): New function.
7651         (Sized_relobj::incremental_relocs_write_reltype): New function.
7652         * script.cc (read_input_script): Rewrite test for incremental link.
7653         Change call to Incremental_inputs::report_script.
7654         * symtab.h (Symbol_table::first_global_index): New function.
7655         (Symbol_table::output_count): New function.
7656
7657 2010-08-12  Doug Kwan  <dougkwan@google.com>
7658
7659         * arm.cc (Target_arm::merge_object_attributes): Check command line
7660         options --no-wchar-size-warning and --no-enum-size-warning.
7661         * options.h (General_options): Add ld-compatible options
7662         --no-enum-size-warning and --no-wchar-size-warning.
7663
7664 2010-08-04  Ian Lance Taylor  <iant@google.com>
7665
7666         * x86_64.cc (Target_x86_64::Scan::local): Use
7667         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7668         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7669         (Target_x86_64::Scan::global): Likewise.
7670         (Target_x86_64::Relocate::relocate): Likewise.
7671         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7672         Likewise.
7673
7674 2010-08-03  Cary Coutant  <ccoutant@google.com>
7675
7676         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7677         to reserve space in merged_strings vector. Keep total input size
7678         for stats.
7679         (Output_merge_string::do_print_merge_stats): Print total input size.
7680         * merge.h (Output_merge_string): Add input_size_ field.
7681         * stringpool.cc (Stringpool_template::string_length): Move
7682         implementations out of Stringpool_template class and place in
7683         stringpool.h.
7684         * stringpool.h (string_length): Move out of Stringpool_template.
7685
7686 2010-08-03  Ian Lance Taylor  <iant@google.com>
7687
7688         PR 11712
7689         * layout.cc (relaxation_loop_body): If address of load segment is
7690         set, adjust address to include headers if possible.
7691
7692 2010-08-03  Ian Lance Taylor  <iant@google.com>
7693
7694         * version.cc (version_string): Bump to 1.10.
7695
7696 2010-08-03  Ian Lance Taylor  <iant@google.com>
7697
7698         PR 11805
7699         * layout.h (enum Output_section_order): Define.
7700         (class Layout): Update declarations.
7701         * layout.cc (Layout::get_output_section): Add order parameter.
7702         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7703         is_first_non_relro parameters.  Change all callers.
7704         (Layout::choose_output_section): Likewise.
7705         (Layout::add_output_section_data): Likewise.
7706         (Layout::make_output_section): Likewise.  Set order.
7707         (Layout::default_section_order): New function.
7708         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7709         * output.cc (Output_section::Output_section): Initialize order_.
7710         Don't initialize deleted fields.
7711         (Output_segment::Output_segment): Don't initialize deleted
7712         fields.
7713         (Output_segment::add_output_section_to_load): New function
7714         replacing add_output_section.  Change all callers to call this or
7715         add_output_section_to_nonload.
7716         (Output_segment::add_output_section_to_nonload): New function.
7717         (Output_segment::remove_output_section): Rewrite.
7718         (Output_segment::add_initial_output_data): Likewise.
7719         (Output_segment::has_any_data_sections): Likewise.
7720         (Output_segment::is_first_section_relro): Likewise.
7721         (Output_segment::maximum_alignment): Likewise.
7722         (Output_segment::has_dynamic_reloc): New function replacing
7723         dynamic_reloc_count.  Change all callers.
7724         (Output_segment::has_dynamic_reloc_list): New function replacing
7725         dynamic_reloc_count_list.  Change all callers.
7726         (Output_segment::set_section_addresses): Rewrite.
7727         (Output_segment::set_offset): Rewrite.
7728         (Output_segment::find_first_and_last_list): Remove.
7729         (Output_segment::set_tls_offsets): Rewrite.
7730         (Output_segment::first_section_load_address): Likewise.
7731         (Output_segment::output_section_count): Likewise.
7732         (Output_segment::section_with_lowest_load_address): Likewise.
7733         (Output_segment::write_section_headers): Likewise.
7734         (Output_segment::print_sections_to_map): Likewise.
7735         * output.h (class Output_data): Remove dynamic_reloc_count_
7736         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7737         (Output_data::add_dynamic_reloc): Rewrite.
7738         (Output_data::has_dynamic_reloc): New function.
7739         (Output_data::dynamic_reloc_count): Remove.
7740         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7741         is_last_relro_, is_first_non_relro_, is_interp_,
7742         is_dynamic_linker_section_ fields.  Add order and set_order
7743         functions.  Remove is_relro_local, set_is_relro_local,
7744         is_last_relro, set_is_last_relro, is_first_non_relro,
7745         set_is_first_non_relro functions, is_interp, set_is_interp,
7746         is_dynamic_linker_section, and set_is_dynamic_linker_section
7747         functions.
7748         (class Output_segment): Change Output_data_list from std::list to
7749         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7750         output_bss_ fields.  Update declarations.
7751
7752 2010-08-02  Ian Lance Taylor  <iant@google.com>
7753
7754         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7755         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7756         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7757
7758 2010-08-02  Ian Lance Taylor  <iant@google.com>
7759
7760         PR 11855
7761         * script.cc (Script_options::Script_options): Initialize
7762         symbol_definitions_ and symbol_references_.
7763         (Script_options::add_symbol_assignment): Update
7764         symbol_definitions_ and symbol_references_.
7765         (Script_options::add_symbol_reference): New function.
7766         (script_symbol): New function.
7767         * script.h (class Script_options): Add symbol_definitions_ and
7768         symbol_references_ fields.
7769         (Script_options::referenced_const_iterator): New type.
7770         (Script_options::referenced_begin): New function.
7771         (Script_options::referenced_end): New function.
7772         (Script_options::is_referenced): New function.
7773         (Script_options::any_unreferenced): New function.
7774         * script-c.h (script_symbol): Declare.
7775         * yyscript.y (exp): Call script_symbol.
7776         * symtab.cc: Include "script.h".
7777         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7778         Change all callers.  Check symbols referenced by scripts.
7779         (Symbol_table::add_undefined_symbols_from_command_line): Add
7780         layout parameter.  Change all callers.
7781         (Symbol_table::do_add_undefined_symbols_from_command_line):
7782         Likewise.  Break out loop body.  Check symbols referenced by
7783         scripts.
7784         (Symbol_table::add_undefined_symbol_from_command_line): New
7785         function broken out of
7786         do_add_undefined_symbols_from_command_line.
7787         * symtab.h (class Symbol_table): Update declarations.
7788         * archive.cc: Include "layout.h".
7789         (Archive::should_include_member): Add layout parameter.  Change
7790         all callers.  Check for symbol mentioned in expression.
7791         * archive.h (class Archive): Update declaration.
7792         * object.cc (Sized_relobj::do_should_include_member): Add layout
7793         parameter.
7794         * object.h (Object::should_include_member): Add layout parameter.
7795         Change all callers.
7796         (Object::do_should_include_member): Add layout parameter.
7797         (class Sized_relobj): Update declaration.
7798         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7799         parameter.
7800         * dynobj.h (class Sized_dynobj): Update declaration.
7801         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7802         layout parameter.
7803         * plugin.h (class Sized_pluginobj): Update declaration.
7804
7805 2010-08-02  Ian Lance Taylor  <iant@google.com>
7806
7807         PR 11866
7808         * output.cc (Output_segment::set_offset): Search for the first and
7809         last sections rather than assuming that the list is in order.
7810         (Output_segment::find_first_and_last_list): New function.
7811         * output.h (class Output_segment): Update declarations.
7812         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7813         (relro_strip_test_SOURCES): New variable.
7814         (relro_strip_test_DEPENDENCIES): New variable.
7815         (relro_strip_test_LDFLAGS): New variable.
7816         (relro_strip_test_LDADD): New variable.
7817         (relro_strip_test.so): New target.
7818
7819 2010-08-02  Ian Lance Taylor  <iant@google.com>
7820
7821         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7822         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7823         (Target_i386::got_tlsdesc_section): New function.
7824         (Target_i386::got_section): Create space for GOT entries for
7825         TLSDESC relocations.
7826         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7827         R_386_TLS_GOTDESC.
7828         (Target_i386::Scan::global): Likewise.
7829         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7830         using TLSDESC GOT.
7831         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7832         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7833         (Target_x86_64::got_tlsdesc_section): New function.
7834         (Target_x86_64::got_section): Create space for GOT entries for
7835         TLSDESC relocations.
7836         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7837         R_386_TLS_GOTDESC.
7838         (Target_x86_64::Scan::global): Likewise.
7839         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7840         using TLSDESC GOT.
7841
7842 2010-08-02  Ian Lance Taylor  <iant@google.com>
7843
7844         * testsuite/final_layout.sh: Use dc to convert from hex to
7845         decimal.
7846
7847 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7848
7849         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7850         paramter to the call to gold::gc_process_relocs.
7851         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7852         paramter to the call to gold::gc_process_relocs.
7853         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7854         parameter to the call to gold::gc_process_relocs.
7855         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7856         template parameter to the call to gold::gc_process_relocs.
7857         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7858         paramter to the call to gold::gc_process_relocs.
7859         * gc.h (get_embedded_addend_size): New function.
7860         (gc_process_relocs): Save the size of the reloc for use by ICF.
7861         * icf.cc (get_section_contents): Get the addend from the text section
7862         for SHT_REL relocation sections.
7863         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7864         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7865         * int_encoding.h (read_from_pointer): New overloaded function.
7866         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7867         * testsuite/icf_sht_rel_addend_test.sh: New file.
7868         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7869         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7870
7871 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7872
7873         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7874         * Makefile.in: Regenerate.
7875         * testsuite/Makefile.in: Regenerate.
7876
7877 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7878
7879         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7880         * gold/testsuite/debug_msg.cc: Likewise.
7881         * gold/testsuite/odr_violation1.cc
7882         * gold/testsuite/odr_violation2.cc
7883
7884 2010-07-21  Cary Coutant  <ccoutant@google.com>
7885
7886         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7887         string, and length fields.
7888         (Output_merge_string::Merged_strings_list): New type.
7889         (Output_merge_string::Merged_strings_lists): New typedef.
7890         (Output_merge_string): Replace merged_strings_ with
7891         merged_strings_lists_.
7892         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7893         Merged_strings_list per input object and section.  Don't store pointer
7894         to the string.  Don't store length with each merged string entry.
7895         (Output_merge_string::finalize_merged_data): Loop over list of merged
7896         strings lists.  Recompute length of each merged string.
7897
7898 2010-07-15  Cary Coutant  <ccoutant@google.com>
7899
7900         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7901         here.
7902
7903 2010-07-14  Ian Lance Taylor  <iant@google.com>
7904
7905         * descriptors.cc (Descriptors::open): Report correct name in error
7906         message.
7907
7908 2010-07-13  Doug Kwan  <dougkwan@google.com>
7909
7910         * arm.cc (Arm_input_section::Arm_input_section): For a
7911         SHT_ARM_EXIDX section, always keeps the input sections.
7912         (Arm_input_section::set_exidx_section_link): New method.
7913         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7914         has_errors_ to false.
7915         (Arm_exidx_input_section::has_errors,
7916         Arm_exidx_input_section::set_has_errors): New methods.
7917         (Arm_exidx_input_section::has_errors_): New data member.
7918         (Arm_relobj::get_exidx_shndx_list): New method.
7919         (Arm_output_section::append_text_sections_to_list): Do not skip
7920         section without SHF_EXECINSTR.
7921         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7922         errors.
7923         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7924         section header.  Make error messages more verbose.  Check for
7925         a non-executable section linked to an EXIDX section.
7926         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7927         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7928         check that there is no deferred EXIDX section if we exit early.
7929         Instead of not making an EXIDX section in case of an error, make one
7930         and set the has_errors flag of it.
7931         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7932         in a relocatable link.
7933         (Target_arm::do_relax): Look for the EXIDX output section instead of
7934         assuming that it is called .ARM.exidx.
7935         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7936         section list.  Do not check for SHF_EXECINSTR section flags but
7937         skip any input section with errors.
7938         * output.cc (Output_section::Output_section): Initialize
7939         always_keeps_input_sections_ to false.
7940         (Output_section::add_input_section): Check for
7941         always_keeps_input_sections_.
7942         *  output.h (Output_section::always_keeps_input_sections,
7943         Output_section::set_always_keeps_input_sections): New methods.
7944         (Output_section::always_keeps_input_sections): New data member.
7945
7946 2010-07-13  Rafael Espindola  <espindola@google.com>
7947
7948         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7949         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7950
7951 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7952             Ian Lance Taylor  <iant@google.com>
7953
7954         * output.h (Output_section_lookup_maps::add_merge_section):
7955         Correct check of whether value was inserted.
7956         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7957         (Output_section_lookup_maps::add_relaxed_input_section):
7958         Likewise.
7959         * arm.cc (Target_arm::got_section): Remove used local os.
7960         * i386.cc (Target_i386::got_section): Likewise.
7961         * x86_64.cc (Target_x86_64::got_section): Likewise.
7962         * sparc.cc (Target_sparc::got_section): Likewise.
7963         (Target_sparc::relocate): Remove unused local have_got_offset.
7964         * powerpc.cc (Target_powerpc::relocate): Likewise.
7965
7966 2010-07-13  Ian Lance Taylor  <iant@google.com>
7967
7968         * compressed_output.cc (zlib_decompress): Fix signature in
7969         !HAVE_ZLIB_H case.
7970
7971         * archive.cc (Archive::include_member): Unlock an external member
7972         of a thin archive.  Don't bother to delete an object we know is
7973         NULL.
7974
7975 2010-07-12  Cary Coutant  <ccoutant@google.com>
7976
7977         * compressed_output.cc (zlib_decompress): New function.
7978         (get_uncompressed_size): New function.
7979         (decompress_input_section): New function.
7980         * compressed_output.h (get_uncompressed_size): New function.
7981         (decompress_input_section): New function.
7982         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7983         Handle compressed debug sections.
7984         * layout.cc (is_compressed_debug_section): New function.
7985         (Layout::output_section_name): Map compressed section names to
7986         canonical names.
7987         * layout.h (is_compressed_debug_section): New function.
7988         (is_debug_info_section): Recognize compressed debug sections.
7989         * merge.cc: Include compressed_output.h.
7990         (Output_merge_data::do_add_input_section): Handle compressed
7991         debug sections.
7992         (Output_merge_string::do_add_input_section): Handle compressed
7993         debug sections.
7994         * object.cc: Include compressed_output.h.
7995         (Sized_relobj::Sized_relobj): Initialize new data members.
7996         (build_compressed_section_map): New function.
7997         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7998         * object.h (Object::section_is_compressed): New method.
7999         (Object::do_section_is_compressed): New method.
8000         (Sized_relobj::Compressed_section_map): New type.
8001         (Sized_relobj::do_section_is_compressed): New method.
8002         (Sized_relobj::compressed_sections_): New data member.
8003         * output.cc (Output_section::add_input_section): Handle compressed
8004         debug sections.
8005         * reloc.cc: Include compressed_output.h.
8006         (Sized_relobj::write_sections): Handle compressed debug sections.
8007
8008 2010-07-08  Cary Coutant  <ccoutant@google.com>
8009
8010         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8011         weak when resolving to a dynamic def.
8012         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8013         for weak undef/dynamic def cases. Adjust callers.
8014         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8015         undef_binding_weak_.
8016         (Symbol_table::sized_write_globals): Adjust symbol binding.
8017         (Symbol_table::sized_write_symbol): Add binding parameter.
8018         * symtab.h (Symbol::set_undef_binding): New method.
8019         (Symbol::is_undef_binding_weak): New method.
8020         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8021         (Symbol_table::should_override): Add new parameter.
8022         (Symbol_table::sized_write_symbol): Add new parameter.
8023
8024         * testsuite/weak_undef_file1.cc: Add new test case.
8025         * testsuite/weak_undef_file2.cc: Fix header comment.
8026         * testsuite/weak_undef_test.cc: Add new test case.
8027
8028 2010-06-29  Doug Kwan  <dougkwan@google.com>
8029
8030         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8031         Initialize USE_SYMBOL_.
8032         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8033         definition.
8034         (Arm_reloc_property::uses_symbol_): New data member declaration.
8035         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8036         uses symbol value and symbol is undefined but not weakly undefined.
8037
8038 2010-06-28  Rafael Espindola  <espindola@google.com>
8039
8040         * plugin.cc (Plugin::load): Use dlerror.
8041
8042 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8043
8044         * symtab.cc (detect_odr_violations): When reporting an ODR
8045         violation, report an object where the symbol is defined.
8046
8047 2010-06-25  Doug Kwan  <dougkwan@google.com>
8048
8049         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8050         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8051         definition.
8052         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8053         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8054         target hook to detect function points.
8055         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8056         * icf.h (Icf::check_section_for_function_pointers): Change type of
8057         parameter SECTION_NAME to const reference to std::string.  Use
8058         target hook to determine if section may have unsafe pointers.
8059         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8060         method definition.
8061
8062 2010-06-21  Rafael Espindola  <espindola@google.com>
8063
8064         * fileread.cc (Input_file::find_fie): New
8065         (Input_file::open): Use Input_file::find_fie.
8066         * fileread.h (Input_file::find_fie): New
8067         * plugin.cc (set_extra_library_path): New.
8068         (Plugin::load): Add set_extra_library_path to the transfer vector.
8069         (Plugin_manager::set_extra_library_path): New.
8070         (Plugin_manager::add_input_file): Use the extra search path if set.
8071         (set_extra_library_path(): New.
8072         * plugin.h (Plugin_manager): Add set_extra_library_path and
8073         extra_search_path_.
8074
8075 2010-06-19  Cary Coutant  <ccoutant@google.com>
8076
8077         * layout.cc (gdb_sections): Add .debug_types.
8078         (lines_only_debug_sections): Likewise.
8079
8080 2010-06-18  Rafael Espindola  <espindola@google.com>
8081
8082         * plugin.cc (add_input_file,add_input_library)
8083         (Plugin_manager::add_input_file): Make filename arguments const.
8084         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8085         const.
8086
8087 2010-06-16  Doug Kwan  <dougkwan@google.com>
8088
8089         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8090         .ARM.attributes section if we have not merged any input
8091         attributes sections.
8092
8093 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8094
8095         * arm.cc: Allow combining objects with no EABI version
8096         information.
8097
8098 2010-06-15  Rafael Espindola  <espindola@google.com>
8099
8100         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8101
8102 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8103
8104         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8105         (struct iovec): Correct !HAVE_READV definition.
8106
8107 2010-06-10  Cary Coutant  <ccoutant@google.com>
8108
8109         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8110         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8111         reloc sections.
8112         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8113
8114         PR 11683
8115         * symtab.h (Symbol::is_placeholder): New member function.
8116         * target-reloc.h (relocate_section): Check for placeholder symbols.
8117
8118         * testsuite/Makefile.am (plugin_test_8): New test.
8119         (plugin_test_9): New test.
8120         * testsuite/Makefile.in: Regenerate.
8121
8122 2010-06-09  Nick Clifton  <nickc@redhat.com>
8123
8124         * yyscript.y (input_list_element): Allow strings prefixed with
8125         the '-' character.  Treat these as libraries.
8126         * script.cc (script_add_library): New function.  Adds a library
8127         specified by "-l<name>" found in an input script.
8128         * script-c.h: Add prototype for script_add_library.
8129
8130 2010-06-07  Doug Kwan  <dougkwan@google.com>
8131
8132         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8133         Restrict stub-group size to be within long conditional branch
8134         range when working around cortex-A8 erratum.
8135
8136 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8137
8138         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8139         #ifdef typo.
8140
8141 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8142
8143         PR gold/11658
8144         * output.cc
8145         (Output_section::Input_section_sort_entry::compare_section_ordering):
8146         Change to return non-zero correctly.
8147         (Output_section::Input_section_sort_section_order_index_compare
8148         ::operator()): Change to fix ambiguity in comparisons.
8149
8150 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8151
8152         * gold.h (is_wildcard_string): New function.
8153         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8154         (Layout::layout_eh_frame): Ditto.
8155         (Layout::find_section_order_index): New method.
8156         (Layout::read_layout_from_file): New method.
8157         * layout.h (Layout::find_section_order_index): New method.
8158         (Layout::read_layout_from_file): New method.
8159         (Layout::input_section_position_): New private member.
8160         (Layout::input_section_glob_): New private member.
8161         * main.cc (main): Call read_layout_from_file here.
8162         * options.h (--section-ordering-file): New option.
8163         * output.cc (Output_section::input_section_order_specified_): New
8164         member.
8165         (Output_section::Output_section): Initialize new member.
8166         (Output_section::add_input_section): Add new parameter.
8167         Keep input sections when --section-ordering-file is used.
8168         (Output_section::set_final_data_size): Sort input sections when
8169         section ordering file is specified.
8170         (Output_section::Input_section_sort_entry): Add new parameter.
8171         Check sorting type.
8172         (Output_section::Input_section_sort_entry::compare_section_ordering):
8173         New method.
8174         (Output_section::Input_section_sort_compare::operator()): Change to
8175         consider section_order_index.
8176         (Output_section::Input_section_sort_init_fini_compare::operator()):
8177         Change to consider section_order_index.
8178         (Output_section::Input_section_sort_section_order_index_compare
8179         ::operator()): New method.
8180         (Output_section::sort_attached_input_sections): Change to sort
8181         according to section order when specified.
8182         (Output_section::add_input_section<32, true>): Add new parameter.
8183         (Output_section::add_input_section<64, true>): Add new parameter.
8184         (Output_section::add_input_section<32, false>): Add new parameter.
8185         (Output_section::add_input_section<64, false>): Add new parameter.
8186         * output.h (Output_section::add_input_section): Add new parameter.
8187         (Output_section::input_section_order_specified): New
8188         method.
8189         (Output_section::set_input_section_order_specified): New method.
8190         (Input_section::Input_section): Initialize section_order_index_.
8191         (Input_section::section_order_index): New method.
8192         (Input_section::set_section_order_index): New method.
8193         (Input_section::section_order_index_): New member.
8194         (Input_section::Input_section_sort_section_order_index_compare): New
8195         struct.
8196         (Output_section::input_section_order_specified_): New member.
8197         * script-sections.cc (is_wildcard_string): Delete and move modified
8198         method to gold.h.
8199         (Output_section_element_input::Output_section_element_input): Modify
8200         call to is_wildcard_string.
8201         (Output_section_element_input::Input_section_pattern
8202         ::Input_section_pattern): Ditto.
8203         (Output_section_element_input::Output_section_element_input): Ditto.
8204         * testsuite/Makefile.am (final_layout): New test case.
8205         * testsuite/Makefile.in: Regenerate.
8206         * testsuite/final_layout.cc: New file.
8207         * testsuite/final_layout.sh: New file.
8208
8209 2010-06-01  Rafael Espindola  <espindola@google.com>
8210
8211         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8212
8213 2010-06-01  Rafael Espindola  <espindola@google.com>
8214
8215         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8216         visibility of symbols.
8217
8218 2010-05-27  Doug Kwan  <dougkwan@google.com>
8219
8220         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8221         from start of output section instead of address for a local symbol
8222         in a merged or relaxed section when doing a relocatable link.
8223
8224 2010-05-26  Rafael Espindola  <espindola@google.com>
8225
8226         PR 11604
8227         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8228         adding sections the garbage collector removed.
8229         * gold/testsuite/Makefile.am: Add test.
8230         * gold/testsuite/Makefile.in: Regenerate.
8231         * gold/testsuite/plugin_test_7.sh: New.
8232         * gold/testsuite/plugin_test_7_1.c: New.
8233         * gold/testsuite/plugin_test_7_2.c: New.
8234
8235 2010-05-26  Rafael Espindola  <espindola@google.com>
8236
8237         * script-sections.cc (Output_section_definition::set_section_addresses):
8238         Check for --section-start.
8239
8240 2010-05-26  Doug Kwan  <dougkwan@google.com>
8241
8242         * arm.cc (Arm_scan_relocatable_relocs): New class.
8243         (Target_arm::relocate_special_relocatable): New method.
8244         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8245         (Arm_relocate_functions::thumb_branch_common): Same.
8246         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8247         instead of Default_scan_relocatable_relocs.
8248         * target-reloc.h (relocate_for_relocatable): Let target handle
8249         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8250         * target.h (Sized_target::relocate_special_relocatable): New method.
8251
8252 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8253
8254         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8255
8256 2010-05-23  Doug Kwan  <dougkwan@google.com>
8257
8258         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8259         instead of a cast.
8260         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8261         with a direct branch, not a conditional branch, to a stub.
8262         * merge.cc (Output_merge_base::record_input_section): New method
8263         defintion.
8264         (Output_merge_data::do_add_input_section): Record input section if
8265         keeps-input-sections flag is set.
8266         (Output_merge_string::do_add_input_section): Ditto.
8267         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8268         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8269         INPUT_SECTIONS_.
8270         (Output_merge_base::keeps_input_sections,
8271         Output_merge_base::set_keeps_input_sections,
8272         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8273         method definitions.
8274         (Output_merge_base::Input_sections): New type declaration.
8275         (Output_merge_base::input_sections_begin,
8276         Output_merge_base::input_sections_end,
8277         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8278         (Output_merge_base::bool keeps_input_sections_,
8279         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8280         Output_merge_base::input_sections_): New data members.
8281         (Output_merge_data::do_set_keeps_input_sections): New method
8282         defintion.
8283         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8284         * output.cc (Output_section::Input_section::relobj): Move method
8285         defintion from class declaration to here and handle merge sections.
8286         (Output_section::Input_section::shndx): Ditto.
8287         (Output_section::Output_section): Remove initializations of removed
8288         data members and initialize new data member LOOKUP_MAPS_.
8289         (Output_section::add_input_section): Set keeps-input-sections flag
8290         for a newly created merge output section as appropriate.  Adjust code
8291         to use Output_section_lookup_maps class.
8292         (Output_section::add_relaxed_input_section): Adjst code for lookup
8293         maps code refactoring.
8294         (Output_section::add_merge_input_section): Add a new parameter
8295         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8296         class.  If adding input section to a newly created merge output
8297         section fails, remove the new merge section.
8298         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8299         Adjust code for use of the Output_section_lookup_maps class.
8300         (Output_section::find_merge_section): Ditto.
8301         (Output_section::build_lookup_maps): New method defintion.
8302         (Output_section::find_relaxed_input_section): Adjust code to use
8303         Output_section_lookup_maps class.
8304         (Output_section::get_input_sections): Export merge sections.  Adjust
8305         code to use Output_section_lookup_maps class.
8306         (Output_section:::add_script_input_section): Adjust code to use
8307         Output_section_lookup_maps class.  Update lookup maps for merge
8308         sections also.
8309         (Output_section::discard_states): Use Output_section_lookup_maps.
8310         (Output_section::restore_states): Same.
8311         * output.h (Merge_section_properties): Move class defintion out of
8312         Output_section.
8313         (Output_section_lookup_maps): New class.
8314         (Output_section::Input_section::is_merge_section): New method
8315         defintion.
8316         (Output_section::Input_section::relobj): Move defintion out of class
8317         defintion.  Declare method only.
8318         (Output_section::Input_section::shndx): Ditto.
8319         (Output_section::Input_section::output_merge_base): New method defintion.
8320         (Output_section::Input_section::u2_.pomb): New union field.
8321         (Output_section::Merge_section_by_properties_map,
8322         Output_section::Output_section_data_by_input_section_map,
8323         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8324         Remove types.
8325         (Output_section::add_merge_input_section): Add new parameter
8326         KEEPS_INPUT_SECTIONS.
8327         (Output_section::build_lookup_maps): New method declaration.
8328         (Output_section::merge_section_map_,
8329         Output_section::merge_section_by_properties_map_,
8330         Output_section::relaxed_input_section_map_,
8331         Output_section::is_relaxed_input_section_map_valid_): Remove data
8332         members.
8333         (Output_section::lookup_maps_): New data member.
8334
8335 2010-05-21  Doug Kwan  <dougkwan@google.com>
8336
8337         PR gold/11619
8338         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8339         avoid a compilation error.
8340
8341 2010-05-19  Rafael Espindola  <espindola@google.com>
8342
8343         * script-sections.cc (Output_section_definition::allocate_to_segment):
8344         Update the phdrs_list even when the output section is NULL.
8345         * testsuite/Makefile.am: Add test.
8346         * testsuite/Makefile.in: Regenerate.
8347         * testsuite/script_test_9.cc: New.
8348         * testsuite/script_test_9.sh: New.
8349         * testsuite/script_test_9.t: New.
8350
8351 2010-05-19  Doug Kwan  <dougkwan@google.com>
8352
8353         * arm.cc (Arm_input_section::original_size): New method.
8354         (Arm_input_section::do_addralign): Add a cast.
8355         (Arm_input_section::do_output_offset): Remove static cast.
8356         (Arm_input_section::original_addralign,
8357          Arm_input_section::original_size_): Change type to uint32_t.
8358         (Arm_input_section::init): Add safe casts for section alignment
8359         and size.
8360         (Arm_input_section::set_final_data_size): Do not set address and
8361         offset of stub table.
8362         (Arm_output_section::fix_exidx_coverage): Change use of of
8363         Output_section::Simple_input_section to that of
8364         Output_section::Input_section.
8365         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8366         except for the first pass.
8367         * output.cc (Output_section::get_input_sections): Change type of
8368         input_sections to std::list<Input_section>.
8369         (Output_section::add_script_input_section): Rename from
8370         Output_section::add_simple_input_section.  Change type of SIS
8371         parameter from Simple_input_section to Input_section.
8372         * output.h (Output_section::Simple_input_section): Remove class.
8373         (Output_section::Input_section): Change class visibility to public.
8374         (Output_section::Input_section::addralign): Use stored alignments
8375         for special input sections if set.
8376         (Output_section::Input_section::set_addralign): New method.
8377         (Output_section::get_input_sections): Change parameter type from
8378         list of Simple_input_section to list of Input_section.
8379         (Output_section::add_script_input_section): Rename from
8380         Output_section::add_simple_input_section. Change first parameter's
8381         type from Simple_input_section to Input_section and remove the
8382         second and third parameters.
8383         * script-sections.cc (Input_section::Input_section_list): Change
8384         type to list of Output_section::Input_section/
8385         (Input_section_info::Input_section_info): Change parameter type of
8386         INPUT_SECTION to Output_section::Input_section.
8387         (Input_section_info::input_section): Change return type.
8388         (Input_section_info::input_section_): Change type to
8389         Output_section::Input_section.
8390         (Output_section_element_input::set_section_addresses): Adjust code
8391         to use Output_section::Input_section instead of
8392         Output_section::Simple_input_section.  Adjust code for renaming
8393         of Output_section::add_simple_input_section.
8394         (Orphan_output_section::set_section_addresses): Ditto.
8395
8396 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8397
8398         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8399         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8400
8401 2010-05-18  Rafael Espindola  <espindola@google.com>
8402
8403         * options.cc (General_options::finalize): Handle -nostdlib.
8404         * options.h (nostdlib): New option.
8405         * script.cc (script_add_search_dir): Handle -nostdlib.
8406
8407 2010-05-12  Doug Kwan  <dougkwan@google.com>
8408
8409         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8410         attributes section only if there no attributes section after merging.
8411         (Target_arm::merge_object_attributes): Move value of
8412         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8413         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8414         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8415         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8416         and arm_attr_merge_7.stdout.
8417         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8418         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8419         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8420         arm_attr_merge_7b.o): New rules.
8421         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8422         arm_attr_merge_7
8423         * testsuite/Makefile.in: Regenerate.
8424         * testsuite/arm_attr_merge.sh: New file.
8425         * testsuite/arm_attr_merge_[67][ab].s: Same.
8426
8427 2010-05-05  Nick Clifton  <nickc@redhat.com>
8428
8429         * po/es.po: Updated Spanish translation.
8430
8431 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8432
8433         * Makefile.am (install-exec-local): Properly install gold as
8434         default cross linker.
8435         * Makefile.in: Regenerated.
8436
8437 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8438             Nick Clifton  <nickc@redhat.com>
8439
8440         * configure.ac (install_as_default): Define and set to false
8441         unless --enable-gold or --enable-gold=both/gold has been
8442         specified.
8443         * configure: Regenerate.
8444
8445         * Makefile.am (install-exec-local): Install the executable as
8446         'ld.gold'.  If install_as_default is true then also install it as
8447         'ld'.
8448         * Makefile.in: Regenerated.
8449
8450 2010-04-24  Ian Lance Taylor  <iant@google.com>
8451
8452         * layout.cc (Layout::layout_reloc): In relocatable link don't
8453         combine reloc sections for grouped sections.
8454
8455 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8456
8457         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8458         sections that are not ordinary to icf.
8459         * icf.cc (get_section_contents): Handle relocation pointing to section
8460         with no object or shndx information.
8461         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8462         * testsuite/Makefile.in: Regenerate.
8463         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8464         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8465
8466 2010-04-22  Ian Lance Taylor  <iant@google.com>
8467
8468         * expression.cc (Expression::Expression_eval_info): Add
8469         result_alignment_pointer field.
8470         (Expression::eval_with_dot): Add result_alignment_pointer
8471         parameter.  Change all callers.
8472         (Expression::eval_maybe_dot): Likewise.
8473         (class Binary_expression): Add alignment_pointer parameter to
8474         left_value and right_value.  Change all callers.
8475         (BINARY_EXPRESSION): Set result alignment.
8476         (class Trinary_expression): Add alignment_pointer parameter to
8477         arg2_value and arg3_value.  Change all callers.
8478         (Trinary_cond::value): Set result alignment.
8479         (Max_expression::value, Min_expression::value): Likewise.
8480         (Align_expression::value): Likewise.
8481         * script-sections.cc (class Sections_element): Add dot_alignment
8482         parameter to set_section_addresses virtual function.  Update
8483         instantiations.
8484         (class Output_section_element): Likewise.
8485         (Script_sections::create_segments): Add dot_alignment parameter.
8486         Change all callers.
8487         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8488         (Script_sections::set_phdrs_clause_addresses): Likewise.
8489         * script-sections.h: Update declarations.
8490         * script.h: Update declarations.
8491         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8492         min_p_align.
8493         * testsuite/script_test_3.t: Set large alignment.
8494         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8495         segment has expected alignment.
8496
8497 2010-04-22  Nick Clifton  <nickc@redhat.com>
8498
8499         * po/gold.pot: Updated by the Translation project.
8500         * po/vi.po: Updated Vietnamese translation.
8501
8502 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8503
8504         * testsuite/Makefile.am (check_PROGRAMS): Add
8505         icf_virtual_function_folding_test.
8506         * testsuite/Makefile.in: Regenerated.
8507
8508 2010-04-15  Andrew Haley  <aph@redhat.com>
8509
8510         * options.h (merge_exidx_entries): New option.
8511         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8512         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8513         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8514         (Target_arm::merge_exidx_entries): New function.
8515         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8516         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8517         to Arm_exidx_fixup constructor.
8518         Add new arg, merge_exidx_entries.
8519         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8520         Arm_output_section::fix_exidx_coverage.
8521
8522 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8523
8524         * icf.cc (get_section_contents): Check for preemptible functions.
8525         Ignore addend when appropriate.
8526         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8527         section folded.
8528         (add_from_relobj): Check for section folded.
8529         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8530         * symtab.h (should_add_dynsym_entry): Add new parameter.
8531         * target-reloc.h (scan_relocs): Check for section folded.
8532         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8533         Check reloc types for function pointers in shared objects.
8534         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8535         case.
8536         (icf_preemptible_functions_test): New test case.
8537         (icf_string_merge_test): New test case.
8538         * testsuite.Makefile.in: Regenerate.
8539         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8540         bar_glob.  Refactor code.
8541         * testsuite/icf_preemptible_functions_test.cc: New file.
8542         * testsuite/icf_preemptible_functions_test.sh: New file.
8543         * testsuite/icf_string_merge_test.cc: New file.
8544         * testsuite/icf_string_merge_test.sh: New file.
8545         * testsuite/icf_virtual_function_folding_test.cc: New file.
8546         * testsuite/icf_virtual_function_folding_test.sh: New file.
8547
8548 2010-04-14  Doug Kwan  <dougkwan@google.com>
8549
8550         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8551         for local symbol recounting if we remove a section due to ICF.
8552         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8553         there are no regular objects in input.
8554
8555 2010-04-13  Doug Kwan  <dougkwan@google.com>
8556
8557         * arm.cc (Arm_input_section::set_final_data_size): Compute
8558         accurate final data size instead of using current data size.
8559
8560 2010-04-09  Doug Kwan  <dougkwan@google.com>
8561
8562         * layout.cc (Layout::choose_output_section): Handle script section
8563         types.
8564         (Layout::make_output_section_for_script): Add section type parameter.
8565         Handle script section types.
8566         * layout.h (Layout::make_output_section_for_script): Add section
8567         type parameter.
8568         * output.cc (Output_section::Output_section): Initialize data member
8569         is_noload_.
8570         (Output_section::do_reset_address_and_file_offset): Do not set address
8571         to 0 if section is a NOLOAD section.
8572         * output.h (Output_section::is_noload): New method.
8573         (Output_section::set_is_noload): Ditto.
8574         (Output_section::is_noload_): New data member.
8575         * script-c.h (Script_section_type): New enum type.
8576         (struct Parser_output_section_header): Add new file section_type.
8577         * script-sections.cc (Sections_element::output_section_name): Add
8578         parameter for returning script section type.
8579         (Output_section_definition::output_section_name): Ditto.
8580         (Output_section_definition::section_type)P; New method.
8581         (Output_section_definiton::script_section_type_name): Ditto.
8582         (Output_section_definition::script_section_type_): New data member.
8583         (Output_section_definition::Output_section_definition): Initialize
8584         data member Output_section_definition::script_section_type_.
8585         (Output_section_definition::create_sections): Pass script section type
8586         to Layout::make_output_section_for_script.
8587         (Output_section_definition::output_section_name): Return script
8588         section type to caller.
8589         (Output_section_definition::set_section_address): Do not advance
8590         dot value and load address if section type is NOLOAD.  Set address
8591         of NOLOAD sections regardless of section flags.
8592         (Output_section_definition::print): Print section type if it is
8593         not SCRIPT_SECTION_TYPE_NONE.
8594         (Output_section_definition::section_type): New method.
8595         (Output_section_definition::script_section_type_name): Ditto.
8596         (Script_sections::output_section_name): Add new parameter
8597         PSECTION_TYPE for returning script section type.  Pass it to
8598         section elements.  Handle discard sections.
8599         (Sort_output_sections::operator()): Handle NOLOAD sections.
8600         * script-sections.h (Script_sections::Section_type): New enum type.
8601         (Script_sections::output_section_name): Add a new parameter for
8602         returning script section type.
8603         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8604         INFO and NOLOAD.
8605         * yyscript.y (union): Add new field SECTION_TYPE.
8606         (COPY, DSECT, INFO, NOLOAD): New tokens.
8607         (opt_address_and_section_type): Change type to output_section_header.
8608         (section_type): New non-terminal
8609         (section_header): Handle section type.
8610         (opt_address_and_section_type): Return section type value.
8611
8612 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8613
8614         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8615         * testsuite/plugin_common_test_2.c (foo): Likewise.
8616
8617 2010-04-08  Doug Kwan  <dougkwan@google.com>
8618
8619         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8620         Output_merge_data.
8621         * output.cc (Output_section::add_merge_input_section): Simplify
8622         code and return status of Output_merge_base::add_input_section.
8623         Update merge section map only if Output_merge_base::add_input_section
8624         returns true.
8625
8626 2010-04-07  Doug Kwan  <dougkwan@google.com>
8627
8628         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8629         if section is marked as containing instructions but has no mapping
8630         symbols.
8631         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8632         correct section index.
8633         (Arm_relobj::find_linked_text_section): Ditto.
8634
8635 2010-04-07  Cary Coutant  <ccoutant@google.com>
8636
8637         * archive.cc (include_member): Destroy Read_symbols_data object before
8638         releasing file.
8639         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8640         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8641         (Read_symbols_data::~Read_symbols_data) New destructor.
8642         (Section_relocs::Section_relocs) New constructor.
8643         (Section_relocs::~Section_relocs) New destructor.
8644         (Read_relocs_data::Read_relocs_data) New constructor.
8645         (Read_relocs_data::~Read_relocs_data) New destructor.
8646         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8647         pointers to NULL after deleting.
8648
8649 2010-04-07  Doug Kwan  <dougkwan@google.com>
8650
8651         * arm.cc: Replace "endianity" with "endianness" in comments.
8652         (Arm_exidx_cantunwind): Ditto.
8653         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8654         (Arm_relobj::merge_flags_and_attributes): New method.
8655         (Arm_relobj::merge_flags_and_attributes_): New data member.
8656         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8657         (Arm_relobj::scan_sections_for_stubs): Ditto.
8658         (Arm_relobj::do_read_symbols): Check to see if we really want to
8659         merge processor-specific flags and attributes.  Exit early if
8660         an object is empty except for section names and the undefined symbol.
8661         (Target_arm::do_finalize_sections): Move check for ELF format to
8662         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8663         attributes from a regular object only when we have determined that
8664         it is aapropriate.  Do not create an .ARM.attributes section in
8665         output if there is no regular input object.
8666         (Target_arm::merge_processor_specific_flags): Check
8667         --warn-mismatch before printing any error.
8668         (Target_arm::merge_object_attributes): Ditto.
8669         * gold.cc (queue_middle_tasks): Handle the case in which there is
8670         no regular object in input.
8671         * options.cc (General_options::parse_EB): New method.
8672         (General_options::parse_EL): Same.
8673         (General_options::General_options): Initialize endianness_.
8674         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8675         New options.
8676         (General_options::Endianness): New enum.
8677         (General_options::endianness): New method.
8678         (General_options::endianness_): New data member.
8679         * parameters.cc (Parameters::set_options): Check target endianness.
8680         (Parameters::set_target_once): Ditto.
8681         (Parameters::check_target_endianness): New method.
8682         (parameters_force_valid_target): If either -EL or -EB is specified,
8683         use it to define endianness of default target.
8684         * parameters.h (Parameters::check_target_endianness): New method
8685         declaration.
8686         * target.h (class Target): Change "endianity" to "endianness"
8687         in comments.
8688
8689 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8690
8691         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8692         * configure: Regenerate.
8693         * Makefile.in: Regenerate.
8694         * testsuite/Makefile.in: Regenerate.
8695
8696 2010-04-06  Cary Coutant  <ccoutant@google.com>
8697
8698         gcc PR lto/42757
8699         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8700         prevailing definitions of common symbols.
8701         * testsuite/plugin_test_6.sh: New test case.
8702         * testsuite/plugin_common_test_1.c: New test case.
8703         * testsuite/plugin_common_test_2.c: New test case.
8704         * testsuite/Makefile.am (plugin_test_6): New test case.
8705         * testsuite/Makefile.in: Regenerate.
8706
8707 2010-04-06  Nick Clifton  <nickc@redhat.com>
8708
8709         * po/vi.po: New Vietnamese translation.
8710
8711 2010-03-30  Doug Kwan  <dougkwan@google.com>
8712
8713         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8714
8715 2010-03-25  Doug Kwan  <dougkwan@google.com>
8716
8717         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8718         to avoid a conversion warning on a 32-bit host.
8719
8720 2010-03-24  Ian Lance Taylor  <iant@google.com>
8721
8722         * testsuite/script_test_3.t: Add a TLS segment.
8723         * testsuite/Makefile.am (check_PROGRAMS): Add
8724         tls_phdrs_script_test.
8725         (tls_phdrs_script_test_SOURCES): Define.
8726         (tls_phdrs_script_test_DEPENDENCIES): Define.
8727         (tls_phdrs_script_test_LDFLAGS): Define.
8728         (tls_phdrs_script_test_LDADD): Define.
8729         * testsuite/Makefile.in: Rebuild.
8730
8731 2010-03-23  Cary Coutant  <ccoutant@google.com>
8732
8733         * fileread.cc (find_or_make_view): Fix comment.
8734
8735 2010-03-23  Ian Lance Taylor  <iant@google.com>
8736
8737         * script-sections.cc (class Orphan_section_placement): Define
8738         PLACE_TLS and PLACE_TLS_BSS.
8739         (Orphan_section_placement::Orphan_section_placement): Initialize
8740         new places.
8741         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8742         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8743         (tls_script_test_SOURCES): Define.
8744         (tls_script_test_DEPENDENCIES): Define.
8745         (tls_script_test_LDFLAGS): Define.
8746         (tls_script_test_LDADD): Define.
8747         * testsuite/Makefile.in: Rebuild.
8748
8749 2010-03-22  Doug Kwan  <dougkwan@google.com>
8750
8751         * arm.cc (Arm_relocate_functions::abs8,
8752         Arm_relocate_functions::abs16): Use correct check for overflow
8753         specified in the ARM ELF specs.
8754         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8755         target of a BLX instruction specially.
8756         (Reloc_stub::stub_type_for_reloc): Ditto.
8757         (Relocate::relocate): Use symbolic names instead of numeric relocation
8758         codes to report error.
8759         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8760         workaround.
8761         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8762         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8763         thumb2_blx_out_of_range.stdout
8764         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8765         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8766         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8767         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8768         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8769         thumb2_blx_in_range, thumb2_blx_in_range.o,
8770         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8771         thumb2_blx_out_of_range.o): New rules.
8772         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8773         thumb2_blx_in_range and thumb2_blx_out_of_range.
8774         * testsuite/Makefile.in: Regenerate.
8775         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8776         * testsuite/thumb_blx_in_range.s: New file.
8777         * testsuite/thumb_blx_out_of_range.s: New file.
8778
8779 2010-03-22  Rafael Espindola  <espindola@google.com>
8780
8781         * archive.cc (Should_include): Move to archive.h.
8782         (should_include_member): Make it a member of Archive.
8783         (Lib_group): New.
8784         (Add_lib_group_symbols): New.
8785         * archive.h: Include options.h.
8786         (Archive_member): Moved from Archive.
8787         (Should_include): Moved from archive.cc.
8788         (Lib_group): New.
8789         (Add_lib_group_symbols): New.
8790         * dynobj.cc (do_should_include_member): New.
8791         * dynobj.h (do_should_include_member): New.
8792         * gold.cc (queue_initial_tasks): Update call to queue.
8793         * main.cc (main): Print lib group stats.
8794         * object.cc (do_should_include_member): New.
8795         * object.h: Include archive.h.
8796         (Object::should_include_member): New.
8797         (Object::do_should_include_member): New.
8798         (Sized_relobj::do_should_include_member): New.
8799         * options.cc (General_options::parse_start_lib): New.
8800         (General_options::parse_end_lib): New.
8801         (Input_arguments::add_file): Handle lib groups.
8802         (Input_arguments::start_group): Check we are not in a lib.
8803         (Input_arguments::start_lib): New.
8804         (Input_arguments::end_lib): New.
8805         * options.h (General_options): Add start_lib and end_lib.
8806         (Input_argument::lib_): New.
8807         (Input_argument::lib): New.
8808         (Input_argument::is_lib): New.
8809         (Input_file_lib): New.
8810         (Input_arguments::in_lib_): New.
8811         (Input_arguments::in_lib): New.
8812         (Input_arguments::start_lib): New.
8813         (Input_arguments::end_lib_): New.
8814         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8815         in unused members as preempted.
8816         (Sized_pluginobj::do_should_include_member): New.
8817         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8818         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8819         return the blocker.
8820         (Read_symbols::do_whole_lib_group): New.
8821         (Read_symbols::do_lib_group): New.
8822         (Read_symbols::do_read_symbols): Handle lib groups.
8823         (Read_symbols::get_name): Handle lib groups.
8824         * readsyms.h (Read_symbols): Add an archive member pointer.
8825         (Read_symbols::do_whole_lib_group): New.
8826         (Read_symbols::do_lib_group): New.
8827         (Read_symbols::member_): New.
8828         * script.cc (read_input_script): Update call to queue_soon.
8829
8830 2010-03-19  Doug Kwan  <dougkwan@google.com>
8831
8832         * arm.cc (Stub_table::Stub_table): Initialize new data members
8833         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8834         (Stub_table::add_reloc_stub): Assign stub offset and update
8835         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8836         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8837         New data members.
8838         (Stub_table::update_data_size_and_addralign): Use
8839         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8840         instead of going over all reloc stubs.
8841         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8842         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8843         Stringpool_template::offset_ to size of Stringpool_char.
8844         (Stringpool_template::new_key_offset): Remove code to initialize
8845         Stringpool_template::offset_.
8846         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8847         Stringpool_template::offset_ to zero.
8848
8849 2010-03-15  Doug Kwan  <dougkwan@google.com>
8850
8851         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8852         offset_.
8853         (Stringpool_template::new_key_offset): New method.
8854         (Stringpool_template::add_string): Assign offsets when adding new
8855         strings.
8856         (Stringpool_template::set_string_offsets): Do not set string offsets
8857         when not optimizing.
8858         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8859         member size_.
8860         (Chunked_vector::clear): Clear size_.
8861         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8862         (Chunked_vector::size): Return size_.
8863         (Chunked_vector::push_back): Use size_ to find insert position.
8864         (Chunked_vector::size_): New data member.
8865         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8866         (Stringpool_template::new_key_offset): New method declaration.
8867         (Stringpool_template::offset_): New data member.
8868
8869 2010-03-15   Rafael Espindola  <espindola@google.com>
8870
8871         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8872         Add_symbols' constructor.
8873         * readsyms.h (Add_symbols): Remove the input_group member.
8874
8875 2010-03-10  Ian Lance Taylor  <iant@google.com>
8876
8877         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8878         target to ask whether a reference to a symbol requires a stack
8879         split.
8880         * target.h (Target::is_call_to_non_split): New function.
8881         (Target::do_is_call_to_non_split): Declare virtual function.
8882         * target.cc: Include "symtab.h".
8883         (Target::do_is_call_to_non_split): New function.
8884         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8885
8886 2010-03-10  Cary Coutant  <ccoutant@google.com>
8887
8888         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8889         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8890         (File_read::open[2]): Add whole_file_view_ to list of views.
8891         (File_read::make_view): Remove test of whole_file_view_.
8892         (File_read::find_or_make_view): Create whole_file_view_ if
8893         necessary.
8894         (File_read::clear_views): Replace bool parameter with enum;
8895         adjust all callers.  Don't delete views with permanent data;
8896         do delete cached views and views from archives if
8897         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8898         if clearing the corresponding view.
8899         * fileread.h (File_read::Clear_views_mode): New enum.
8900         (File_read::View::is_permanent_view): New method.
8901         (File_read::clear_views): Replace bool parameter
8902         with enum; adjust all callers.
8903         * options.h (General_options): Change keep_files_mapped option;
8904         add map_whole_files.
8905         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8906         releasing the file.
8907         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8908         the file.
8909
8910 2010-03-10  David S. Miller  <davem@davemloft.net>
8911
8912         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8913
8914 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8915
8916         * icf.cc (get_section_contents): Add '@' marker after processing the
8917         merge reloc.
8918
8919 2010-03-08  Doug Kwan  <dougkwan@google.com>
8920
8921         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8922         due to a conversion warning.
8923         (Arm_relobj::update_output_local_symbol_count): Check for local
8924         symbol with unset output index.
8925
8926 2010-03-05  Ian Lance Taylor  <iant@google.com>
8927
8928         * options.h (class General_options): Add --spare-dynamic-tags.
8929         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8930         --spare-dynamic-tags.
8931
8932 2010-03-05  Ian Lance Taylor  <iant@google.com>
8933
8934         * incremental.cc: Include "libiberty.h".
8935
8936 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8937
8938         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8939         function, is_info_ member.
8940         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8941         (Versions::Versions): Update caller.
8942         (Versions::define_base_version): Likewise.
8943         (Versions::add_def): Likewise.
8944
8945 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8946
8947         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8948         (Scan::possible_function_pointer_reloc): New function.
8949         (Scan::local_reloc_may_be_function_pointer): Change to call
8950         possible_function_pointer_reloc.
8951         (Scan::global_reloc_may_be_function_pointer): Ditto.
8952         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8953         relocations in ".data.rel.ro._ZTV" section.
8954         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8955         * testsuite/icf_safe_so_test.cc: Ditto.
8956         * testsuite/icf_safe_test.cc: Ditto.
8957         * testsuite/icf_safe_test.sh: Ditto.
8958
8959 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8960             Ian Lance Taylor  <iant@google.com>
8961
8962         * target-reloc.h (relocate_section): Check the symbol table index
8963         for -1U before setting the local symbol index.
8964         (scan_relocatable_relocs): If copying the relocation, record that
8965         the local symbol is required.
8966         * object.h (Symbol_value::is_output_symtab_index_set): New
8967         function.
8968         (Symbol_value::may_be_discarded_from_output_symtab): New
8969         function.
8970         (Symbol_value::has_output_symtab_entry): New function.
8971         (Symbol_value::needs_output_symtab_entry): Remove.
8972         (Symbol_value::output_symtab_index): Make sure the symbol index is
8973         set.
8974         (Symbol_value::set_output_symtab_index): Make sure the symbol
8975         index is not set.  Make sure the new index is valid.
8976         (Symbol_value::set_must_have_output_symtab_entry): New function.
8977         (Symbol_value::has_output_dynsym_entry): New function.
8978         (Symbol_value::set_output_dynsym_index): Make sure the new index
8979         is valid.
8980         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8981         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8982         local symbol if permitted.
8983         (Sized_relobj::do_finalize_local_symbols): Call
8984         is_output_symtab_index_set rather than needs_output_symtab_entry.
8985         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8986         rather than needs_output_symtab_entry.  Call
8987         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8988         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8989         is_output_symtab_index_set rather than needs_output_symtab_entry.
8990         * testsuite/discard_locals_relocatable_test.c: New file.
8991         * testsuite/discard_locals_test.sh: Test -r.
8992         * testsuite/Makefile.am (check_DATA): Add
8993         discard_locals_relocatable_test1.syms,
8994         discard_local_relocatable_test2.syms.
8995         (MOSTLYCLEANFILES): Likewise.  Also add
8996         discard_locals_relocatable_test1.lout and
8997         discard_locals_relocatable_test2.out.
8998         (discard_locals_relocatable_test1.syms): New target.
8999         (discard_locals_relocatable_test.o): New target.
9000         (discard_locals_relocatable_test1.out): New target.
9001         (discard_locals_relocatable_test2.syms): New target.
9002         (discard_locals_relocatable_test2.out): New target.
9003         (various): Add missing ../ld-new dependencies.
9004         * testsuite/Makefile.in: Rebuild.
9005
9006 2010-03-03  Nick Clifton  <nickc@redhat.com>
9007
9008         * po/fi.po: New Finnish translation.
9009
9010 2010-03-01  Doug Kwan  <dougkwan@google.com>
9011
9012         * layout.cc (Layout::Layout): Force section types of .init_array*,
9013         .preinit_array* and .fini_array* sections.
9014         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9015         Fix check of return value of std::string::find.().
9016         (Output_section::Input_section_sort_compare::operator()): Remove
9017         comment about .init_array.
9018         (Output_section::Input_section_sort_init_fini_compare::operator()):
9019         New method.
9020         (Output_section::sort_attached_input_sections): Handle .init_array
9021         and .fini_array specially.
9022         * output.h (Output_section::Inut_section_sort_compare): Update
9023         comment.
9024         (Output_section::Input_section_sort_init_fini_compare): New struct.
9025
9026 2010-02-26  Doug Kwan  <dougkwan@google.com>
9027
9028         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9029         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9030         * testsuite/debug_msg.sh: Avoid matching source line number for
9031         use of global variable undef_int.
9032
9033 2010-02-26  Doug Kwan  <dougkwan@google.com>
9034
9035         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9036         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9037         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9038         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9039         * options.cc (General_options::General_options): Initialize member
9040         fix_v4bx_.
9041         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9042         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9043         and rm_no_fix_v4bx.stdout
9044         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9045         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9046         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9047         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9048         and arm_no_fix_v4bx.
9049         * Makefile.in: Regenerate.
9050         * testsuite/arm_fix_v4bx.s: New file.
9051         * testsuite/arm_fix_v4bx.sh: Ditto.
9052
9053 2010-02-24  Doug Kwan  <dougkwan@google.com>
9054
9055         * arm.cc (Target_arm::got_section): Make the .got section the first
9056         non RELRO section in the data segment.
9057         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9058         suffixes of section names.
9059
9060 2010-02-24  Doug Kwan  <dougkwan@google.com>
9061
9062         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9063         flags and attributes merging if an input file is a binary file.
9064         * fileread.cc (Input_file::open): Record format of original file.
9065         * fileread.h (Input_file::Format): New enum type.
9066         (Input_file::Input_file): Initialize data member format_.
9067         (Input_file::format): New method definition.
9068         (Input_file::format_):: New data member.
9069
9070 2010-02-24  Doug Kwan  <dougkwan@google.com>
9071
9072         * arm.cc (Arm_output_data_got): New class.
9073         (ARM_TCB_SIZE): New constant
9074         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9075         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9076         If user uses a script with a SECTIONS clause, issue only a warning
9077         for a misplaced EXIDX input section.  Otherwise, issue an error.
9078         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9079         garbage collection.
9080         (Target_arm::got_mode_index_entry): Handle static linking.
9081         (Target_arm::Scan::local): Ditto.
9082         (Target_arm::Scan::global): Ditto.
9083         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9084         all incorrectly implemented relocations.
9085         (Target_arm::fix_exidx_coverage): Pass layout to
9086         Arm_output_section::fix_exidx_coverage.
9087         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9088         from ".ARM.exidx." and ".ARM.extab.".
9089
9090 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9091
9092         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9093         section if it does not already exist.
9094         * attributes.cc (Attributes_section_data::Attributes_section_data):
9095         Don't crash if size is zero.
9096
9097 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9098             Ian Lance Taylor  <iant@google.com>
9099
9100         * gold.cc (queue_middle_tasks): If no input files were opened,
9101         exit.
9102         * workqueue.h (Task_function::Task_function): Assert that there is
9103         a blocker.
9104
9105 2010-02-22  Doug Kwan  <dougkwan@google.com>
9106
9107         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9108         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9109         types to avoid warnings due to different uint64_t implementations
9110         on different hosts.
9111
9112 2010-02-21  Doug Kwan  <dougkwan@google.com>
9113
9114         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9115         handling of the maximum backward branch offset.
9116         (Arm_relocate_functions::thumb_branch_common): Ditto.
9117         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9118         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9119         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9120         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9121         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9122         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9123         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9124         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9125         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9126         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9127         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9128         thumb2_bl_out_of_range.o): New rules.
9129         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9130         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9131         thumb2_bl_out_of_range
9132         * testsuite/Makefile.in: Regenerate.
9133         * testsuite/arm_bl_in_range.s: New file.
9134         * testsuite/arm_bl_out_of_range.s: Ditto.
9135         * testsuite/arm_branch_in_range.sh: Ditto.
9136         * testsuite/arm_branch_range.t: Ditto.
9137         * testsuite/thumb2_branch_range.t: Ditto.
9138         * testsuite/thumb_bl_in_range.s: Ditto.
9139         * testsuite/thumb_bl_out_of_range.s: Ditto.
9140         * testsuite/thumb_branch_range.t: Ditto.
9141
9142 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9143
9144         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9145         Add reloc offset information.
9146         * icf.cc (get_section_contents): Change iterators to point to the new
9147         vectors. Add reloc offset information to the contents.
9148         * icf.h (Icf::Sections_reachable_info): New typedef.
9149         (Icf::Sections_reachable_list): New typedef.
9150         (Icf::Offset_info): New typedef.
9151         (Icf::Reloc_info): New struct typedef.
9152         (Icf::Reloc_info_list): New typedef.
9153         (Icf::symbol_reloc_list): Delete method.
9154         (Icf::addend_reloc_list): Delete method.
9155         (Icf::section_reloc_list): Delete method.
9156         (Icf::reloc_info_list): New method.
9157         (Icf::reloc_info_list_): New member.
9158
9159 2010-02-19  Doug Kwan  <dougkwan@google.com>
9160
9161         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9162         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9163         * arm.cc (Arm_relocation_functions): New forward declaration.
9164         (Target_arm::Target_arm): Initialize new data members
9165         got_mod_index_offset_ and tls_base_symbol_defined_.
9166         (Target_arm::Relocate::relocate_tls): New method.
9167         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9168          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9169         New methods.
9170         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9171         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9172         (Target_arm::got_mod_index_offset_,
9173         Target_arm::tls_base_symbol_defined_): New data members.
9174         (Target_arm::Scan::local, Target::Scan::global,
9175         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9176         relocations.
9177
9178 2010-02-18  Doug Kwan  <dougkwan@google.com>
9179
9180         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9181         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9182         text section as a parameter becuase some broken tools may not set
9183         the link in section header.
9184         (Target_arm::has_got_section): New method.
9185         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9186         without any mapping symbol as data only.  Remove warning.
9187         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9188         link in its section header, try to discover the link by inspecting the
9189         REL31 relocation at the beginning of the section.
9190         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9191         in error message.
9192         (Target_arm::Scan::global): Treat any reference to the symbol
9193         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9194
9195 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9196
9197         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9198         (Scan::global_reloc_may_be_function_pointer): New function.
9199         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9200         (Scan::global_reloc_may_be_function_pointer): New function.
9201         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9202         (Scan::global_reloc_may_be_function_pointer): New function.
9203         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9204         (Scan::global_reloc_may_be_function_pointer): New function.
9205         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9206         (Scan::global_reloc_may_be_function_pointer): New function.
9207         (Scan::possible_function_pointer_reloc): New function.
9208         (Target_x86_64::can_check_for_function_pointers): New function.
9209         * gc.h (gc_process_relocs): Scan relocation types to determine if
9210         function pointers were taken for targets that support it.
9211         * icf.cc (Icf::find_identical_sections): Include functions for
9212         folding in safe ICF whose pointer is not taken.
9213         * icf.h (Secn_fptr_taken_set): New typedef.
9214         (fptr_section_id_): New member.
9215         (section_has_function_pointers): New function.
9216         (set_section_has_function_pointers): New function.
9217         (check_section_for_function_pointers): New function.
9218         * options.h: Fix comment for safe ICF option.
9219         * target.h (can_check_for_function_pointers): New function.
9220         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9221         Modify icf_safe_test for X86-64.
9222         * testsuite/Makefile.in: Regenerate.
9223         * testsuite/icf_safe_so_test.cc: New file.
9224         * testsuite/icf_safe_so_test.sh: New file.
9225         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9226         (main): Change to take pointer to function kept_func_3.
9227         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9228         folding is done correctly for X86-64.
9229
9230 2010-02-12  David S. Miller  <davem@davemloft.net>
9231
9232         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9233         is_symbolless parameter.
9234         (Output_reloc<SHT_REL>::is_symbolless): New.
9235         (Output_reloc<SHT_REL>::is_symbolless_): New.
9236         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9237         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9238         (Output_reloc<SHT_RELA>::is_symbolless): New.
9239         (Output_data_reloc::add_global): Handle is_symbolless.
9240         (Output_data_reloc::add_global_relative): Likewise.
9241         (Output_data_reloc::add_local): Likewise.
9242         (Output_data_reloc::add_local_relative): Likewise.
9243         (Output_data_reloc::add_symbolless_global_addend): New.
9244         (Output_data_reloc::add_symbolless_local_addend): New.
9245         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9246         is_symbolless.
9247         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9248         instead of ->is_relative_
9249         (Output_reloc::write): Likewise.
9250         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9251         (Output_reloc::write_rel): Simplify.
9252
9253         * sparc.cc (Target_sparc::Scan::local): Use
9254         ->add_symbolless_local_addend as needed.
9255         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9256         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9257         based upon relocation offset.
9258
9259 2010-02-11  Doug Kwan  <dougkwan@google.com>
9260
9261         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9262         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9263         beginning of function.
9264         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9265         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9266         parameter is_32bit in calls to should_apply_static_reloc.
9267         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9268         (check_DATA): Add arm_abs_global.stdout.
9269         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9270         arm_abs_global.stdout): New rules.
9271         (MOSTLLYCLEANFILES): Add arm_abs_global
9272         * Makefile.in: Regenerate.
9273         * testsuite/arm_abs_global.s: New file.
9274         * testsuite/arm_abs_global.sh: Ditto.
9275         * testsuite/arm_abs_lib.s: Ditto.
9276
9277 2010-02-11  Ian Lance Taylor  <iant@google.com>
9278
9279         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9280         Read_relocs task.
9281         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9282         Allocate_commons_task first.
9283         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9284         task, rather than symtab_lock_.
9285         (Gc_process_relocs::~Gc_process_relocs): New function.
9286         (Gc_process_relocs::is_runnable): Check this_blocker_.
9287         (Gc_process_relocs::locks): Use next_blocker_ rather than
9288         blocker_.
9289         (Scan_relocs::~Scan_relocs): New function.
9290         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9291         symtab_lock_.
9292         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9293         next_blocker_.
9294         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9295         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9296         constructor accordingly.
9297         (class Gc_process_relocs): Likewise.
9298         (class Scan_relocs): Likewise.
9299         * common.h (class Allocate_commons_task): Remove symtab_lock_
9300         field, and corresponding constructor parameter.
9301         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9302         symtab_lock_.
9303         (Allocate_commons_task::locks): Likewise.
9304
9305 2010-02-11  Ian Lance Taylor  <iant@google.com>
9306
9307         * gold-threads.h (class Once): Define.
9308         (class Initialize_lock): Rewrite as child of Once.
9309         * gold-threads.cc (class Once_initialize): Define.
9310         (once_pointer_control): New static variable.
9311         (once_pointer, once_arg): New static variables.
9312         (c_run_once): New static function.
9313         (Once::Once, Once::run_once, Once::internal_run): New functions.
9314         (class Initialize_lock_once): Remove.
9315         (initialize_lock_control): Remove.
9316         (initialize_lock_pointer): Remove.
9317         (initialize_lock_once): Remove.
9318         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9319         (Initialize_lock::initialize): Rewrite.
9320         (Initialize_lock::do_run_once): New function.
9321         * archive.cc (Archive::interpret_header): Only clear name if it is
9322         not already empty.
9323         * fileread.cc: Include "gold-threads.h"
9324         (file_counts_lock): New static variable.
9325         (file_counts_initialize_lock): Likewise.
9326         (File_read::release): Only increment counts when using --stats.
9327         Use a lock around the increment.
9328         * parameters.cc (class Set_parameters_target_once): Define.
9329         (set_parameters_target_once): New static variable.
9330         (Parameters::Parameters): Move here from parameters.h.
9331         (Parameters::set_target): Rewrite.
9332         (Parameters::set_target_once): New function.
9333         (Parameters::clear_target): Move here and rewrite.
9334         * parameters.h (class Parameters): Update declarations.  Add
9335         set_parameters_target_once_ field.
9336         (Parameters::Parameters): Move to parameters.cc.
9337         (Parameters::clear_target): Likewise.
9338         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9339         task.
9340         (Start_group::~Start_group): New function.
9341         (Start_group::is_runnable): New function.
9342         (Start_group::locks, Start_group::run): New functions.
9343         (Finish_group::run): Change saw_undefined to size_t.
9344         * readsyms.h (class Start_group): Define.
9345         (class Finish_group): Change saw_undefined_ field to size_t.
9346         (Finish_group::Finish_group): Remove saw_undefined and
9347         this_blocker parameters.  Change all callers.
9348         (Finish_group::set_saw_undefined): New function.
9349         (Finish_group::set_blocker): New function.
9350         * symtab.h (class Symbol_table): Change saw_undefined to return
9351         size_t.  Change saw_undefined_ field to size_t.
9352         * target-select.cc (Set_target_once::do_run_once): New function.
9353         (Target_selector::Target_selector): Initialize set_target_once_
9354         field.  Don't initialize lock_ and initialize_lock_ fields.
9355         (Target_selector::instantiate_target): Rewrite.
9356         (Target_selector::set_target): New function.
9357         * target-select.h (class Set_target_once): Define.
9358         (class Target_selector): Update declarations.  Make
9359         Set_target_once a friend.  Remove lock_ and initialize_lock_
9360         fields.  Add set_target_once_ field.
9361
9362 2010-02-10  Ian Lance Taylor  <iant@google.com>
9363
9364         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9365         queueing any tasks.
9366         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9367         (queue_middle_tasks): Add all blockers before queueing any tasks.
9368         (queue_final_tasks): Likewise.
9369         * token.h (Task_token::add_blockers): New function.
9370         * object.h (Input_objects::number_of_relobjs): New function.
9371
9372 2010-02-10  Ian Lance Taylor  <iant@google.com>
9373
9374         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9375         shared, not if not position independent.
9376         * x86_64.cc (Relocate::relocate_tls): Likewise.
9377         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9378         (tls_pie_pic_test): New target.
9379         * testsuite/Makefile.in: Rebuild.
9380
9381         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9382         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9383         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9384         * testsuite/Makefile.in: Rebuild.
9385
9386 2010-02-09  David S. Miller  <davem@davemloft.net>
9387
9388         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9389         R_SPARC_RELATIVE using ->add_local_relative().
9390         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9391
9392         * output.h (Output_data_dynamic::add_section_size): New method
9393         that takes two Output_data objects.
9394         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9395         entry param.  Handle it in initializers.
9396         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9397         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9398         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9399         arg.
9400         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9401         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9402         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9403         for dynrel_includes_plt.
9404         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9405         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9406         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9407         before .rela.plt
9408         (Target_sparc::do_finalize_sections): Update to pass true for
9409         dynrel_includes_plt.
9410         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9411         output before .rela.plt
9412         (Target_powerpc::do_finalize_sections): Update to pass true for
9413         dynrel_includes_plt when 32-bit.
9414
9415 2010-02-08  Doug Kwan  <dougkwan@google.com>
9416
9417         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9418         method.
9419         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9420         Arm_relobj::scan_section_for_cortex_a8_stubs,
9421         Arm_relobj::do_relocation_section): Instead of calling
9422         Output_section::output_address, use faster
9423         Arm_relobj::simple_input_section_output_address.
9424
9425 2010-02-08  David S. Miller  <davem@davemloft.net>
9426
9427         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9428         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9429         relocation helper function.
9430
9431         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9432         just like R_SPARC_GOT{10,13,22}.
9433         (Target_sparc::Scan::local): Likewise.
9434         (Target_sparc::Relocate:relocate): Likewise.
9435
9436 2010-02-06  Ian Lance Taylor  <iant@google.com>
9437
9438         * configure.ac: Rewrite targetobjs duplicate removal code to use
9439         only shell constructs.
9440         * configure: Rebuild.
9441
9442 2010-02-05  Doug Kwan  <dougkwan@google.com>
9443
9444         PR 11247
9445         * arm.cc (Arm_relobj::section_is_scannable): New method.
9446         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9447         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9448
9449 2010-02-04  Doug Kwan  <dougkwan@google.com>
9450
9451         PR 11247
9452         * arm-reloc-property.cc (cstdio): Include.
9453         * configure.ac (targetobjs): Remove duplicates.
9454         * configure: Regenerate.
9455         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9456         big and little endian version for a given address size.
9457
9458 2010-02-03  Doug Kwan  <dougkwan@google.com>
9459
9460         * arm-reloc-property.cc
9461         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9462         definition.
9463         * arm-reloc-property.h
9464         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9465         New method definition.
9466         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9467         declaration.
9468         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9469         overflow to N.
9470         (GOT_PREL): Change implemented to Y.
9471         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9472         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9473         (Arm_relocate_functions::movw_abs_nc): Remove method.
9474         (Arm_relocate_functions::movt_abs): Ditto.
9475         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9476         (Arm_relocate_functions::thm_movt_abs): Ditto.
9477         (Arm_relocate_functions::movw_rel_nc): Ditto.
9478         (Arm_relocate_functions::movw_rel): Ditto.
9479         (Arm_relocate_functions::movt_rel): Ditto.
9480         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9481         (Arm_relocate_functions:thm_movw_rel): Ditto.
9482         (Arm_relocate_functions:thm_movt_rel): Ditto.
9483         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9484         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9485         New method definitions.
9486         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9487         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9488         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9489         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9490         (Target_arm::Relocate::relocate): Check for non-static or
9491         unimplemented relocation code and exit early.  Change calls to
9492         Target_arm::reloc_uses_thumb_bit and
9493         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9494         instead.  Refactor code to handle similar relocations to increase
9495         code sharing.  Remove check for unsupported relocation code in switch
9496         statement.
9497         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9498         relocation property table to find out size.  Change error message to
9499         print out the name of a relocation code instead of the numeric value.
9500         (Target_arm::scan_reloc_for_stub): Use relocation property table
9501         instead of calling Target_arm::reloc_uses_thumb_bit().
9502
9503 2010-02-02  Doug Kwan  <dougkwan@google.com>
9504
9505         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9506         types of relaxed input section.
9507
9508 2010-02-02  Doug Kwan  <dougkwan@google.com>
9509
9510         * Makefile.am (HFILES): Add arm-reloc-property.h.
9511         (DEFFILES): New.
9512         (TARGETSOURCES): Add arm-reloc-property.cc
9513         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9514         (libgold_a_SOURCES): $(DEFFILES)
9515         * Makefile.in: Regenerate.
9516         * arm-reloc-property.cc: New file.
9517         * arm-reloc-property.h: New file.
9518         * arm-reloc.def: New file.
9519         * arm.cc: Update comments.
9520         (arm-reloc-property.h): New included header.
9521         (arm_reloc_property_table): New global variable.
9522         (Target_arm::do_select_as_default_target): New method definition.
9523         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9524         arm-reloc-property to targ_extra_obj.
9525         * parameters.cc (set_parameters_target): Call
9526         Target::select_as_default_target().
9527         * target.h (Target::select_as_default_target): New method definition.
9528         (Target::do_select_as_default_target): Same.
9529
9530 2010-02-01  Doug Kwan  <dougkwan@google.com>
9531
9532         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9533         first_output_text_section_.
9534         (Arm_exidx_fixup::first_output_text_section): New method definition.
9535         (Arm_exidx_fixup::first_output_text_section_): New data member.
9536         (Arm_exidx_fixup::process_exidx_section): Record the first text
9537         output section seen.
9538         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9539         and entsize in output section header.
9540
9541 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9542
9543         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9544         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9545         (Arm_relocate_functions::thm_alu11): New Method.
9546         (Arm_relocate_functions::thm_pc8): New Method.
9547         (Arm_relocate_functions::thm_pc12): New Method.
9548         (Target_arm::Scan::local): Handle the relocations.
9549         (Target_arm::Scan::global): Likewise.
9550         (Target_arm::Relocate::relocate): Likewise.
9551         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9552
9553 2010-01-29  Doug Kwan  <dougkwan@google.com>
9554
9555         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9556         of relocation types as ld.
9557
9558 2010-01-29  Doug Kwan  <dougkwan@google.com>
9559
9560         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9561         to public.
9562         (Arm_relocate_functions::thumb_branch_common): Ditto.
9563         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9564         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9565         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9566         Arm_relocate_functions::jump24): Remove.
9567         (Target_arm::Relocate::relocate): Adjust code to call
9568         Arm_relocation_functions::arm_branch_common and
9569         Arm_relocation_functions::thumb_branch_common instead of their removed
9570         wrappers.  Merge switch-cases together to reduce source code size.
9571
9572 2010-01-29  Doug Kwan  <dougkwan@google.com>
9573
9574         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9575         output_local_symbol_count_needs_update_.
9576         (Arm_relobj::output_local_symbol_count_needs_update,
9577          Arm_relobj::set_output_local_symbol_count_needs_update,
9578          Arm_relobj::update_output_local_symbol_count): New methods.
9579         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9580         member.
9581         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9582         of pointed function as in a R_ARM_PREL31 relocation.
9583         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9584         for output local symbol count updating.
9585         (Target_arm::do_relax): Update output local symbol counts in objects
9586         if necessary.
9587         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9588
9589 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9590
9591         * arm.cc: Added support for the ARM relocations:
9592         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9593         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9594         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9595         movw_prel_nc).
9596         (Arm_relocate_functions::movw_rel): New method.
9597         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9598         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9599         thm_movw_prel_nc).
9600         (Arm_relocate_functions::thm_movw_rel): New method.
9601         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9602         thm_movt_prel).
9603         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9604         relocations.
9605         (Target_arm::Scan::global): Likewise.
9606         (Target_arm::Relocate::relocate): Likewise.
9607         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9608         Likewise.
9609
9610 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9611
9612         * arm.cc: Added support for ARM group relocations.
9613         (Target_arm::reloc_needs_sym_origin): New method.
9614         (Arm_relocate_functions::calc_grp_kn): New method.
9615         (Arm_relocate_functions::calc_grp_residual): New method.
9616         (Arm_relocate_functions::calc_grp_gn): New method.
9617         (Arm_relocate_functions::arm_grp_alu): New Method.
9618         (Arm_relocate_functions::arm_grp_ldr): New Method.
9619         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9620         (Arm_relocate_functions::arm_grp_ldc): New Method.
9621         (Target_arm::Scan::local): Handle the ARM group relocations.
9622         (Target_arm::Scan::global): Likewise.
9623         (Target_arm::Relocate::relocate): Likewise.
9624         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9625         Likewise.
9626
9627 2010-01-26  Doug Kwan  <dougkwan@google.com>
9628
9629         * arm.cc (set): Include.
9630         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9631         pointer type.
9632         (Arm_output_section::Text_section_list): New type.
9633         (Arm_output_section::append_text_sections_to_list): New method.
9634         (Arm_output_section::fix_exidx_coverage): Ditto.
9635         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9636         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9637         Relobj::set_section_offset() instead of
9638         Sized_relobj::invalidate_section_offset().
9639         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9640         parameter for section headers. Ignore relocation sections for
9641         unallocated sections and EXIDX sections.
9642         (Target_arm::fix_exidx_coverage): New method.
9643         (Target_arm::output_section_address_less_than): New type.
9644         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9645         linked text section instead of the EXIDX section.
9646         (Arm_output_section::create_stub_group): Add an assertion to check
9647         that this is not an EXIDX output section.
9648         (Arm_output_section::append_text_sections_to_list): New method.
9649         (Arm_output_section::fix_exidx_coverage): Ditto.
9650         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9651         Arm_relobj::section_needs_reloc_stub_scanning.
9652         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9653         first pass.
9654         (Target_arm::fix_exidx_coverage): New method.
9655         * object.h (Relobj::set_output_section): New method.
9656         (Sized_relobj::invalidate_section_offset): Remove method.
9657         (Sized_relobj::do_invalidate_section_offset): Remove method.
9658         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9659
9660 2010-01-25  Doug Kwan  <dougkwan@google.com>
9661
9662         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9663         Fix warning due to signed and unsigned comparison on a 32-bit host.
9664
9665 2010-01-22  Doug Kwan  <dougkwan@google.com>
9666
9667         * arm.cc (Target_arm::do_relax): Record an output section for section
9668         offset adjustment it contains any stub table that has changed.
9669         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9670         offsets in an output section if necessary.
9671         * output.cc (Output_section::Output_section): Initialize
9672         section_offsets_need_adjustments_.
9673         (Output_section::add_input_section_for_script): Renamed to
9674         Output_section::add_simple_input_section.
9675         (Output_section::save_states): Add a comment.
9676         (Output_section::discard_states): New method defintion.
9677         (Output_section::adjust_section_offsets): Same.
9678         * output.h (Output_section::add_input_section_for_script): Renamed to
9679         Output_section::add_simple_input_section.
9680         (Output_section::discard_states): New method declaration.
9681         (Output_section::adjust_section_offsets): Same.
9682         (Output_section::section_offsets_need_adjustment,
9683         Output_section::set_section_offsets_need_adjustment): New method
9684         definitions.
9685         (Output_section::section_offsets_need_adjustment_): New data member.
9686         * script-sections.cc
9687         (Output_section_element_input::set_section_address): Adjust code for
9688         renaming of Output_section::add_input_section_for_script.
9689         (Orphan_output_section::set_section_address): Same.
9690
9691 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9692
9693         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9694         Fix_v4bx enum values .
9695         * gold/options.h (General_options): New option definitions.
9696         (General_options::fix_v4bx): New method.
9697         (General_options::Fix_v4bx): New enum.
9698         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9699         (General_options::parse_fix_v4bx_interworking): New method.
9700
9701 2010-01-22  Doug Kwan  <dougkwan@google.com>
9702
9703         * arm.cc (Arm_exidx_fixup): New class.
9704
9705 2010-01-21  Doug Kwan  <dougkwan@google.com>
9706
9707         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9708         classes.
9709         (Arm_exidx_section_offset_map): New type.
9710
9711 2010-01-21  Doug Kwan  <dougkwan@google.com>
9712
9713         * arm.cc (Arm_exidx_input_section): New class.
9714         (Arm_relobj::exidx_input_section_by_link,
9715         Arm_relobj::exidx_input_section_by_shndx,
9716         Arm_relobj::make_exidx_input_section): New methods.
9717         (read_arm_attributes_section): Remove.
9718         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9719         information about them.
9720         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9721         to here.
9722
9723 2010-01-20  Doug Kwan  <dougkwan@google.com>
9724
9725         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9726         Input_section_specifier to Section_id.
9727         (Target_arm::new_arm_input_section: Adjust code for change of key
9728         type.
9729         (Target_arm::find_arm_input_section): Ditto.
9730         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9731         (Section_id): Remove.
9732         (Garbage_collection::Section_id_hash): Remove.
9733         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9734         (Section_id): Remove.
9735         (Icf::Section_id_hash): Remove.
9736         * object.h (Section_id, Const_section_id, Section_id_hash,
9737         Const_section_id_hash): New type definitions.
9738         * output.cc (Output_section::add_relaxed_input_section): Change to
9739         use Const_section_id instead of Input_section_specifier as key type.
9740         (Output_section::add_merge_input_section): Ditto.
9741         (Output_section::build_relaxation_map): Change to use Section_id
9742         instead of Input_section_specifier as key type.
9743         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9744         Ditto.
9745         (Output_section::convert_input_sections_to_relaxed_sections): Change
9746         to use Const_section_id instead of Input_section_specifier as key type.
9747         (Output_section::find_merge_section): Ditto.
9748         (Output_section::find_relaxed_input_section): Ditto.
9749         * output.h (Input_section_specifier): Remove class.
9750         (Output_section::Output_section_data_by_input_section_map): Change
9751         key type to Const_section_id.
9752         (Output_section::Output_relaxed_input_section_by_input_section_map):
9753         Ditto.
9754         (Output_section::Relaxation_map): Change key type to Section_id.
9755
9756 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9757
9758         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9759         (class Arm_v4bx_stub): New class.
9760         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9761         (Stub_factory::make_arm_v4bx_stub): New method.
9762         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9763         (Stub_table::empty): Handle v4bx stubs.
9764         (Stub_table::add_arm_v4bx_stub): New method.
9765         (Stub_table::find_arm_v4bx_stub): New method.
9766         (Arm_relocate_functions::v4bx): New method.
9767         (Target_arm::fix_v4bx): New method.
9768         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9769         (Stub_table::relocate_stubs): Likewise.
9770         (Stub_table::do_write): Likewise.
9771         (Stub_table::update_data_size_and_addralign): Likewise.
9772         (Stub_table::finalize_stubs):  Likewise.
9773         (Target_arm::Scan::local): Likewise.
9774         (Target_arm::Scan::global): Likewise.
9775         (Target_arm::do_finalize_sections): Likewise.
9776         (Target_arm::Relocate::relocate): Likewise.
9777         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9778         Likewise.
9779         (Target_arm::scan_reloc_for_stub): Likewise.
9780         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9781
9782 2010-01-19  Ian Lance Taylor  <iant@google.com>
9783
9784         * output.cc (Output_section_headers::do_sized_write): Write large
9785         segment count to sh_info field.
9786         (Output_file_header::do_sized_write): For large segment count,
9787         write PN_XNUM to e_phnum field.
9788
9789 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9790
9791         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9792         (Arm_relocate_functions::thm_jump8): New function.
9793         (Arm_relocate_functions::thm_jump11): New function.
9794         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9795         R_ARM_THM_JUMP11.
9796         (Target_arm::Scan::global): Likewise.
9797         (Target_arm::Relocate::relocate): Likewise.
9798         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9799         Likewise.
9800
9801 2010-01-14  Doug Kwan  <dougkwan@google.com>
9802
9803         * arm.cc (map, utility): Include headers.
9804         (Target_arm::apply_cortex_a8_workaround): New method.
9805         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9806         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9807         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9808         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9809         the --[no-]fix-cortex-a8 command line options.
9810         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9811         (Target_arm::relocate_stub): Use addend in instruction template.
9812         * options.h (DEFINE_bool): Set the user-set flag.
9813         (General_options): Add --[no-]-fix-cortex options.
9814         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9815         : Update fast look-up map after conversion.
9816
9817 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9818
9819         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9820         in the first pass of do_layout.
9821
9822 2010-01-13  Doug Kwan  <dougkwan@google.com>
9823
9824         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9825         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9826         apparent compiler problem of not folding static constant integral
9827         data members of elfcpp::Elf_sizes<32>.
9828
9829 2010-01-13  Doug Kwan  <dougkwan@google.com>
9830
9831         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9832         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9833         Arm_relobj::scan_section_for_cortex_a8_erratum,
9834         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9835         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9836         sections to scan for relocation stubs into a new method
9837         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9838         relocation and Cortex-A8 stub scanning.
9839         (Target_arm::do_relax): Force stubs to be after stubbed sections
9840         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9841         the beginning of a new relaxation pass.  Update a comment.
9842         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9843
9844 2010-01-12  Ian Lance Taylor  <iant@google.com>
9845
9846         * target-reloc.h (visibility_error): New inline function.
9847         (relocate_section): Call visibility_error.
9848         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9849         (MOSTLYCLEANFILES): Likewise.
9850         (protected_4_pic.o, protected_3.err): New targets.
9851         * testsuite/protected_4.cc: New file.
9852
9853 2010-01-12  Doug Kwan  <dougkwan@google.com>
9854
9855         * arm.cc (Cortex_a8_reloc): New class.
9856         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9857         and cortex_a8_relocs_info_.
9858         (Target_arm::fix_cortex_a8): New method definition.
9859         (Target_arm::Cortex_a8_relocs_info): New type.
9860         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9861         New data member declarations.
9862         (Target_arm::scan_reloc_for_stub): Record information about
9863         relocations for THUMB branches that might be exempted from the
9864         Cortex-A8 workaround.
9865         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9866         at the beginning of a relaxation pass.
9867
9868 2010-01-12  Doug Kwan  <dougkwan@google.com>
9869
9870         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9871         (Arm_relobj::Mapping_symbol_position,
9872          Arm_reloj::Mapping_symbol_position_less,
9873          Arm_relobj::Mapping_symbols_info): New types.
9874         (Target_arm::is_mapping_symbol_name): New method definition.
9875         (Arm_relobj::do_count_local_symbols): Save information about mapping
9876         symbols.
9877
9878 2010-01-11  Doug Kwan  <dougkwan@google.com>
9879
9880         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9881         Arm_relocate_functions::thumb32_branch_upper,
9882         Arm_relocate_functions::thumb32_branch_lower,
9883         Arm_relocate_functions::thumb32_cond_branch_offset,
9884         Arm_relocate_functions::thumb32_cond_branch_upper,
9885         Arm_relocate_functions::thumb32_cond_branch_lower,
9886         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9887         branch offset encoding.
9888         (Arm_relocate_functions::thumb_branch_common): Use new branch
9889         offset encoding methods to avoid code duplication.
9890         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9891         (Stub_addend_reader::operator()): Use new branch encoding method
9892         to avoid code duplication.
9893
9894 2010-01-11  Doug Kwan  <dougkwan@google.com>
9895
9896         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9897         (Target_arm::do_finalize_sections): Define special EXIDX section
9898         symbols only if referenced.
9899         * gc.h (Garbage_collection::add_reference): New method.
9900         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9901         code duplication.
9902
9903 2010-01-11  Ian Lance Taylor  <iant@google.com>
9904
9905         * script.cc (Version_script_info::build_expression_list_lookup):
9906         Change complaing about duplicate wildcard match from error to
9907         warning.
9908
9909         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9910         of 2009-12-30.
9911         (Version_script_info::Version_script_info): Initialize globs_,
9912         default_version_, default_is_global_, and exact_.  Don't
9913         initialize globals_ or locals_.
9914         (Version_script_info::build_lookup_tables): Build local symbols
9915         first.
9916         (Version_script_info::unquote): New function.
9917         (Version_script_info::add_exact_match): New function.
9918         (Version_script_info::build_expression_list_lookup): Remove lookup
9919         parameter.  Add is_global parameter.  Change all callers.  Handle
9920         wildcard pattern specially.  Unquote pattern.  Call
9921         add_exact_match.
9922         (Version_script_info::get_name_to_match): New function.
9923         (Version_script_info::get_symbol_version): New function.
9924         (Version_script_info::get_symbol_version_helper): Remove.
9925         (Version_script_info::check_unmatched_names): Call unquote.
9926         * script.h (class Version_script_info): Change get_symbol_version
9927         to be non-inline and add is_global parameter; change all callers.
9928         Rewrite symbol_is_local.  Update declarations.  Define struct
9929         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9930         Remove globals_ and locals_ members.  Add exact_, globs_,
9931         default_version_, is_global_.
9932         (Version_script_info::Glob): Remove pattern, add expression and
9933         is_global.  Update constructor.  Change all callers.
9934         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9935         default version.
9936         (Versions::symbol_section_contents): If a symbol is undefined, or
9937         defined in a dynamic object, set the version index to
9938         VER_NDX_LOCAL.
9939         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9940         symbol_is_local.
9941         (Symbol_table::add_from_pluginobj): Likewise.
9942         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9943
9944 2010-01-11  Doug Kwan  <dougkwan@google.com>
9945
9946         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9947         (incremental_dump_LDADD): Add linking option for libintl.
9948         * Makefile.in: Regenerate.
9949
9950 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9951
9952         PR gold/11144
9953         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9954         instead of -Ds.
9955         * testsuite/Makefile.in: Regenerated.
9956
9957 2010-01-10  Doug Kwan  <dougkwan@google.com>
9958
9959         * options.h (DEFINE_var): Use parentheses around argument varname__
9960         in macro body to avoid any unintended subsequent substitutions.
9961
9962 2010-01-10  Ian Lance Taylor  <iant@google.com>
9963
9964         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9965         candidates before doing symbol resolution.
9966
9967         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9968         ODR candidates if only one is weak.
9969
9970 2010-01-08  Ian Lance Taylor  <iant@google.com>
9971
9972         * script.cc (Version_script_info::build_expression_list_lookup):
9973         Don't warn about ambiguous version, just record the ambiguity.
9974         (Version_script_info::get_symbol_version_helper): Give error if
9975         version is ambiguous.
9976
9977 2010-01-08  Doug Kwan  <dougkwan@google.com>
9978
9979         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9980         prev_data_size_ and prev_addralign_.  Remove initializer for
9981         deleted data member has_been_changed_.
9982         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9983         to determine if the table is empty.
9984         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9985         Remove.
9986         (Stub_table::add_reloc_stub): Define method in class definition
9987         instead of just declaring it there.
9988         (Stub_table::add_cortex_a8_stub): New method definition.
9989         (Stub_table::update_data_size_and_addralign): Ditto.
9990         (Stub_table::finalize_stubs): Ditto.
9991         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9992         (Stub_table::do_addralign_): Return address alignment in the
9993         (Stub_table::do_reset_address_and_file_offset): Define method in
9994         class definition instead of declaring it there.  Set current data
9995         size to be the data size of the previous pass.
9996         (Stub_table::set_final_data_size): Use current data size as the
9997         final data size.
9998         (Stub_table::relocate_stub): Change parameter type of stub from
9999         Reloc_stub pointer to Stub pointer.
10000         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10001         (Stub_table::Cortex_a8_stub_list): New typedef.
10002         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10003          Stub_table::prev_addralign_): New data member.
10004         (Arm_relobj::Arm_relobj): Initialize data member
10005         section_has_cortex_a8_workaround_.
10006         (Arm_relobj::section_has_cortex_a8_workaround,
10007          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10008          definitions.
10009         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10010         declarations.
10011         (Target_arm::relocate_stub): Change parameter type of stub from
10012         Reloc_stub pointer to Stub pointer.
10013         (Insn_template::size, Insn_template::alignment): Handle
10014         THUMB16_SPECIAL_TYPE.
10015         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10016          Stub_table::update_data_size_and_addralign,
10017          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10018         definitions.
10019         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10020         (Stub_table::do_write): Ditto.
10021         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10022
10023 2010-01-08  Ian Lance Taylor  <iant@google.com>
10024
10025         PR 11108
10026         * symtab.h (class Symbol): Remove fields is_target_special_ and
10027         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10028         (Symbol::is_defined_in_discarded_section): New function.
10029         (Symbol::set_is_defined_in_discarded_section): New function.
10030         (Symbol::has_plt_offset): Rewrite.
10031         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10032         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10033         Don't initialize is_target_special_ or has_plt_offset_.
10034         Initialize is_defined_in_discarded_section_.
10035         (Symbol_table::add_from_relobj): If appropriate, set
10036         is_defined_in_discarded_section.
10037         * resolve.cc (Symbol::override_base_with_special): Don't test
10038         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10039         * target-reloc.h (relocate_section): Do special handling for
10040         symbols defined in discarded sections for global symbols as well
10041         as local symbols.
10042
10043 2010-01-08  Ian Lance Taylor  <iant@google.com>
10044
10045         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10046         the SHT_SYMTAB case.
10047
10048 2010-01-08  Ian Lance Taylor  <iant@google.com>
10049
10050         * object.cc (Sized_relobj::do_layout): Don't get confused if
10051         layout_eh_frame returns NULL.
10052
10053 2010-01-08  Ian Lance Taylor  <iant@google.com>
10054
10055         PR 11084
10056         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10057         dynamic symbol table, use the normal symbol table.
10058         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10059         symbol table.
10060
10061 2010-01-08  Ian Lance Taylor  <iant@google.com>
10062
10063         PR 11072
10064         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10065         sections.
10066
10067 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10068
10069         * version.cc (print_version): Change to "Copyright 2010".
10070
10071 2010-01-08  Ian Lance Taylor  <iant@google.com>
10072
10073         PR 10287
10074         PR 11063
10075         * i386.cc (class Target_i386): Change return type of plt_section
10076         to be non-const.
10077         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10078         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10079         tls_desc_rel_ field.
10080         (Output_data_plt_i386::rel_tls_desc): New function.
10081         (Target_i386::rel_tls_desc_section): New function.
10082         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10083         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10084         R_386_TLS_DESC reloc in rel_tls_desc_section.
10085         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10086         Define struct Tlsdesc_info.
10087         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10088         (Target_x86_64::do_reloc_symbol_index): New function.
10089         (Target_x86_64::add_tlsdesc_info): New function.
10090         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10091         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10092         tlsdesc_rel_ field.
10093         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10094         all callers.
10095         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10096         (Target_x86_64::rela_tlsdesc_section): New function.
10097         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10098         handling.
10099         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10100         (Target_x86_64::do_reloc_addend): New function.
10101         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10102         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10103         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10104         (Output_reloc::type): New function.
10105         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10106         (Output_reloc::is_target_specific): New function.
10107         (Output_reloc::target_arg): New function.
10108         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10109         absolute relocs and target specific relocs.
10110         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10111         add_target_specific.
10112         (class Output_data_reloc) [SHT_RELA]: Likewise.
10113         * output.cc (Output_reloc::Output_reloc): Add four new versions
10114         for absolute relocs and target specific relocs.
10115         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10116         (Output_reloc::get_symbol_index): Likewise.
10117         (Output_reloc::local_section_offset): Check that local_sym_index_
10118         is not TARGET_CODE or 0.
10119         (Output_reloc::symbol_value): Likewise.
10120         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10121         reloc.
10122         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10123         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10124         functions.
10125         * layout.cc (add_target_dynamic_tags): Use output section for
10126         DT_PLTRELSZ and DT_JMPREL.
10127
10128 2010-01-07  Ian Lance Taylor  <iant@google.com>
10129
10130         PR 11061
10131         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10132         function.
10133         (class Output_data_reloc_generic): Define.
10134         (class Output_data_reloc_base): Change base class to
10135         Output_data_reloc_generic.  Change add() method to call
10136         bump_relative_reloc_count for a relative reloc.  Remove
10137         sort_relocs_ field.
10138         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10139         to sort_relocs().
10140         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10141         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10142         appropriate.
10143         * layout.h (class Layout): Update declaration.
10144
10145 2010-01-07  Ian Lance Taylor  <iant@google.com>
10146
10147         * output.h (class Output_data): Add const version of
10148         output_section and do_output_section.
10149         (class Output_section_data): Add const version of
10150         do_output_section.
10151         (class Output_section): Likewise.
10152         * layout.cc (Layout::add_target_dynamic_tags): New function.
10153         * layout.h (class Layout): Update declarations.
10154         * arm.cc (Target_arm::do_finalize_sections): Use
10155         add_target_dynamic_tags.
10156         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10157         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10158         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10159         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10160
10161 2010-01-07  Ian Lance Taylor  <iant@google.com>
10162
10163         PR 11042
10164         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10165         object as needed.
10166
10167 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10168             Ian Lance Taylor  <iant@google.com>
10169
10170         PR 11019
10171         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10172         Xindex::read_symtab_xindex.
10173
10174 2010-01-07  Doug Kwan  <dougkwan@google.com>
10175
10176         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10177         (Insn_template::thumb16_bcond_insn): New method declaration.
10178         (Insn_template): Fix spelling.
10179         (Stub::thumb16_special): New method declaration.
10180         (Stub::do_write): Define virtual method which was previously pure
10181         virtual.
10182         (Stub::do_thumb16_special): New method declaration.
10183         (Stub::do_fixed_endian_write): New template member.
10184         (Reloc_stub::do_write): Remove.
10185         (Reloc_stub::do_fixed_endian_write): Remove.
10186         (Cortex_a8_stub): New class definition.
10187         (Stub_factory::make_cortex_a8_stub): New method definition.
10188         (Stub_factory::Stub_factory): Add missing static storage class
10189         qualifier for elf32_arm_stub_a8_veneer_blx.
10190
10191 2010-01-07  Ian Lance Taylor  <iant@google.com>
10192
10193         PR 10980
10194         * options.h (class General_options): Add --warn-unresolved-symbols
10195         and --error-unresolved-symbols.
10196         * errors.cc (Errors::undefined_symbol): Implement
10197         --warn-unresolved-symbols.
10198
10199         * options.h (class General_options): Add -z text and -z textoff.
10200         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10201
10202 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10203
10204         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10205         (Garbage_collection::cident_sections): New function.
10206         (Garbage_collection::add_cident_section): New function.
10207         (Garbage_collection::cident_sections_): New member.
10208         (gc_process_relocs): Add references to sections whose names are C
10209         identifiers.
10210         * gold.h (cident_section_start_prefix): New constant.
10211         (cident_section_stop_prefix): New constant.
10212         (is_cident): New function.
10213         * layout.cc (Layout::define_section_symbols): Replace string constants
10214         with the newly defined constants.
10215         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10216         C identifiers.
10217         * testsuite/Makefile.am: Add gc_orphan_section_test.
10218         * testsuite/Makefile.in: Regenerate.
10219         * testsuite/gc_orphan_section_test.cc: New file.
10220         * testsuite/gc_orphan_section_test.sh: New file.
10221
10222 2010-01-06  Ian Lance Taylor  <iant@google.com>
10223
10224         PR 10980
10225         * options.h (class General_options): Add --warn-shared-textrel.
10226         * layout.cc (Layout::finish_dynamic_section): Implement
10227         --warn-shared-textrel.
10228
10229         PR 10980
10230         * options.h (class General_options): Add --warn-multiple-gp.
10231
10232 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10233
10234         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10235         $(THREADSLIB) and $(LIBDL).
10236         * Makefile.in: Rebuild.
10237
10238 2010-01-06  Ian Lance Taylor  <iant@google.com>
10239
10240         PR 10980
10241         * options.cc (General_options::parse_section_start): New function.
10242         (General_options::section_start): New function.
10243         (General_options::General_options): Initialize all members.
10244         * options.h: Include <map>
10245         (class General_options): Add --section-start.  Add section_starts_
10246         member.
10247         * layout.cc (Layout::attach_allocated_section_to_segment): If
10248         --section-start was used, set the address of the segment.  Remove
10249         local sort_sections.
10250         (Layout::relaxation_loop_body): If the address of the load segment
10251         has been set by --section-start, don't use it.
10252         * output.h (Output_segment::update_flags_for_output_section): New
10253         function.
10254         * output.cc (Output_segment::add_output_section): Call
10255         update_flags_for_output_section.
10256
10257 2010-01-05  Ian Lance Taylor  <iant@google.com>
10258
10259         PR 10980
10260         * options.h (class General_options): Add --undefined-version.
10261         * script.cc (struct Version_expression): Add was_matched_by_symbol
10262         field.
10263         (Version_script_info::matched_symbol): New function.
10264         (Version_script_info::get_symbol_version_helper): Call
10265         matched_symbol.
10266         (Version_script_info::check_unmatched_names): New function.
10267         * script.h (class Version_script_info): Update declarations.
10268         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10269
10270         * options.h (class General_options): Use DEFINE_bool_alias for
10271         allow_multiple_definition.
10272         * resolve.cc (Symbol_table::should_override): Don't test
10273         allow_multiple_definition.
10274
10275         PR 10980
10276         * options.h (class General_options): Add --cref.
10277         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10278         until after printing cref table.
10279         * cref.cc: Include "symtab.h".
10280         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10281         (Cref_table_compare::operator()): New function.
10282         (Cref_inputs::gather_cref): New function.
10283         (filecol): New static const.
10284         (Cref_inputs::print_cref): New function.
10285         (Cref::print_cref): New function.
10286         * cref.h: Include <cstdio>.
10287         (class Cref): Update declarations.
10288         * mapfile.h (Mapfile::file): New function.
10289         * object.h (class Object): Define Symbols.  Declare virtual
10290         do_get_global_symbols.
10291         (Object::get_global_symbols): New function.
10292         * object.cc (Input_objects::add_object): Pass object to cref_ if
10293         --cref.
10294         (Input_objects::archive_start): Likewise.
10295         (Input_objects::archive_stop): Likewise.
10296         (Input_objects::print_cref): New function.
10297         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10298         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10299         --cref.
10300         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10301         function.
10302         * plugin.h (class Sized_pluginobj): Update declarations.
10303
10304 2010-01-05  Ian Lance Taylor  <iant@google.com>
10305
10306         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10307         to is_default_version.  Rename insdef to insdefault.
10308         (Symbol_table::add_from_relobj): Rename def to is_default_version
10309         and local to is_forced_local.
10310         (Symbol_table::add_from_pluginobj): Likewise.
10311         (Symbol_table::add_from_dynobj): Likewise.
10312         (Symbol_table::define_special_symbol): Rename insdef to
10313         insdefault.
10314
10315 2010-01-04  Ian Lance Taylor  <iant@google.com>
10316
10317         PR 10980
10318         * options.h (class General_options): Add
10319         --allow-multiple-definition and -z muldefs.
10320         * resolve.cc (Symbol_table::should_override): Don't warn about a
10321         multiple symbol definition if --allow-multiple-definition or -z
10322         muldefs.
10323
10324         PR 10980
10325         * options.h (class General_options): Add --add-needed and
10326         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10327         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10328         error if --copy-dt-needed-entries aka --add-needed is used and
10329         would cause a change in behaviour.
10330
10331         PR 10980
10332         * options.h (class General_options): Add -G as a short version of
10333         --shared.  Add no-op options -assert, -g, and -i.
10334
10335 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10336
10337         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10338         check for .text or .gnu.linkonce.t sections.
10339         * icf.cc (Icf::find_identical_sections): Ditto.
10340         Change the detection for mangled function name within the section
10341         name.
10342         * icf.h (is_section_foldable_candidate): New function.
10343
10344 2009-12-30  Ian Lance Taylor  <iant@google.com>
10345
10346         PR 10980
10347         * options.h (class General_options): Permit two dashes with
10348         --retain-symbols-file.
10349
10350 2009-12-30  Ian Lance Taylor  <iant@google.com>
10351
10352         PR 10979
10353         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10354         don't put the file header and segment headers in the text
10355         segment.
10356
10357         PR 10979
10358         * common.cc (Sort_commons::operator()): Stabilize sort when both
10359         entries are NULL.
10360         (Symbol_table::do_allocate_commons_list): When allocating common
10361         symbols, skip a symbol which is no longer common.
10362         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10363         an object before checking its type.
10364         * testsuite/common_test_2.c: New file.
10365         * testsuite/common_test_3.c: New file.
10366         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10367         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10368         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10369         (common_test_2_pic.o, common_test_2.so): New targets.
10370         (common_test_3_pic.o, common_test_3.so): New targets.
10371         * testsuite/Makefile.in: Rebuild.
10372
10373         PR 10979
10374         * script.cc (read_input_script): If we see a new SECTIONS clause,
10375         and we have added an input section, give an error.
10376         * layout.h (class Layout): Add have_added_input_section function.
10377         Add have_added_input_section_ field.
10378         * layout.cc (Layout::Layout): Initialize
10379         have_added_input_section_.
10380         (Layout::layout): Set have_added_input_section_.
10381         (Layout::layout_eh_frame): Likewise.
10382
10383 2009-12-30  Ian Lance Taylor  <iant@google.com>
10384
10385         PR 10931
10386         * options.h (class General_options): Add --sort-common option.
10387         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10388         * common.cc (Sort_common): Add sort_order parameter to
10389         constructor.  Add sort_order_ field.
10390         (Sort_commons::operator): Check sort_order_.
10391         (Symbol_table::allocate_commons): Determine the sort order.
10392         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10393         Change all callers.
10394         (Symbol_table::do_allocate_commons_list): Likewise.
10395
10396 2009-12-30  Ian Lance Taylor  <iant@google.com>
10397
10398         PR 10916
10399         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10400         symbols from this object, don't change the visibility of an
10401         undefined symbol.
10402         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10403
10404 2009-12-30  Ian Lance Taylor  <iant@google.com>
10405
10406         PR 10861
10407         * script.h (class Version_script_info): Define Language enum.
10408         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10409         new fields globals_, locals_, and is_finalized_.
10410         * script.cc: Various formatting fixes.
10411         (class Parser_closure): Change language_stack_ from a vector of
10412         std::string to one of Version_script_info::Language.  Adjust all
10413         uses accordingly.
10414         (class Lazy_demangler): Remove.
10415         (struct Version_expression): Change language from std::string to
10416         Version_script_info::Language.
10417         (Version_script_info::Version_script_info): New function.
10418         (Version_script_info::~Version_script_info): Don't call clear.
10419         (Version_script_info::finalize): New function.
10420         (Version_script_info::build_lookup_tables): New function.
10421         (Version_script_info::build_expression_list_lookup): New
10422         function.
10423         (Version_script_info::get_symbol_version_helper): Rewrite to use
10424         lookup tables.
10425         (Version_script_info::print_expression_list): Adjust to use
10426         Version_script_info::Language.
10427         (script_push_lex_into_version_mode): Check that the version script
10428         has not been finalized.
10429         (version_script_push_lang): Change language string to
10430         Version_script_info::Language.
10431         * options.cc (Command_line::version_script): New function.
10432         * options.h (class General_options): Add finalize_dynamic_list
10433         function.  Change version_script from declaration to definition.
10434         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10435         * testsuite/version_script.map: Remove duplicate def of foo.
10436         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10437         version_script.map.
10438         * testsuite/Makefile.in: Rebuild.
10439
10440 2009-12-30  Ian Lance Taylor  <iant@google.com>
10441
10442         PR 10843
10443         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10444         if the input symbol index is 0, make the output symbol index 0.
10445
10446 2009-12-30  Ian Lance Taylor  <iant@google.com>
10447
10448         PR 10670
10449         * options.h (class General_options): Add -x/--discard-all.
10450         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10451         --discard-all.  If the local symbol needs a dynamic entry, check
10452         that before handling --discard-locals.
10453
10454 2009-12-30  Ian Lance Taylor  <iant@google.com>
10455
10456         PR 10450
10457         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10458         flags to PF_R.
10459         (Output_segment::add_output_section): Don't change the flags if
10460         the type is PT_TLS.
10461
10462         PR 10450
10463         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10464         GNU hash table if they need a dynamic value.  Otherwise, don't add
10465         them if they are defined in a dynamic object or are forced local.
10466
10467 2009-12-29  Ian Lance Taylor  <iant@google.com>
10468
10469         PR 10450
10470         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10471         .gnu.hash table for a 32-bit target.
10472
10473         PR 10450
10474         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10475         regular and a dynamic object only needs a dynamic symbol table
10476         entry if it is externally visible.
10477
10478         PR 10450
10479         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10480         constructor.  Add global_offset_table_ field.
10481         (Target_i386::got_section): Set global_offset_table_.
10482         (Target_i386::do_finalize_sections): Set global_offset_table_
10483         size.
10484         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10485         in constructor.  Add global_offset_table_ field.
10486         (Target_x86_64::got_section): Set global_offset_table_.
10487         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10488         size.
10489
10490         * layout.cc (Layout::Layout): Initialize increase_relro_.
10491         (Layout::get_output_section): Add is_relro, is_last_relro, and
10492         is_first_non_relro parameters.  Change all callers.
10493         (Layout::choose_output_section): Likewise.
10494         (Layout::add_output_section_data): Likewise.
10495         (Layout::make_output_section): Likewise.
10496         (Layout::set_segment_offsets): Clear increase_relro when using a
10497         linker script.
10498         * layout.h (class Layout): Add increase_relro method.  Add
10499         increase_relro_ field.  Update declarations.
10500         * output.cc (Output_section::Output_section): Initialize
10501         is_last_relro_ and is_first_non_relro_.
10502         (Output_segment::add_output_section): Group relro sections is
10503         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10504         (Output_segment::maximum_alignment): Remove relro handling.
10505         (Output_segment::set_section_addresses): Add increase_relro
10506         parameter.  Change all callers.  Add initial alignment to align
10507         relro sections on separate page.  Remove old relro handling.
10508         (Output_segment::set_section_list_addresses): Remove in_relro
10509         parameter.  Change all callers.
10510         (Output_segment::set_offset): Add increase parameter.  Change all
10511         callers.  Remove old relro handling.
10512         * output.h (class Output_section): Add new methods: is_last_relro,
10513         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10514         Add is_last_relro_ and is_first_non_relro_ fields.
10515         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10516         Create separate .got.plt section.  Call increase_relro.
10517         * x86_64.cc (Target_x86_64::got_section): Likewise.
10518         * testsuite/relro_script_test.t: Add .got.plt.
10519
10520         PR 10450
10521         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10522         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10523         (Layout::finalize): Call set_dynamic_symbol_size.
10524         (Layout::set_dynamic_symbol_size): New function.
10525         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10526         set_dynamic_symbol_size.
10527
10528         PR 10450
10529         * output.h (class Output_section): Add is_entsize_zero_ field.
10530         * output.cc (Output_section::Output_section): Initialize
10531         is_entsize_zero_.
10532         (Output_section::set_entsize): If two different entsizes are
10533         requested, force it to zero.
10534         (Output_section::add_input_section): Set flags for .debug_str
10535         before updating section flags.  Set entsize.
10536         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10537         and SHF_STRING if all input sections have those flags.
10538
10539 2009-12-29   Rafael Espindola  <espindola@google.com>
10540
10541         * main.cc (main): Fix the sys time reporting.
10542         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10543         reporting.
10544
10545 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10546
10547         * options.cc (General_options::parse_version): Allow -v to exit
10548         without an error if there is nothing to link.
10549
10550 2009-12-29  Ian Lance Taylor  <iant@google.com>
10551
10552         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10553         using a version of gcc before 4.1.
10554         * configure: Rebuild.
10555
10556 2009-12-28  Chris Demetriou  <cgd@google.com>
10557
10558         * attributes.cc (Output_attributes_section_data::do_write): Use
10559         std::vector::front rather than std::vector::data.
10560
10561 2009-12-28  Ian Lance Taylor  <iant@google.com>
10562
10563         * symtab.h (class Symbol_table): Add enum Defined.
10564         * resolve.cc (Symbol_table::should_override): Add defined
10565         parameter.  Change all callers.  Test whether object is NULL
10566         before calling a method on it.
10567         (Symbol_table::report_resolve_problem): Add defined parameter.
10568         Change all callers.
10569         (Symbol_table::should_override_with_special): Likewise.
10570         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10571         parameter.  Change all callers.
10572         (Symbol_table::do_define_in_output_data): Likewise.
10573         (Symbol_table::define_in_output_segment): Likewise.
10574         (Symbol_table::do_define_in_output_segment): Likewise.
10575         (Symbol_table::define_as_constant): Likewise.
10576         (Symbol_table::do_define_as_constant): Likewise.
10577         * script.h (class Symbol_assignment): Add is_defsym parameter to
10578         constructor; change all callers.
10579         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10580         parameter.  Change all callers.  Add is_defsym_ field.
10581         (class Parser_closure): Add parsing_defsym parameter to
10582         constructor; change all callers.  Add parsing_defsym accessor
10583         function.  Add parsing_defsym_ field.
10584
10585 2009-12-28  Ian Lance Taylor  <iant@google.com>
10586
10587         * gold.cc (queue_middle_tasks): Fix formatting.
10588         * object.cc (Relobj::is_section_name_included): Likewise.
10589
10590 2009-12-23  Ian Lance Taylor  <iant@google.com>
10591
10592         * i386.cc (Target_i386::do_calls_non_split): Recognize
10593         -fsplit-stack prologue for a function with a static chain.
10594         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10595         -fsplit-stack prologue when using %r11.
10596
10597 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10598
10599         * options.cc (General_options::parse_version): Make -v continue and do
10600         the link like GNU ld does.
10601
10602 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10603
10604         * Makefile.am (CCFILES): Add timer.cc.
10605         (HFILES): Add timer.h.
10606         * configure.ac: Check for sysconf and times.
10607         * main.cc: include timer.h.
10608         (main): Use Timer instead of get_run_time.
10609         * timer.cc: New.
10610         * timer.h: New.
10611         * workqueue.cc: include timer.h.
10612         (Workqueue::find_and_run_task):
10613         Report user, sys and wall time.
10614         * Makefile.in: Regenerate.
10615         * config.in: Regenerate.
10616         * configure: Regenerate.
10617
10618 2009-12-16  Doug Kwan  <dougkwan@google.com>
10619
10620         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10621         sections.
10622         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10623         relaxed input sections.
10624         * output.cc (Output_section::find_relaxed_input_section): Change
10625         return type to Output_relaxed_input_section pointer.  Adjust code
10626         for new type of relaxed_input_section_map_.
10627         * output.h (Output_section::find_relaxed_input_section): Change
10628         return type to Output_relaxed_input_section pointer.
10629         (Output_section::Output_relaxed_input_section_by_input_section_map):
10630         New type.
10631         (Output_section::relaxed_input_section_map_): Change type to
10632         Output_section::Output_relaxed_input_section_by_input_section_map.
10633         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10634         input section.
10635
10636 2009-12-15  Ian Lance Taylor  <iant@google.com>
10637
10638         * layout.cc (Layout::create_shstrtab): Only write out after input
10639         sections if we are compressing debug sections.
10640
10641 2009-12-15  Ian Lance Taylor  <iant@google.com>
10642
10643         * archive.cc (Archive::add_symbols): Only look up a symbol without
10644         a version if there is, in fact, a version.
10645
10646 2009-12-14  Ian Lance Taylor  <iant@google.com>
10647
10648         Revert -Wshadow changes, all changes from:
10649         2009-12-11  Doug Kwan  <dougkwan@google.com>
10650         2009-12-11  Nick Clifton  <nickc@redhat.com>
10651         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10652
10653 2009-12-11  Doug Kwan  <dougkwan@google.com>
10654
10655         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10656         due to -Wshadow.
10657         * attributes.cc (Object_attribute::size): Ditto.
10658         (Attributes_section_data::size): Ditto.
10659         (Attributes_section_data::Attributes_section_data): Ditto.
10660         (Output_attributes_section_data::do_write): Ditto.
10661         * attributes.h (Object_attribute::set_type): Ditto.
10662         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10663
10664 2009-12-11  Nick Clifton  <nickc@redhat.com>
10665
10666         * archive.cc: Fix shadowed variable warnings.
10667         * arm.cc: Likewise.
10668         * compressed_output.cc: Likewise.
10669         * compressed_output.h: Likewise.
10670         * configure: Likewise.
10671         * dwarf_reader.cc: Likewise.
10672         * dynobj.cc: Likewise.
10673         * dynobj.h: Likewise.
10674         * ehframe.cc: Likewise.
10675         * ehframe.h: Likewise.
10676         * errors.cc: Likewise.
10677         * expression.cc: Likewise.
10678         * fileread.cc: Likewise.
10679         * fileread.h: Likewise.
10680         * freebsd.h: Likewise.
10681         * i386.cc: Likewise.
10682         * icf.cc: Likewise.
10683         * incremental.h: Likewise.
10684         * layout.cc: Likewise.
10685         * layout.h: Likewise.
10686         * mapfile.cc: Likewise.
10687         * merge.cc: Likewise.
10688         * merge.h: Likewise.
10689         * object.cc: Likewise.
10690         * object.h: Likewise.
10691         * options.h: Likewise.
10692         * output.cc: Likewise.
10693         * output.h: Likewise.
10694         * parameters.cc: Likewise.
10695         * plugin.cc: Likewise.
10696         * powerpc.cc: Likewise.
10697         * reduced_debug_output.cc: Likewise.
10698         * reduced_debug_output.h: Likewise.
10699         * reloc.cc: Likewise.
10700         * reloc.h: Likewise.
10701         * resolve.cc: Likewise.
10702         * script-sections.cc: Likewise.
10703         * script.cc: Likewise.
10704         * script.h: Likewise.
10705         * sparc.cc: Likewise.
10706         * symtab.cc: Likewise.
10707         * symtab.h: Likewise.
10708         * target-select.cc: Likewise.
10709         * target-select.h: Likewise.
10710         * token.h: Likewise.
10711         * workqueue.cc: Likewise.
10712         * workqueue.h: Likewise.
10713         * x86_64.cc: Likewise.
10714
10715 2009-12-10  Doug Kwan  <dougkwan@google.com>
10716
10717         * arm.cc (attributes.h): New include.
10718         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10719         (Arm_relobj::~Arm_relobj): Delete object pointed by
10720         attributes_section_data_.
10721         (Arm_relobj::attributes_section_data): New method definition.
10722         (Arm_relobj::attributes_section_data_): New data member declaration.
10723         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10724         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10725         attributes_section_data_.
10726         (Arm_dynobj::attributes_section_data): New method definition.
10727         (Arm_dynobj::attributes_section_data_): New data member declaration.
10728         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10729         initialization value of may_use_blx_ to false.
10730         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10731         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10732         object attributes to compute results instead of hard-coding.
10733         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10734         Target_arm::get_secondary_compatible_arch,
10735         Target_arm::set_secondary_compatible_arch
10736         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10737         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10738         New method declarations.
10739         (Target_arm::get_aeabi_object_attribute): New method definition.
10740         (Target_arm::attributes_section_data_): New data member declaration.
10741         (read_arm_attributes_section): New template definition.
10742         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10743         (Arm_dynobj::do_read_symbols): Ditto.
10744         (Target_arm::do_finalize_sections): Merge attributes sections from
10745         input.  Check for BLX use after attributes section merging.
10746         Fix __exidx_start and __exidx_end visibility.  Create an
10747         .ARM.attributes section if necessary.
10748         (Target_arm::get_secondary_compatible_arch,
10749         Target_arm::set_secondary_compatible_arch,
10750         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10751         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10752         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10753         New method definitions.
10754
10755 2009-12-09  Ian Lance Taylor  <iant@google.com>
10756
10757         * plugin.cc (Plugin::load): Don't cast from void* to a function
10758         pointer.
10759
10760 2009-12-09  Ian Lance Taylor  <iant@google.com>
10761
10762         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10763         information fields.
10764
10765 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10766
10767         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10768         Replace two_file_shared_1.so with two_file_shared_2.so.
10769         * testsuite/Makefile.in: Regenerated.
10770
10771 2009-12-08  Doug Kwan  <dougkwan@google.com>
10772
10773         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10774         (HFILES): Add attributes.h and int_encoding.h.
10775         * Makefile.in: Regenerate.
10776         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10777         function definitions to int_encoding.cc
10778         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10779         prototypes to int_encoding.h
10780         * reduced_debug_output.cc (int_encoding.h): New include.
10781         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10782         function definitions to int_encoding.cc
10783         (insert_into_vector, read_from_pointer): Move template definitions to
10784         int_encoding.h
10785         * attributes.cc: New file.
10786         * attributes.h: New file.
10787         * int_encoding.cc: New file.
10788         * int_encoding.h: New file.
10789
10790 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10791
10792         PR gold/11055
10793         * incremental-dump.cc (dump_incremental_inputs): New.
10794         (main): Use dump_incremental_inputs.
10795
10796 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10797
10798         PR gold/10893
10799         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10800         checking elfcpp::STT_FUNC.
10801         (Target_i386::Relocate::relocate): Likewise.
10802         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10803
10804         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10805         symbols from shared libraries into normal FUNC symbols.
10806
10807         * symtab.h (Symbol): Add is_func and use it.
10808
10809 2009-12-05  Doug Kwan  <dougkwan@google.com>
10810
10811         * arm.cc (Target_arm::arm_info): Initialize new fields
10812         attributes_section and attributes_vendor.
10813         * i386.cc (Target_i386::i386_info): Same.
10814         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10815         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10816         fields attributes_section and attributes_vendor.
10817         * sparc.cc (Target_sparc::sparc_info): Same.
10818         * target.h (Target::attributes_section, Target::attributes_vendor,
10819         Target::is_attributes_section, Target::attribute_arg_type,
10820         Target::attributes_order): New method definitions.
10821         (Target::Target_info::attributes_section,
10822         Target::Target_info::attributes_vendor): New fields.
10823         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10824         virtual method definitions.
10825         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10826         attributes_section and attributes_vendor.
10827         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10828
10829 2009-12-05  Doug Kwan  <dougkwan@google.com>
10830
10831         * arm.cc: Update comments about interworking and stub generation.
10832         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10833         considered as non-PIC.
10834         (Arm_relocate_functions::base_abs): Fix formatting.
10835         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10836         of function to use GOT entry address instead of offset.
10837         (Target_arm::Scan::global): Issue an error if a symbol would need a
10838         PLT does not get one because it is untyped.  Remove code to create
10839         dynamic symbols for relative branches.
10840         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10841         takes unsigned integer instead of boolean.
10842
10843 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10844
10845         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10846         (two_file_test_LDADD): Likewise.
10847         (common_test_1_LDADD): Likewise.
10848         (exception_test_LDADD) Likewise.
10849         (weak_test_LDADD): Likewise.
10850         (many_sections_test_LDADD): Likewise.
10851         (initpri1_LDADD): Likewise.
10852         (script_test_1_LDADD): Likewise.
10853         (script_test_2_LDADD): Likewise.
10854         (justsyms_LDADD): Likewise.
10855         (binary_test_LDADD): Likewise.
10856         (large_LDADD): Likewise.
10857         * testsuite/Makefile.in: Regenerated.
10858
10859 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10860
10861         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10862         (Symbol_table::override_with_special): Likewise.
10863         (Symbol_table::add_from_object): Likewise.
10864
10865 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10866
10867         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10868         Don't set the data_offset twice.
10869
10870 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10871
10872         * testsuite/Makefile.in: Regenerate.
10873
10874 2009-12-03  Doug Kwan  <dougkwan@google.com>
10875
10876         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10877         (Target_arm::do_finalize_sections): Add parameter for symbol table
10878         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10879         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10880         parameter for symbol table pointer.
10881         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10882         an additional parameter for a pointer to symbol table.
10883         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10884         parameter for a symbol table pointer.
10885         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10886         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10887         Ditto.
10888         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10889         parameter for a symbol table pointer.
10890
10891 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10892
10893         * incremental.cc (Incremental_inputs_header)
10894         (Incremental_inputs_header_write, Incremental_inputs_entry)
10895         (Incremental_inputs_entry_write): Move ...
10896         * incremental.h (Incremental_inputs_header)
10897         (Incremental_inputs_header_write, Incremental_inputs_entry)
10898         (Incremental_inputs_entry_write): here.
10899
10900 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10901
10902         * incremental.cc (make_sized_incremental_binary): Set the target.
10903         Error if it is incompatible.
10904         * output.h (Output_file): Add filename method.
10905
10906 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10907
10908         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10909         from the get_* methods.
10910
10911 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10912
10913         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10914         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10915         Write 0 for the data_offset of scripts.
10916
10917 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10918
10919         * testsuite/Makefile.am: Add the incremental_test.sh test.
10920         * testsuite/incremental_test.sh: New.
10921         * testsuite/incremental_test_1.c: New.
10922         * testsuite/incremental_test_2.c: New.
10923
10924 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10925
10926         * incremental-dump.cc (main): Fix typos.
10927
10928 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10929
10930         PR gold/11025
10931         * incremental-dump.cc (main): Use llu to print 64 bit values.
10932
10933 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10934             H.J. Lu  <hongjiu.lu@intel.com>
10935
10936         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10937         $(LIBDL).
10938         (incremental_dump_LDADD): Likewise.
10939         * Makefile.in: Regenerated.
10940
10941 2009-11-25  Doug Kwan  <dougkwan@google.com>
10942
10943         Revert:
10944
10945         2009-11-25  Doug Kwan  <dougkwan@google.com>
10946
10947                 * arm.cc (Target_arm::Target_arm): Move method definition
10948                 outside of class definition.  Add code to handle
10949                 --target1-rel, --target1-abs and --target2= options.
10950                 (Target_arm::get_reloc_reloc_type): Change method to be
10951                 non-static and const.
10952                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10953                 New data member declaration.
10954                 (Target_arm::Scan::local, Target_arm::Scan::global,
10955                 Target_arm::Relocate::relocate,
10956                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10957                 Adjust call to Target_arm::get_real_reloc_type.
10958                 (Target_arm::get_real_reloc_type): Use command line options
10959                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10960                 * options.h (--target1-rel, --target1-abs, --target2): New
10961                 ARM-only options.
10962
10963 2009-11-25  Doug Kwan  <dougkwan@google.com>
10964
10965         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10966         class definition.  Add code to handle --target1-rel, --target1-abs
10967         and --target2= options.
10968         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10969         and const.
10970         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10971         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): Adjust
10975         call to Target_arm::get_real_reloc_type.
10976         (Target_arm::get_real_reloc_type): Use command line options to
10977         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10978         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10979         options.
10980
10981 2009-11-25  Doug Kwan  <dougkwan@google.com>
10982
10983         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10984         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10985         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10986         formatting.
10987         (Arm_relocate_functions::thm_call): Replace body with a call to
10988         Arm_relocate_functions::thumb_branch_common.
10989         (Arm_relocate_functions::thm_jump24,
10990         Arm_relocate_functions::thm_xpc22): New method definitions.
10991         (Arm_relocate_functions::thumb_branch_common): New method definition.
10992         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10993         operator.
10994         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10995         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10996
10997 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10998
10999         * Makefile.am: Build incremental-dump
11000         * Makefile.in: Regenerate.
11001         * incremental-dump.cc: New.
11002         * incremental.cc (Incremental_inputs_header_data,
11003         Incremental_inputs_entry_data): Move to incremental.h
11004         * incremental.h: (Incremental_inputs_header_data,
11005         Incremental_inputs_entry_data): Move from incremental.cc
11006
11007 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11008
11009         * incremental.cc (Incremental_inputs_header,
11010         Incremental_inputs_header_write, Incremental_inputs_entry,
11011         Incremental_inputs_entry_write): Add a typedef with the data type.
11012
11013 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11014
11015         * incremental.cc (Incremental_inputs_header,
11016         Incremental_inputs_header_write, Incremental_inputs_entry,
11017         Incremental_inputs_entry_write): Update comment about which
11018         type has the filed descriptions.
11019
11020 2009-11-15  Doug Kwan  <dougkwan@google.com>
11021
11022         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11023         (Arm_relocate_functions::arm_branch_common): Change method defintion
11024         in class definition to a method declaration and update list of formal
11025         parameters.
11026         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11027         Arm_relocation_functions::jump24): Adjust call to
11028         Arm_relocate_functions::arm_branch_common.  Update list of formal
11029         parameters.
11030         (Arm_relocate_functions::xpc25): New method definition.
11031         (Arm_relocate_functions::arm_branch_common): Move method defintion
11032         out from class definition.  Use stubs for mode-switching and extending
11033         branch ranges.
11034         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11035         specially.  Change code to enable use of stubs in ARM branches.
11036
11037 2009-11-10  Doug Kwan  <dougkwan@google.com>
11038
11039         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11040         in method declaration.
11041         (Target_arm::relocate_stub): New method declaration.
11042         (Target_arm::default_target): Change to return a pointer instead of
11043         a const reference.
11044         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11045         Target_arm::default_target.
11046         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11047         method definition.
11048         (Target_arm::relocate_section): Adjust view.
11049         (Target_arm::relocate_stub): New method definition.
11050
11051 2009-11-10  Doug Kwan  <dougkwan@google.com>
11052
11053         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11054         a format warning.
11055         * incremental.cc (open_incremental_binary): Initialized local
11056         variables to avoid warnings.
11057         * object.cc (make_elf_object): Ditto.
11058         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11059         a format warning.
11060
11061 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11062
11063         PR gold/10930
11064         * testsuite/plugin_test.c: Include "config.h".
11065
11066 2009-11-09  Doug Kwan  <dougkwan@google.com>
11067
11068         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11069         (arm_symbol_value): Remove.
11070         (Arm_relocate_functions::arm_branch_common,
11071         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11072         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11073         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11074         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11075         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11076         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11077         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11078         Arm_relocate_functions::thm_mobw_abs_nc,
11079         Arm_relocate_functions::thm_mov_abs,
11080         Arm_relocate_functions::movw_prel_nc,
11081         Arm_relocate_functions::thm_movt_abs,
11082         Arm_relocate_functions::movt_prel,
11083         Arm_relocate_functions::thm_movw_prel_nc,
11084         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11085         (Target_arm::Relocate::relocate): Only decompose address into two
11086         parts if relocation type uses the thumb-bit and pass the actual
11087         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11088         calls to methods in Arm_relocate_functions for this change.
11089
11090 2009-11-08  Ian Lance Taylor  <iant@google.com>
11091
11092         PR 10925
11093         * reloc.cc: Instantiate
11094         Sized_relobj::initialize_input_to_output_maps and
11095         Sized_relobj:free_input_to_output_maps.
11096
11097 2009-11-06  Ian Lance Taylor  <iant@google.com>
11098
11099         PR 10876
11100         * defstd.cc (in_segment): Set only_if_ref true for "end".
11101
11102 2009-11-06  Doug Kwan  <dougkwan@google.com>
11103
11104         * arm.cc (class Reloc_stub): Correct a comment.
11105         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11106         (Target_arm::scan_section_for_stubs): New method declaration.
11107         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11108         Change methods from private to protected.
11109         (Target_arm::do_may_relax): New method definition.
11110         (Target_arm::do_relax, Target_arm::group_sections,
11111         Target_arm::scan_reloc_for_stub,
11112         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11113         (Target_arm::arm_input_section_map_): New data member declaration.
11114         (Target_arm::scan_reloc_for_stub,
11115         Target_arm::scan_reloc_section_for_stubs,
11116         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11117         Target_arm::do_relax): New method definitions.
11118
11119 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11120
11121         * configure.ac: Check for (struct stat)::st_mtim
11122         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11123         * config.in: Regenerate.
11124         * configure: Regenerate.
11125
11126 2009-11-05  Ian Lance Taylor  <iant@google.com>
11127
11128         PR 10910
11129         * output.cc (Output_segment::add_output_section): Add missing
11130         return statement.
11131
11132 2009-11-04  Ian Lance Taylor  <iant@google.com>
11133
11134         PR 10880
11135         * object.h (class Object): Add is_needed and set_is_needed
11136         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11137         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11138         defined in a dynamic object and referenced by a regular object,
11139         set is_needed for the dynamic object.
11140         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11141         if the file is marked with as_needed and it is not needed.
11142
11143 2009-11-04  Ian Lance Taylor  <iant@google.com>
11144
11145         PR 10887
11146         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11147         tags if data is discarded by linker script.
11148         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11149         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11150         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11151         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11152
11153 2009-11-04  Ian Lance Taylor  <iant@google.com>
11154
11155         * layout.cc (Layout::get_output_section): Add is_interp and
11156         is_dynamic_linker_section parameters.  Change all callers.
11157         (Layout::choose_output_section): Likewise.
11158         (Layout::make_output_section): Likewise.
11159         (Layout::add_output_section_data): Add is_dynamic_linker_section
11160         parameter.  Change all callers.
11161         * layout.h (class Layout): Update declarations.
11162         * output.h (class Output_section): Add is_interp, set_is_interp,
11163         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11164         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11165         generate_code_fills_at_write_ to a bitfield.
11166         * output.cc (Output_section::Output_sections): Initialize new
11167         fields.
11168         (Output_segment::add_output_section): Add do_sort parameter.
11169         Change all callers.
11170
11171 2009-11-03  Ian Lance Taylor  <iant@google.com>
11172
11173         PR 10860
11174         * options.h (class General_options): Add --warn-common.
11175         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11176         merging two common symbols.
11177         (Symbol_table::should_override): Handle --warn-common when merging
11178         a common symbol with a defined symbol.  Use report_resolve_problem
11179         for multiple definitions.
11180         (Symbol_table::report_resolve_problem): New function.
11181         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11182
11183 2009-11-03  Doug Kwan  <dougkwan@google.com>
11184
11185         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11186         stub_factory_.
11187         (Target_arm::stub_factory): New method definition.
11188         (Target_arm::new_arm_input_section,
11189         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11190         Target_arm::reloc_uses_thumb_bit): New method declarations.
11191         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11192         New type definitions.
11193         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11194         member declarations.
11195         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11196         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11197         New method definitions.
11198
11199 2009-11-03  Ian Lance Taylor  <iant@google.com>
11200
11201         * options.h (class General_options): Add --warn_constructors.
11202
11203 2009-11-03  Ian Lance Taylor  <iant@google.com>
11204
11205         PR 10893
11206         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11207         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11208
11209 2009-11-03  Ian Lance Taylor  <iant@google.com>
11210
11211         PR 10895
11212         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11213         --msgid-bugs-address.
11214         (install-pdf): New target.
11215         (install-data_yes): Look up one directory to find mkinstalldirs.
11216
11217 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11218
11219         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11220         tree.
11221
11222 2009-10-30  Doug Kwan  <dougkwan@google.com>
11223
11224         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11225
11226 2009-10-30  Doug Kwan  <dougkwan@google.com>
11227
11228         * arm.cc (Stub_addend_reader): New struct template definition
11229         and partial specializations.
11230         (Stub_addend_reader::operator()): New method definition for a
11231         partially specialized template.
11232
11233 2009-10-30  Doug Kwan  <dougkwan@google.com>
11234
11235         * arm.cc (Arm_relobj::processor_specific_flags): New method
11236         definition.
11237         (Arm_relobj::do_read_symbols): New method declaration.
11238         (Arm_relobj::processor_specific_flags_): New data member declaration.
11239         (Arm_dynobj): New class definition.
11240         (Target_arm::do_finalize_sections): Add input_objects parameter.
11241         (Target_arm::do_adjust_elf_header): New method declaration.
11242         (Target_arm::are_eabi_versions_compatible,
11243         (Target_arm::merge_processor_specific_flags): New method declaration.
11244         (Target_arm::do_make_elf_object): New overloaded method definitions
11245         and declaration.
11246         (Arm_relobj::do_read_symbols): New method definition.
11247         (Arm_dynobj::do_read_symbols): Ditto.
11248         (Target_arm::do_finalize_sections): Add input_objects parameters.
11249         Merge processor-specific flags from all input objects.
11250         (Target_arm::are_eabi_versions_compatible,
11251         Target_arm::merge_processor_specific_flags,
11252         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11253         New method definitions.
11254         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11255         Input_objects pointer type parameter.
11256         * layout.cc (Layout::finalize): Pass input objects to target's.
11257         finalize_sections function.
11258         * output.cc (Output_file_header::do_sized_write): Set ELF file
11259         header's processor-specific flags.
11260         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11261         Input_objects pointer type parameter.
11262         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11263         * target.h (Input_objects): New forward class declaration.
11264         (Target::processor_specific_flags,
11265         Target::are_processor_specific_flags_sect): New method definitions.
11266         (Target::finalize_sections): Add input_objects parameter.
11267         (Target::Target): Initialize processor_specific_flags_ and
11268         are_processor_specific_flags_set_.
11269         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11270         parameter.
11271         (Target::set_processor_specific_flags): New method definition.
11272         (Target::processor_specific_flags_,
11273         Target::are_processor_specific_flags_set_): New data member
11274         declarations.
11275         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11276         Input_objects pointer type parameter.
11277
11278 2009-10-30  Doug Kwan  <dougkwan@google.com>
11279
11280         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11281
11282 2009-10-28  Ian Lance Taylor  <iant@google.com>
11283
11284         * object.h (class Relobj): Drop options parameter from
11285         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11286         do_scan_relocs, do_relocate.  Change all callers.
11287         (class Sized_relobj): Drop options parameters from
11288         do_gc_process_relocs, do_scan_relocs, do_relocate,
11289         do_relocate_sections, relocate_sections, emit_relocs_scan,
11290         emit_relocs_scan_reltype.  Change all callers.
11291         (struct Relocate_info): Remove options field and all references to
11292         it.
11293         * reloc.h (class Read_relocs): Remove options constructor
11294         parameter and options_ field.  Change all callers.
11295         (class Gc_process_relocs, class Scan_relocs): Likewise.
11296         (class Relocate_task): Likewise.
11297         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11298         all callers.
11299         (scan_relocatable_relocs): Likewise.
11300         * target.h (class Sized_target): Remove options parameter from
11301         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11302         all callers.
11303         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11304         callers.
11305         * arm.cc: Update functions to remove options parameters.
11306         * i386.cc: Likewise.
11307         * powerpc.cc: Likewise.
11308         * sparc.cc: Likewise.
11309         * x86_64.cc: Likewise.
11310         * testsuite/testfile.cc: Likewise.
11311
11312 2009-10-28  Doug Kwan  <dougkwan@google.com>
11313
11314         * arm.cc (Arm_relobj): New class definition.
11315         (Arm_relobj::scan_sections_for_stubs,
11316         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11317         New method definitions.
11318
11319 2009-10-28  Cary Coutant  <ccoutant@google.com>
11320
11321         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11322         (Plugin::cleanup_done_): New member.
11323         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11324         (Plugin_manager::cleanup_done_): Remove.
11325         (Plugin_manager::add_input_file): Edit error message.
11326         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11327         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11328
11329 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11330
11331         * fileread.cc: (File_read::View::~View): Use the new
11332         data_ownership_ filed.
11333         (File_read::~File_read): Dispose the new whole_file_view_.
11334         (File_read::open): Mmap the whole file if needed.
11335         (File_read::open): Use whole_file_view_ instead of contents_.
11336         (File_read::find_view): Use whole_file_view_ if applicable.
11337         (File_read::do_read): Use whole_file_view_ instead of contents_.
11338         (File_read::make_view): Use whole_file_view_ instead of contents_,
11339         update File_read::View::View call.
11340         (File_read::find_or_make_view): Update File_read::View::View
11341         call.
11342         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11343         remove contents_
11344         (File_read::View::Data_ownership): New enum.
11345         (File_read::View::View): Replace bool mapped_ with Data_ownership
11346         argument.
11347         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11348         (File_read::View::data_ownership_): New field.
11349         (File_read::contents_): Remove (replaced by whole_file_view_).
11350         (File_read::whole_file_view_): New field.
11351         * options.h (class General_options): Add --keep-files-mapped.
11352
11353 2009-10-27  Cary Coutant  <ccoutant@google.com>
11354
11355         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11356         * testsuite/Makefile.am (plugin_test_5): New test case.
11357         * testsuite/Makefile.in: Regenerate.
11358
11359 2009-10-25  Doug Kwan  <dougkwan@google.com>
11360
11361         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11362         from private to protected to allow access by child class.
11363         (Sized_relobj::do_relocate_sections): New method declaration.
11364         (Sized_relobj::relocate_sections): Virtualize.
11365         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11366         Sized_relobj::relocate_sections.  Instantiate template explicitly
11367         for different target sizes and endianity.
11368
11369 2009-10-24  Doug Kwan  <dougkwan@google.com>
11370
11371         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11372         (Arm_input_section::as_arm_input_section): New method.
11373         (Arm_output_section): New class definition.
11374         (Arm_output_section::create_stub_group,
11375         Arm_output_section::group_sections): New method definitions.
11376
11377 2009-10-22  Doug Kwan  <dougkwan@google.com>
11378
11379         * arm.cc (Arm_input_section): New class definition.
11380         (Arm_input_section::init, Arm_input_section:do_write,
11381         Arm_input_section::set_final_data_size,
11382         Arm_input_section::do_reset_address_and_file_offset): New method
11383         definitions.
11384
11385 2009-10-21  Doug Kwan  <dougkwan@google.com>
11386
11387         * arm.cc (Stub_table, Arm_input_section): New forward class
11388         declarations.
11389         (Stub_table): New class defintion.
11390         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11391         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11392         New method definition.
11393
11394 2009-10-21  Doug Kwan  <dougkwan@google.com>
11395
11396         * arm.cc: Update copyright comments.
11397         (Target_arm): New forward class template declaration.
11398         (Arm_address): New type.
11399         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11400         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11401         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11402         constants.
11403         (Insn_template): Same.
11404         (DEF_STUBS): New macro.
11405         (Stub_type): New enum type.
11406         (Stub_template): New class definition.
11407         (Stub): Same.
11408         (Reloc_stub): Same.
11409         (Stub_factory): Same.
11410         (Target_arm::Target_arm): Initialize may_use_blx_ and
11411         should_force_pic_veneer_.
11412         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11413         Target_arm::should_force_pic_veneer,
11414         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11415         Target_arm::using_thumb_only, Target_arm:;default_target): New
11416         method defintions.
11417         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11418         New data member declarations.
11419         (Insn_template::size, Insn_template::alignment): New method defintions.
11420         (Stub_template::Stub_template): New method definition.
11421         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11422         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11423         (Stub_factory::Stub_factory): New method definition.
11424         * gold.h (string_hash): New template.
11425         * output.h (Input_section_specifier::hash_value): Use
11426         gold::string_hash.
11427         (Input_section_specifier::string_hash): Remove.
11428         * stringpool.cc (Stringpool_template::string_hash): Use
11429         gold::string_hash.
11430
11431 2009-10-20  Doug Kwan  <dougkwan@google.com>
11432
11433         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11434         symbols of relaxed input sections.
11435         * output.h (Output_section::find_relaxed_input_section): Make
11436         method public.
11437
11438 2009-10-16  Doug Kwan  <dougkwan@google.com>
11439
11440         * dynobj.cc (Versions::Versions): Initialize version_script_.
11441         Only insert base version symbol definition for a shared object
11442         if version script defines any version versions.
11443         (Versions::define_base_version): New method definition.
11444         (Versions::add_def): Check that base version is not needed.
11445         (Versions::add_need): Define base version lazily.
11446         * dynobj.h (Versions::define_base_version): New method declaration.
11447         (Versions::needs_base_version_): New data member declaration.
11448         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11449         (check_DATA): Add no_version_test.stdout.
11450         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11451         New make rules.
11452         * testsuite/Makefile.in: Regenerate.
11453         * testsuite/no_version_test.c: New file.
11454         * testsuite/no_version_test.sh: Ditto.
11455
11456 2009-10-16  Doug Kwan  <dougkwan@google.com>
11457
11458         * expression.cc (class Segment_start_expression): New class definition.
11459         (Segment_start_expression::value): New method definition.
11460         (script_exp_function_segment_start): Return a new
11461         Segment_start_expression.
11462         * gold/script-c.h (script_saw_segment_start_expression): New function
11463         prototype.
11464         * script-sections.cc (Script_sections::Script_sections): Initialize
11465         SAW_SEGMENT_START_EXPRESSION_ to false.
11466         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11467         and -Tbbs options to specify section addresses if given in
11468         command line and no SEGMENT_START expression is seen in a script.
11469         * script-sections.h (Script_sections::saw_segment_start_expression,
11470         Script_sections::set_saw_segment_start_expression): New method
11471         definition.
11472         (Script_sections::saw_segment_start_expression_): New data member
11473         declaration.
11474         * script.cc (script_saw_segment_start_expression): New function.
11475         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11476         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11477         script_test_7.sh and script_test_8.sh.
11478         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11479         script_test_8.stdout.
11480         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11481         (script_test_6, script_test_6.stdout, script_test_7,
11482         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11483         * Makefile.in: Regenerate.
11484         * testsuite/script_test_6.sh: New file.
11485         * testsuite/script_test_6.t: Same.
11486         * testsuite/script_test_7.sh: Same.
11487         * testsuite/script_test_7.t: Same.
11488         * testsuite/script_test_8.sh: Same.
11489
11490 2009-10-16  Doug Kwan  <dougkwan@google.com>
11491
11492         * output.cc (Output_segment::set_section_list_address): Cast
11493         expressions to unsigned long long type to avoid format warnings.
11494
11495 2009-10-15  Ian Lance Taylor  <iant@google.com>
11496
11497         * script.cc (Script_options::add_symbol_assignment): Always add a
11498         dot assignment to script_sections_.
11499         * script-sections.cc (Script_sections::add_dot_assignment):
11500         Initialize if necessary.
11501
11502         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11503         program headers with no load segment if there is a linker script.
11504
11505         * layout.cc (Layout::set_segment_offsets): Align the file offset
11506         to the segment aligment for -N or -n with no load segment.
11507         * output.cc (Output_segment::add_output_section): Don't crash if
11508         the first section is a TLS section.
11509         (Output_segment::set_section_list_addresses): Print an error
11510         message if the address moves backward in a linker script.
11511         * script-sections.cc
11512         (Output_section_element_input::set_section_addresses): Don't
11513         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11514         (Orphan_output_section::set_section_addresses): Likewise.
11515
11516 2009-10-15  Doug Kwan  <dougkwan@google.com>
11517
11518         * layout.cc (Layout::finish_dynamic_section): Generate tags
11519         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11520         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11521         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11522
11523 2009-10-14  Ian Lance Taylor  <iant@google.com>
11524
11525         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11526         fields.
11527         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11528         data_shdr fields of relinfo.
11529         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11530         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11531         R_386_TLS_LDO_32, adjust based on section flags.
11532         (Target_i386::Relocate::fix_up_ldo): Remove.
11533
11534 2009-10-13  Ian Lance Taylor  <iant@google.com>
11535
11536         Add support for -pie.
11537         * options.h (class General_options): Add -pie and
11538         --pic-executable.
11539         (General_options::output_is_position_independent): Test -pie.
11540         (General_options::output_is_executable): Return true if not shared
11541         and not relocatable.
11542         (General_options::output_is_pie): Remove.
11543         * options.cc (General_options::finalize): Reject incompatible uses
11544         of -pie.
11545         * gold.cc (queue_middle_tasks): A -pie link is not static.
11546         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11547         * symtab.cc (Symbol::final_value_is_known): Return false if
11548         output_is_position_independent.
11549         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11550         output_is_position_independent.
11551         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11552         output_is_position_independent.
11553         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11554         output_is_position_independent.
11555         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11556         two_file_pie_test.
11557         (basic_pie_test.o, basic_pie_test): New targets.
11558         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11559         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11560         (two_file_pie_test): New target.
11561         * testsuite/Makefile.in: Rebuild.
11562         * README: Remove note saying that -pie is not supported.
11563
11564 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11565
11566         * options.h (class General_options): Add -init and -fini.
11567         * layout.cc (Layout::finish_dynamic_section): Emit
11568         given init and fini functions.
11569
11570 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11571
11572         * gc.h (gc_process_relocs): Check if icf is enabled using new
11573         function.
11574         * gold.cc (queue_initial_tasks): Likewise.
11575         (queue_middle_tasks): Likewise.
11576         * object.cc (do_layout): Likewise.
11577         * symtab.cc (is_section_folded): Likewise.
11578         * main.cc (main): Likewise.
11579         * reloc.cc (Read_relocs::run): Likewise.
11580         (Sized_relobj::do_scan_relocs): Likewise.
11581         * icf.cc (is_function_ctor_or_dtor): New function.
11582         (Icf::find_identical_sections): Check if function is ctor or dtor when
11583         safe icf is chosen.
11584         * options.h (General_options::icf): Change option to be an enum.
11585         (Icf_status): New enum.
11586         (icf_enabled): New method.
11587         (icf_safe_folding): New method.
11588         (set_icf_status): New method.
11589         (icf_status_): New variable.
11590         * (options.cc) (General_options::finalize): Set icf_status_.
11591         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11592         icf_test and icf_keep_unique_test to use the --icf enum flag.
11593         * testsuite/icf_safe_test.sh: New file.
11594         * testsuite/icf_safe_test.cc: New file.
11595
11596 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11597
11598         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11599         includes to gc.h and icf.h.
11600         * arm.cc: Include gc.h.
11601         * gold.cc: Likewise.
11602         * i386.cc: Likewise.
11603         * powerpc.cc: Likewise.
11604         * sparc.cc: Likewise.
11605         * x86_64.cc: Likewise.
11606         * gc.h: Include icf.h.
11607
11608 2009-10-11  Ian Lance Taylor  <iant@google.com>
11609
11610         * plugin.cc: Include "gold.h" before other header files.
11611
11612 2009-10-10  Chris Demetriou  <cgd@google.com>
11613
11614         * options.h (Input_file_argument::Input_file_type): New enum.
11615         (Input_file_argument::is_lib_): Replace with...
11616         (Input_file_argument::type_): New member.
11617         (Input_file_argument::Input_file_argument): Take Input_file_type
11618         'type' rather than boolean 'is_lib' as second argument.
11619         (Input_file_argument::is_lib): Use type_.
11620         (Input_file_argument::is_searched_file): New function.
11621         (Input_file_argument::may_need_search): Handle is_searched_file.
11622         * options.cc (General_options::parse_library): Support -l:filename.
11623         (General_options::parse_just_symbols): Update for Input_file_argument
11624         changes.
11625         (Command_line::process): Likewise.
11626         * archive.cc (Archive::get_file_and_offset): Likewise.
11627         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11628         * script.cc (read_script_file, script_add_file): Likewise.
11629         * fileread.cc (Input_file::Input_file): Likewise.
11630         (Input_file::will_search_for): Handle is_searched_file.
11631         (Input_file::open): Likewise.
11632         * readsyms.cc (Read_symbols::get_name): Likewise.
11633         * testsuite/Makefile.am (searched_file_test): New test.
11634         * testsuite/Makefile.in: Regenerate.
11635         * testsuite/searched_file_test.cc: New file.
11636         * testsuite/searched_file_test_lib.cc: New file.
11637
11638 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11639             Ian Lance Taylor  <iant@google.com>
11640
11641         * descriptor.cc: Include <cstdio> and "binary-io.h".
11642         (Descriptors::open): Open the files in binary mode always.
11643         * script.cc (Lex::get_token): Treat \r as whitespace.
11644
11645 2009-10-09  Ian Lance Taylor  <iant@google.com>
11646
11647         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11648
11649 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11650             Ian Lance Taylor  <iant@google.com>
11651
11652         * configure.ac: Check for readv function also.
11653         * fileread.cc (readv): Define if not HAVE_READV.
11654         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11655         does not exist.
11656         * config.in: Regenerate.
11657         * configure: Regenerate.
11658
11659 2009-10-09  Doug Kwan  <dougkwan@google.com>
11660
11661         * layout.cc (Layout::make_output_section): Call target hook to make
11662         ordinary output section.
11663         (Layout::finalize): Adjust parameter list of call the
11664         Target::may_relax().
11665         * layout.h (class Layout::section_list): New method.
11666         * merge.h (Output_merge_base::entsize): Change visibility to public.
11667         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11668         New methods.
11669         (Output_merge_string::do_is_string): New method.
11670         * object.cc (Sized_relobj::do_setup): renamed from
11671         Sized_relobj::set_up.
11672         * object.h (Sized_relobj::adjust_shndx,
11673         Sized_relobj::initializ_input_to_output_maps,
11674         Sized_relobj::free_input_to_output_maps): Change visibilities to
11675         protected.
11676         (Sized_relobj::setup): Virtualize.
11677         (Sized_relobj::do_setup): New method declaration.
11678         (Sized_relobj::invalidate_section_offset,
11679         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11680         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11681         * options.cc (parse_int): New function.
11682         * options.h (parse_int): New declaration.
11683         (DEFINE_int): New macro.
11684         (stub_group_size): New option.
11685         * output.cc (Output_section::Output_section): Initialize memebers
11686         merge_section_map_, merge_section_by_properties_map_,
11687         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11688         (Output_section::add_input_section): Handled deferred code-fill
11689         generation and remove an old comment.
11690         (Output_section::add_relaxed_input_section): New method definition.
11691         (Output_section::add_merge_input_section): Use merge section by
11692         properties map to speed to search.  Update merge section maps
11693         as appropriate.
11694         (Output_section::build_relaxation_map): New method definition.
11695         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11696         Same.
11697         (Output_section::relax_input_section): Renamed to
11698         Output_section::convert_input_sections_to_relaxed_sections and change
11699         interface to take a vector of pointers to relaxed sections.
11700         (Output_section::find_merge_section,
11701         Output_section::find_relaxed_input_section): New method definitions.
11702         (Output_section::is_input_address_mapped,
11703         Output_section::output_offset, Output_section::output_address):
11704         Use output section data maps to speed up searching.
11705         (Output_section::find_starting_output_address): Add comments.
11706         (Output_section::do_write,
11707         Output_section::write_to_postprocessing_buffer): Do code-fill
11708         generation as appropriate.
11709         (Output_section::get_input_sections): Invalidate relaxed input section
11710         map.
11711         (Output_section::restore_states): Adjust type of checkpoint .
11712         Invalidate relaxed input section map.
11713         * output.h (Output_merge_base): New class declaration.
11714         (Input_section_specifier): New class defintion.
11715         (class Output_relaxed_input_section) Change base class to
11716         Output_section_data_build.
11717         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11718         base class initializer.
11719         (Output_section::add_relaxed_input_section): New method declaration.
11720         (Output_section::Input_section): Change visibility to protected.
11721         (Output_section::Input_section::relobj,
11722         Output_section::Input_section::shndx): Handle relaxed input sections.
11723         Output_section::input_sections) Change visibility to protected.  Also
11724         define overload to return a non-const pointer.
11725         (Output_section::Merge_section_properties): New class defintion.
11726         (Output_section::Merge_section_by_properties_map,
11727         Output_section::Output_section_data_by_input_section_map,
11728         Output_section::Relaxation_map): New types.
11729         (Output_section::relax_input_section): Rename method to
11730         Output_section::convert_input_sections_to_relaxed_sections and change
11731         interface to take a vector of relaxed section pointers.
11732         (Output_section::find_merge_section,
11733         Output_section::find_relaxed_input_section,
11734         Output_section::build_relaxation_map,
11735         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11736         New method declarations.
11737         (Output_section::merge_section_map_
11738         Output_section::merge_section_by_properties_map_,
11739         Output_section::relaxed_input_section_map_,
11740         Output_section::is_relaxed_input_section_map_valid_,
11741         Output_section::generate_code_fills_at_write_): New data members.
11742         * script-sections.cc
11743         (Output_section_element_input::set_section_addresses): Call
11744         current_data_size and addralign methods of relaxed input sections.
11745         (Orphan_output_section::set_section_addresses): Call current_data_size
11746         and addralign methods of relaxed input sections.
11747         * symtab.cc (Symbol_table::compute_final_value): Extract template
11748         from the body of Symbol_table::sized_finalize_symbol.
11749         (Symbol_table::sized_finalized_symbol): Call
11750         Symbol_table::compute_final_value.
11751         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11752         (Symbol_table::compute_final_value): New templated method declaration.
11753         * target.cc (Target::do_make_output_section): New method defintion.
11754         * target.h (Target::make_output_section): New method declaration.
11755         (Target::relax): Add more parameters for input objects, symbol table
11756         and layout.  Adjust call to do_relax.
11757         (Target::do_make_output_section): New method declaration.
11758         (Target::do_relax): Add parameters for input objects, symbol table
11759         and layout.
11760
11761 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11762
11763         * pread.c: Include stdio.h.
11764
11765 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11766
11767         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11768         defined.
11769
11770 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11771
11772         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11773         Change read_shndx type to unsigned int.
11774         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11775         int.
11776         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11777         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11778         Change read_shndx type to unsigned int.
11779         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11780         int.
11781         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11782         * layout.cc (Layout::create_symtab_sections): Cast the result of
11783         local_symcount * symsize to off_t in the gold_assert.
11784
11785 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11786
11787         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11788         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11789         R_ARM_BASE_ABS.
11790         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11791         (Arm_relocate_functions::thm_abs5): New function.
11792         (Arm_relocate_functions::abs12): New function.
11793         (Arm_relocate_functions::abs16): New function.
11794         (Arm_relocate_functions::base_abs): New function.
11795         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11796         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11797         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11798         R_ARM_BASE_ABS.
11799         (Scan::global): Likewise.
11800         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11801         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11802         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11803         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11804         R_ARM_BASE_ABS.
11805
11806 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11807
11808         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11809         (Arm_relocate_functions::movt_prel): New function.
11810         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11811         (Arm_relocate_functions::thm_movt_prel): New function.
11812         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11813         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11814         (Scan::global, Relocate::relocate): Likewise.
11815         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11816
11817 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11818
11819         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11820         Incremental_checker.
11821         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11822         unsigned int.
11823         (class Incremental_inputs_header): New class.
11824         (Incremental_inputs_header_writer): Edit comment.
11825         (Incremental_inputs_entry): New class.
11826         (Incremental_inputs_entry_writer): Edit comment.
11827         (Sized_incremental_binary::do_find_incremental_inputs_section):
11828         Add *strtab_shndx parameter, fill it.
11829         (Sized_incremental_binary::do_check_inputs): New method.
11830         (Incremental_checker::can_incrementally_link_output_file): Use
11831         Sized_incremental_binary::check_inputs.
11832         (Incremental_inputs::report_command_line): Save command line in
11833         command_line_.
11834         * incremental.h:
11835         (Incremental_binary::find_incremental_inputs_section): New
11836         method.
11837         (Incremental_binary::do_find_incremental_inputs_section): Add
11838         strtab_shndx parameter.
11839         (Incremental_binary::do_check_inputs): New pure virtual method.
11840         (Sized_incremental_binary::do_check_inputs): Declare.
11841         (Incremental_checker::Incremental_checker): Add incremental_inputs
11842         parameter, use it to initialize incremental_inputs_.
11843         (Incremental_checker::incremental_inputs_): New field.
11844         (Incremental_checker::command_line): New method.
11845         (Incremental_checker::inputs): New method.
11846         (Incremental_checker::command_line_): New field.
11847
11848 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11849
11850         * incremental.cc: Include <cstdarg> and "target-select.h".
11851         (vexplain_no_incremental): New function.
11852         (explain_no_incremental): New function.
11853         (Incremental_binary::error): New method.
11854         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11855         method.
11856         (make_sized_incremental_binary): New function.
11857         (open_incremental_binary): New function.
11858         (can_incrementally_link_file): Add checks if output is ELF and has
11859         inputs section.
11860         * incremental.h: Include "elfcpp_file.h" and "output.h".
11861         (Incremental_binary): New class.
11862         (Sized_incremental_binary): New class.
11863         (open_incremental_binary): Declare.
11864         * object.cc (is_elf_object): Use
11865         elfcpp::Elf_recognizer::is_elf_file.
11866         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11867         * output.h (Output_file::filesize): New method.
11868
11869 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11870
11871         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11872         New function.
11873         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11874         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11875         function.
11876         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11877         function.
11878         (Arm_relocate_functions::movw_abs_nc): New function.
11879         (Arm_relocate_functions::movt_abs): New function.
11880         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11881         (Arm_relocate_functions::thm_movt_abs): New function.
11882         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11883         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11884         (Scan::global): Likewise.
11885         (Relocate::relocate): Likewise.
11886         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11887
11888 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11889
11890         * arm.cc (Arm_relocate_functions::got_prel) New function.
11891         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11892         (Relocate::relocate): Likewise.
11893         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11894
11895 2009-10-06  Ian Lance Taylor  <iant@google.com>
11896
11897         * options.h (class General_options): Define
11898         split_stack_adjust_size parameter.
11899         * object.h (class Object): Add uses_split_stack_ and
11900         has_no_split_stack_ fields.  Add uses_split_stack and
11901         has_no_split_stack accessor functions.  Declare
11902         handle_split_stack_section.
11903         (class Reloc_symbol_changes): Define.
11904         (class Sized_relobj): Define Function_offsets.  Declare
11905         split_stack_adjust, split_stack_adjust_reltype, and
11906         find_functions.
11907         * object.cc (Object::handle_split_stack_section): New function.
11908         (Sized_relobj::do_layout): Call handle_split_stack_section.
11909         * dynobj.cc (Sized_dynobj::do_layout): Call
11910         handle_split_stack_section.
11911         * reloc.cc (Sized_relobj::relocate_sections): Call
11912         split_stack_adjust for executable sections in split_stack
11913         objects.  Pass reloc_map to relocate_section.
11914         (Sized_relobj::split_stack_adjust): New function.
11915         (Sized_relobj::split_stack_adjust_reltype): New function.
11916         (Sized_relobj::find_functions): New function.
11917         * target-reloc.h: Include "object.h".
11918         (relocate_section): Add reloc_symbol_changes parameter.  Change
11919         all callers.
11920         * target.h (class Target): Add calls_non_split method.  Declare
11921         do_calls_non_split virtual method.  Declare match_view and
11922         set_view_to_nop.
11923         * target.cc: Include "elfcpp.h".
11924         (Target::do_calls_non_split): New function.
11925         (Target::match_view): New function.
11926         (Target::set_view_to_nop): New function.
11927         * gold.cc (queue_middle_tasks): Give an error if mixing
11928         split-stack and non-split-stack objects with -r.
11929         * i386.cc (Target_i386::relocate_section): Add
11930         reloc_symbol_changes parameter.
11931         (Target_i386::do_calls_non_split): New function.
11932         * x86_64.cc (Target_x86_64::relocate_section): Add
11933         reloc_symbol_changes parameter.
11934         (Target_x86_64::do_calls_non_split): New function.
11935         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11936         parameter.
11937         * powerpc.cc (Target_powerpc::relocate_section): Add
11938         reloc_symbol_changes parameter.
11939         * sparc.cc (Target_sparc::relocate_section): Add
11940         reloc_symbol_changes parameter.
11941         * configure.ac: Call AM_CONDITIONAL for the default target.
11942         * configure: Rebuild.
11943         * testsuite/Makefile.am (TEST_AS): New variable.
11944         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11945         (check_DATA): Add split_i386 and split_x86_64 files.
11946         (SPLIT_DEFSYMS): Define.
11947         (split_i386_[1234n].o): New targets.
11948         (split_i386_[124]): New targets.
11949         (split_i386_[1234r].stdout): New targets.
11950         (split_x86_64_[1234n].o): New targets.
11951         (split_x86_64_[124]): New targets.
11952         (split_x86_64_[1234r].stdout): New targets.
11953         (MOSTLYCLEANFILES): Add new executables.
11954         * testsuite/split_i386.sh: New file.
11955         * testsuite/split_x86_64.sh: New file.
11956         * testsuite/split_i386_1.s: New file.
11957         * testsuite/split_i386_2.s: New file.
11958         * testsuite/split_i386_3.s: New file.
11959         * testsuite/split_i386_4.s: New file.
11960         * testsuite/split_i386_n.s: New file.
11961         * testsuite/split_x86_64_1.s: New file.
11962         * testsuite/split_x86_64_2.s: New file.
11963         * testsuite/split_x86_64_3.s: New file.
11964         * testsuite/split_x86_64_4.s: New file.
11965         * testsuite/split_x86_64_n.s: New file.
11966         * testsuite/testfile.cc (Target_test): Update relocation_section
11967         function.
11968         * testsuite/Makefile.in: Rebuild.
11969
11970 2009-10-06  Ian Lance Taylor  <iant@google.com>
11971
11972         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11973         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11974         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11975         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11976         the address on ldo_addrs_.
11977         (Target_i386::Relocate::fix_up_ldo): New function.
11978
11979 2009-10-06   Rafael Espindola  <espindola@google.com>
11980
11981         * plugin.cc (add_input_library): New.
11982         (Plugin::load): Add add_input_library to tv.
11983         (Plugin_manager::add_input_file): Add the is_lib argument.
11984         (add_input_file): Update call to Plugin_manager::add_input_file.
11985         (add_input_library): New.
11986         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11987
11988 2009-09-30  Doug Kwan  <dougkwan@google.com>
11989
11990         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11991         symbol and call Symbol::may_need_copy_reloc to determine if
11992         a copy reloc is needed.
11993         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11994         nocopyreloc is given in command line.
11995         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11996         given in command line.
11997         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11998         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11999         of the removed Target_i386::may_need_copy_reloc.
12000         * options.h (copyreloc): New option with default value false.
12001         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12002         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12003         instead of the removed Target_powerpc::may_need_copy_reloc.
12004         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12005         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12006         instead of the removed Target_sparc::may_need_copy_reloc.
12007         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12008         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12009         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12010         instead of the removed Target_x86_64::may_need_copy_reloc.
12011
12012 2009-09-30  Ian Lance Taylor  <iant@google.com>
12013
12014         * object.h (class Object): Remove target_ field, and target,
12015         sized_target, and set_target methods.
12016         (Object::sized_target): Remove.
12017         (class Sized_relobj): Update declarations.  Remove sized_target.
12018         * object.cc (Sized_relobj::setup): Remove target parameter.
12019         Change all callers.
12020         (Input_objects::add_object): Don't do anything with the target.
12021         (make_elf_sized_object): Add punconfigured parameter.  Change all
12022         callers.  Set or test parameter target.
12023         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12024         Change all callers.
12025         * parameters.cc (Parameters::set_target): Change parameter type to
12026         be non-const.
12027         (Parameters::default_target): Remove.
12028         (set_parameters_target): Change parameter type to be non-const.
12029         (parameters_force_valid_target): New function.
12030         (parameters_clear_target): New function.
12031         * parameters.h (class Parameters): Update declarations.  Remove
12032         default_target method.  Add sized_target and clear_target
12033         methods.  Change target_ to be non-const.
12034         (set_parameters_target): Update declaration.
12035         (parameters_force_valid_target): Declare.
12036         (parameters_clear_target): Declare.
12037         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12038         as NULL if we aren't searching.
12039         (Add_symbols::run): Don't check for compatible target.
12040         * fileread.cc (Input_file::open_binary): Call
12041         parameters_force_valid_target.
12042         * gold.cc (queue_middle_tasks): Likewise.
12043         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12044         set_target on object.
12045         * dynobj.h (class Sized_dynobj): Update declarations.
12046         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12047         make_elf_object returns NULL.
12048         (Archive::include_member): Don't check whether object target is
12049         compatible.
12050         * output.cc (Output_section::add_input_section): Get target from
12051         parameters.
12052         (Output_section::relax_input_section): Likewise.
12053         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12054         parameters.
12055         (Sized_relobj::do_scan_relocs): Likewise.
12056         (Sized_relobj::relocate_sections): Likewise.
12057         * resolve.cc (Symbol_table::resolve): Likewise.
12058         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12059         parameter.  Change all callers.
12060         (Symbol_table::add_from_object): Get target from parameters.
12061         (Symbol_table::add_from_relobj): Don't check object target.
12062         (Symbol_table::add_from_dynobj): Likewise.
12063         (Symbol_table::define_special_symbol): Get target from
12064         parameters.
12065         * symtab.h (class Symbol_table): Update declaration.
12066         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12067         parameter.  Change all callers.  Clear parameter target.
12068         (Binary_test): Test target here.
12069         * testsuite/object_unittest.cc (gold_testsuite): Remove
12070         target_test_pointer parameter.  Change all callers.
12071         (Object_test): Test target here.
12072
12073 2009-09-26  Ian Lance Taylor  <iant@google.com>
12074
12075         * testsuite/initpri1.c: Don't try to use constructor priorities if
12076         compiling with gcc before 4.3.
12077
12078 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12079
12080         * testsuite/retain_symbols_file_test.sh (check_present): Change
12081         output file name to retain_symbols_file_test.stdout.
12082         (check_absent): Likewise.
12083
12084 2009-09-18  Craig Silverstein  <csilvers@google.com>
12085
12086         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12087         * options.cc: Include <cerrno> and <fstream>.
12088         (General_options::finalize): Parse -retain-symbols-file tag.
12089         * options.h: New flag.
12090         (General_options): New method should_retain_symbol, new
12091         variable symbols_to_retain.
12092         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12093         should_retain_symbol map.
12094         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12095         * testsuite/Makefile.in: Regenerate.
12096         * testsuite/retain_symbols_file_test.sh: New file.
12097
12098 2009-09-18  Nick Clifton  <nickc@redhat.com>
12099
12100         * po/es.po: Updated Spanish translation.
12101
12102 2009-09-17  Doug Kwan  <dougkwan@google.com>
12103
12104         * debug.h (DEBUG_RELAXATION): New constant.
12105         (DEBUG_ALL): Add DEBUG_RELAXATION.
12106         (debug_string_to_enum): Add relaxation debug option.
12107         * layout.cc
12108         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12109         Layout::Relaxation_debug_check::read_sections,
12110         Layout::Relaxation_debug_check::read_sections): New method definitions.
12111         (Layout::Layout): Initialize data members
12112         record_output_section_data_from_scrips_,
12113         script_output_section_data_list_ and relaxation_debug_check_.
12114         (Layout::save_segments, Layout::restore_segments,
12115         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12116         Layout::relaxation_loop_body): New method definitions.
12117         (Layout::finalize): Support relaxation.  Move section layout code to
12118         Layout::relaxation_loop_body.
12119         (Layout::set_asection_address_from_script): Move code for orphan
12120         section placement out.
12121         (Layout::place_orphan_sections_in_script): New method definition.
12122         * layout.h (Output_segment_headers, Output_file_header):
12123         New forward class declarations.
12124         (Layout::~Layout): Define.
12125         (Layout::new_output_section_data_from_script): New method definition.
12126         (Layout::place_orphan_sections_in_script): New method declaration.
12127         (Layout::Segment_states): New type declaration.
12128         (Layout::save_segments, Layout::restore_segments,
12129         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12130         Layout::relaxation_loop_body): New method declarations.
12131         (Layout::Output_section_data_list): New type declaration.
12132         (Layout::Relaxation_debug_check): New class definition.
12133         (Layout::record_output_section_data_from_script_,
12134         Layout::script_output_section_data_list_, Layout::segment_states_,
12135         Layout::relaxation_debug_check_): New data members.
12136         * output.cc: (Output_section_headers::do_size): New method definition.
12137         (Output_section_headers::Output_section_headers): Move size
12138         computation to Output_section_headers::do_size.
12139         (Output_segment_headers::do_size): New method definition.
12140         (Output_file_header::Output_file_header): Move size computation to
12141         Output_file_header::do_size and call it.
12142         (Output_file_header::do_size): New method definition.
12143         (Output_data_group::Output_data_group): Adjust call to
12144         Output_section_data.
12145         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12146         (Output_symtab_xindex::do_write): Add array bound check.
12147         (Output_section::Input_section::print_to_mapfile): Handle
12148         RELAXED_INPUT_SECTION_CODE.
12149         (Output_section::Output_section): Initialize data member checkpoint_.
12150         (Output_section::~Output_section): Delete checkpoint object pointed
12151         by checkpoint_.
12152         (Output_section::add_input_section): Always add an Input_section if
12153         relaxing.
12154         (Output_section::add_merge_input_section): Add assert.
12155         (Output_section::relax_input_section): New method definition.
12156         (Output_section::set_final_data_size): Set load address to zero for
12157         an unallocated section.
12158         (Output_section::do_address_and_file_offset_have_reset_values):
12159         New method definition.
12160         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12161         Handle relaxed input section.
12162         (Output_section::sort_attached_input_sections): Checkpoint input
12163         section list lazily.
12164         (Output_section::get_input_sections): Change type of input_sections to
12165         list of Simple_input_section pointers.  Checkpoint input section list
12166         lazily.  Also handle relaxed input sections.
12167         (Output_section::add_input_section_for_script): Take a reference to
12168         a Simple_input_section object instead of Relobj pointer and section
12169         index as parameter.  Handle relaxed input sections.
12170         (Output_section::save_states, Output_section::restore_states): New
12171         method definitions.
12172         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12173         (Output_data::is_data_size_fixed): New method definition.
12174         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12175         if it is fixed.
12176         (Output_data::address_and_file_offset_have_reset_values): New method
12177         definition.
12178         (Output_data::do_address_and_file_offset_have_reset_values): New method
12179         definition.
12180         (Output_data::set_data_size): Check that data size is not fixed.
12181         (Output_data::fix_data_size): New method definition.
12182         (Output_data::is_data_size_fixed_): New data member.
12183         (Output_section_headers::set_final_data_size): New method definition.
12184         (Output_section_headers::do_size): New method declaration.
12185         (Output_segment_headers::set_final_data_size): New method definition.
12186         (Output_segment_headers::do_size): New method declaration.
12187         (Output_file_header::set_final_data_size)::New method definition.
12188         (Output_file_header::do_size)::New method declaration.
12189         (Output_section_data::Output_section_data): Add new parameter
12190         is_data_size_fixed and use it to fix data size.
12191         (Output_data_const::Output_data_const): Adjust call to base class
12192         constructor and fix data size.
12193         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12194         base class constructor and fix data size.
12195         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12196         base class constructor and fix data size.
12197         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12198         class constructor and fix data size.
12199         (Output_data_group::set_final_data_size): New method definition.
12200         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12201         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12202         class constructor and fix data size.
12203         (Output_relaxed_input_section): New class definition.
12204         (Output_section::Simple_input_section): New class definition.
12205         (Output_section::get_input_sections): Adjust parameter list.
12206         (Output_section::add_input_section_for_script): Same.
12207         (Output_section::save_states, Output_section::restore_states,
12208         Output_section::do_address_and_file_offset_have_reset_values,
12209         (Output_section::Input_section::Input_section): Handle
12210         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12211         Output_relaxed_input_section.
12212         (Output_section::Input_section::is_input_section,
12213         Output_section::Input_section::set_output_section): Handle relaxed
12214         input section.
12215         (Output_section::Input_section::is_relaxed_input_section,
12216         Output_section::Input_section::output_section_data,
12217         Output_section::Input_section::relaxed_input_section): New method
12218         definitions.
12219         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12220         value.
12221         (Output_section::Input_section::u1_): Update comments.
12222         (Output_section::Input_section::u2_): Add new union member poris.
12223         (Output_section::Checkpoint_output_section): New classs definition.
12224         (Output_section::relax_input_section): New method declaration.
12225         (Output_section::checkpoint_): New data member.
12226         (Output_segment): Update comments.
12227         (Output_segment::Output_segment): Un-privatize copy constructor.
12228         (Output_segment::operator=): Un-privatize.
12229         * script-sections.cc (Output_section_element::Input_section_list):
12230         Change element type to Output_section::Simple_input_section.
12231         (Output_section_element_dot_assignment::set_section_addresses):
12232         Register output section data for relaxation clean up.
12233         (Output_data_exression::Output_data_expression): Adjust call to base
12234         constructor to fix data size.
12235         (Output_section_element_data::set_section_addresses): Register
12236         Output_data_expression object for relaxation clean up.
12237         (struct Input_section_info): Replace Relobj pointer and section index
12238         pair with Output_section::Simple_input_section and Convert struct to a
12239         class.
12240         (Input_section_sorter::operator()): Adjust access to
12241         Input_section_info data member to use accessors.
12242         (Output_section_element_input::set_section_addresses): Use layout
12243         parameter.  Adjust code to use Output_section::Simple_input_section
12244         and Input_secction_info classes.  Register filler for relaxation
12245         clean up.
12246         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12247         and section index pair with Output_section::Simple_input_section
12248         class.  Adjust code accordingly.
12249         (Phdrs_element::release_segment): New method definition.
12250         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12251         segment list.
12252         (Script_sections::release_segments): New method definition.
12253         * gold/script-sections.h (Script_sections::release_segments): New
12254         method declaration.
12255         * gold/target.h (Target::may_relax, Target::relax,
12256         Target::do_may_relax, Target::do_relax): New method definitions.
12257
12258 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12259
12260         * arm.cc (has_signed_unsigned_overflow): New function.
12261         (Arm_relocate_functions::abs8): New function.
12262         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12263         (Target_arm::Scan::global): Likewise.
12264         (Target_arm::relocate::relocate): Likewise.
12265         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12266         Likewise.
12267
12268 2009-09-16  Cary Coutant  <ccoutant@google.com>
12269
12270         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12271         * testsuite/Makefile.in: Regenerate.
12272
12273 2009-09-11  Nick Clifton  <nickc@redhat.com>
12274
12275         * po/gold.pot: Updated by the Translation project.
12276
12277 2009-09-08  Cary Coutant  <ccoutant@google.com>
12278
12279         * output.cc (Output_file::open): Add execute permission to empty file.
12280         * testsuite/Makefile.am (permission_test): New test.
12281         * testsuite/Makefile.in: Regenerate.
12282
12283 2009-09-02  Ian Lance Taylor  <iant@google.com>
12284
12285         * output.cc (Output_file::resize): Call map_no_anonymous rather
12286         than map.
12287
12288 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12289
12290         * gold.cc: Include "incremental.h".
12291         (queue_initial_tasks): Call Incremental_checker methods.
12292         * incremental.cc: Include "output.h".
12293         (Incremental_checker::can_incrementally_link_output_file): New
12294         method.
12295         * incremental.h (Incremental_checker): New class.
12296
12297         * output.cc (Output_file::open_for_modification): New method.
12298         (Output_file::map_anonymous): Changed return type to bool.  Record
12299         map in base_ field.
12300         (Output_file::map_no_anonymous): New method, broken out of map.
12301         (Output_file::map): Use map_no_anonymous and map_anonymous.
12302         * output.h (class Output_file): Update declarations.
12303
12304 2009-08-24  Cary Coutant  <ccoutant@google.com>
12305
12306         * options.h (Command_line::Pre_options): New class.
12307         (Command_line::pre_options): New member.
12308         * options.cc (gold::options::ready_to_register): New variable.
12309         (One_option::register_option): Do nothing if not registering options.
12310         Assert if same short option registered twice.
12311         (General_options::General_options): Turn off option registration when
12312         done constructing.
12313         (Command_line::Pre_options::Pre_options): New constructor.
12314
12315 2009-08-24  Cary Coutant  <ccoutant@google.com>
12316
12317         * options.h (General_options::no_keep_memory): Remove incorrect
12318         short option.
12319
12320 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12321
12322         * Makefile.am (am__skiplex, am__skipyacc): New.
12323         * Makefile.in: Regenerate.
12324
12325 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12326
12327         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12328         (INCLUDES): ... this.
12329         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12330         (AM_CPPFLAGS): Renamed from ...
12331         (INCLUDE): ... this.
12332         * Makefile.in, testsuite/Makefile.in: Regenerate.
12333
12334         * Makefile.in: Regenerate.
12335         * aclocal.m4: Likewise.
12336         * config.in: Likewise.
12337         * configure: Likewise.
12338         * testsuite/Makefile.in: Likewise.
12339
12340         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12341         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12342         * Makefile.in: Regenerate.
12343         * testsuite/Makefile.in: Regenerate.
12344
12345 2009-08-19  Cary Coutant  <ccoutant@google.com>
12346
12347         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12348         symbols in shared libraries overridden by hidden or internal symbols
12349         in the main program.
12350
12351 2009-08-19  Chris Demetriou  <cgd@google.com>
12352
12353         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12354         checking source file names in error messages.
12355
12356 2009-08-18  Doug Kwan  <dougkwan@google.com>
12357
12358         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12359         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12360         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12361         an elfcpp::Ehdr as parameter.
12362         * object.cc (Object::set_target): Remove the version that looks up
12363         a target and sets it.
12364         (Sized_relobj::setup): Take a Target object instead of
12365         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12366         (make_elf_sized_object): Find target and ask target to
12367         make an ELF object.
12368         * object.h: (Object::set_target): Remove the version that looks up
12369         a target and sets it.
12370         (Sized_relobj::setup): Take a Target object instead of
12371         an elfcpp:Ehdr as parameter.
12372         * target.cc: Include dynobj.h.
12373         (Target::do_make_elf_object_implementation): New.
12374         (Target::do_make_elf_object): New.
12375         * target.h (Target::make_elf_object): New template declaration.
12376         (Target::do_make_elf_object): New method declarations.
12377         (Target::do_make_elf_object_implementation): New template declaration.
12378
12379 2009-08-14  Ian Lance Taylor  <iant@google.com>
12380
12381         * gold.h (FUNCTION_NAME): Define.
12382         (gold_unreachable): Use FUNCTION_NAME.
12383
12384 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12385
12386         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12387         symbol in the --keep-unique list is not found.
12388
12389 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12390
12391         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12392         been maked as --keep-unique.
12393         (Icf::unfold_section): New function.
12394         * icf.h (Icf::unfold_section): New function.
12395         * options.h (General_options::keep_unique): New option.
12396         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12397         * testsuite/Makefile.in: Regenerate.
12398         * testsuite/icf_keep_unique_test.sh: New file.
12399         * testsuite/icf_keep_unique_test.cc: New file.
12400
12401 2009-08-12  Cary Coutant  <ccoutant@google.com>
12402
12403         PR 10471
12404         * resolve.cc (Symbol_table::resolve): Check for references from
12405         dynamic objects to hidden and internal symbols.
12406         * testsuite/Makefile.am (hidden_test.sh): New test.
12407         * testsuite/Makefile.in: Regenerate.
12408         * testsuite/hidden_test.sh: New script.
12409         * testsuite/hidden_test_1.c: New test source.
12410         * testsuite/hidden_test_main.c: New test source.
12411
12412 2009-08-11  Doug Kwan  <dougkwan@google.com>
12413
12414         * arm.cc: Update comments.
12415         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12416         segment to locate the .ARM.exidx section if present.
12417
12418 2009-08-09  Doug Kwan  <dougkwan@google.com>
12419
12420         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12421         patch.
12422
12423 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12424         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12425         compiler warnings.
12426
12427 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12428
12429         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12430         valid tls_segment only for non-debug-section relocations.
12431         * testsuite/Makefile.am: Add gc_tls_test.
12432         * testsuite/Makefile.in: Regenerate.
12433         * testsuite/gc_tls_test.cc: New file.
12434         * testsuite/gc_tls_test.sh: New file.
12435
12436 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12437
12438         * icf.cc: New file.
12439         * icf.h: New file.
12440         * Makefile.am (CCFILES): Add icf.cc.
12441         (HFILES): Add icf.h
12442         * Makefile.in: Regenerate.
12443         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12444         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12445         section, symbol and addend information for the relocs.
12446         * gold.cc (queue_middle_tasks): Call identical code folding.
12447         * gold.h: Add defines for multimap.
12448         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12449         to the call of finalize_local_symbols.
12450         * main.cc (main): Create object of class Icf.
12451         * object.cc (Sized_relobj::do_layout): Allow this function to be
12452         called twice during icf.
12453         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12454         to sections marked as identical by icf.
12455         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12456         when available.
12457         (Sized_relobj::do_section_entsize): New function.
12458         * object.h (Object::section_entsize): New function.
12459         (Object::do_section_entsize): New pure virtual function.
12460         (Relobj::finalize_local_symbols): Add new parameter.
12461         (Relobj::do_section_entsize): New function.
12462         * options.h (General_options::icf): New option.
12463         (General_options::icf_iterations): New option.
12464         (General_options::print_icf_sections): New option.
12465         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12466         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12467         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12468         icf.
12469         * symtab.cc (Symbol_table::is_section_folded): New function.
12470         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12471         to sections marked as identical by icf.
12472         * symtab.h (Symbol_table::set_icf): New function.
12473         (Symbol_table::icf): New function.
12474         (Symbol_table::is_section_folded): New function.
12475         (Symbol_table::icf_): New data member.
12476         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12477         * testsuite/Makefile.am: Add commands to build icf_test.
12478         * testsuite/Makefile.in: Regenerate.
12479         * testsuite/icf_test.sh: New file.
12480         * testsuite/icf_test.cc: New file.
12481
12482 2009-07-24  Chris Demetriou  <cgd@google.com>
12483
12484         * layout.cc (is_compressible_debug_section): Fix incorrect
12485         comment about compressed section names.
12486
12487 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12488
12489         PR 10419
12490         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12491
12492 2009-07-16  Ian Lance Taylor  <iant@google.com>
12493
12494         PR 10400
12495         * layout.h: #include <map>.
12496         (class Kept_section): Change from struct to class.  Add accessors
12497         and setters.  Add section size to Comdat_group mapping.  Change
12498         Comdat_group to std::map.  Add is_comdat_ field.  Add
12499         linkonce_size field in union.
12500         (class Layout): Update declaration of find_or_add_kept_section.
12501         Don't declare find_kept_object.
12502         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12503         parameter.  Add object, shndx, is_comdat, and is_group_name
12504         parameters.  Change all callers.  Adjust for new Kept_section.
12505         (Layout::find_kept_object): Remove.
12506         * object.cc (Sized_relobj::include_section_group): Update use of
12507         Kept_section.  Rename secnum to shndx.  Only record
12508         Kept_comdat_section if sections are the same size.
12509         (Sized_relobj::include_linkonce_section): Update use of
12510         Kept_section.  Only record Kept_comdat_section if sections are the
12511         same size.  Set size of linkonce section.
12512         (Sized_relobj::map_to_kept_section): Update call to
12513         get_kept_comdat_section.
12514         * object.h (class Sized_relobj): Rename fields in
12515         Kept_comdat_section to drop trailing underscores; change object
12516         field to Relobj*.  Change Kept_comdat_section_table to store
12517         struct rather than pointer.
12518         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12519         Add kept_object and kept_shndx parameters.  Change all callers.
12520         (Sized_relobj::get_kept_comdat_section): Change return type to
12521         bool.  Add kept_object and kept_shndx parameters.  Change all
12522         callers.
12523         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12524         Layout::find_or_add_kept_section.
12525
12526 2009-07-09  Ian Lance Taylor  <iant@google.com>
12527
12528         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12529         Reserve space in the hash table.
12530
12531 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12532
12533         * fileread.cc (File_read::get_mtime): New method.
12534         * fileread.h (Timespec): New structure.
12535         (File_read::get_mtime): New method.
12536         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12537         Renamed from timestamp_nsec.
12538         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12539         Elf_Xword.
12540         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12541         timestamp_nsec.
12542         (Incremental_inputs::report_archive): Save mtime; style fix.
12543         (Incremental_inputs::report_obejct): Save mtime; style fix.
12544         (Incremental_inputs::report_script): Save mtime; style fix.
12545         (Incremental_inputs::finalize_inputs): Style fix.
12546         (Incremental_inputs::finalize): Style fix.
12547         (Incremental_inputs::create_input_section_data): Store inputs
12548         mtime.
12549         * incremental.h (Incremental_inputs::report_script): Add mtime
12550         argument.
12551         (Incremental_inputs::Input_info::Input_info): Intialize only one
12552         union member.
12553         (Incremental_inputs::Input_info::archive): Move to nameless
12554         union.
12555         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12556         (Incremental_inputs::Input_info::script): Move to nameless union.
12557         (Incremental_inputs::mtime): New field.
12558         * script.cc (read_input_script): Pass file mtime to
12559         Incremental_input.
12560         * script.h (Script_info::inputs): Style fix.
12561
12562 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12563
12564         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12565         instead of 32.
12566
12567 2009-06-24  Ian Lance Taylor  <iant@google.com>
12568
12569         PR 10156
12570         * layout.cc (Layout::choose_output_section): If we find an
12571         existing section, update the flags.
12572         (Layout::create_notes): New function, broken out of
12573         Layout::finalize.
12574         (Layout::finalize): Don't create note sections.
12575         (Layout::create_note): Don't crash if linker script discards
12576         section.
12577         (Layout::create_gold_note): Likewise.
12578         (Layout::create_build_id): Likewise.  Don't set
12579         after_input_sections on the section.
12580         (Layout::create_executable_stack_info): Remove target parameter.
12581         Change caller.
12582         * layout.h (class Layout): Declare create_notes.  Update
12583         declaration of create_executable_stack_info.
12584         * gold.cc (queue_middle_tasks): Call create_notes.
12585         * output.cc (Output_section::update_flags_for_input_section): Move
12586         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12587         invalid.
12588         * output.h (Output_data::mark_address_invalid): New function.
12589         (class Output_section): Only declare, not define,
12590         update_flags_for_input_section.  Remove set_flags.
12591
12592 2009-06-24  Ian Lance Taylor  <iant@google.com>
12593
12594         * script-sections.cc (Output_section_definition::
12595         set_section_addresses): Rename shadowing local load_address to
12596         laddr.
12597
12598 2009-06-24  Ian Lance Taylor  <iant@google.com>
12599
12600         PR 10244
12601         * reloc.cc (relocate_sections): Skip empty relocation sections.
12602
12603 2009-06-23  Ian Lance Taylor  <iant@google.com>
12604
12605         PR 10156
12606         * layout.cc (Layout::create_note): Use choose_output_section
12607         rather than make_output_section.
12608
12609 2009-06-23  Ian Lance Taylor  <iant@google.com>
12610
12611         PR 10237
12612         * options.cc (General_options::parse_V): Set printed_version_.
12613         (General_options::General_options): Initialize printed_version_.
12614         * options.h (class General_options): Add printed_version_ field.
12615         * gold.cc (queue_initial_tasks): If there are no input files,
12616         don't give a fatal error if we printed the version information.
12617         (queue_middle_tasks): If using -r with a shared object, give a
12618         fatal error rather than an ordinary error.
12619
12620 2009-06-23  Ian Lance Taylor  <iant@google.com>
12621
12622         PR 10219
12623         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12624         (Layout::make_output_section): Set have_stabstr_section_ if we see
12625         a .stab*str section.
12626         (Layout::finalize): Call link_stabs_sections.
12627         (Layout::link_stabs_sections): New file.
12628         * layout.h (class Layout): Add have_stabstr_section_ field.
12629         Declare link_stabs_sections.
12630
12631 2009-06-23  Doug Kwan  <dougkwan@google.com>
12632
12633         * Makefile.am (libgold_a_LIBADD): New.
12634         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12635         * Makefile.in: Regenerate.
12636         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12637         * configure: Regenerate.
12638         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12639         * fileread.cc: Include sys/state.h
12640         * gold.h: Declare memmem and strndup if found missing.
12641         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12642
12643 2009-06-23  Ian Lance Taylor  <iant@google.com>
12644
12645         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12646         * configure: Rebuild.
12647
12648 2009-06-23  Ian Lance Taylor  <iant@google.com>
12649
12650         PR 10147
12651         * object.cc (Object::section_contents): Don't try to get a view if
12652         the section has length zero.
12653         (Object::handle_gnu_warning_section): If the section is empty, use
12654         the name of the section as the warning.
12655
12656 2009-06-23  Ian Lance Taylor  <iant@google.com>
12657
12658         PR 10133
12659         * stringpool.h (class Stringpool_template): Add optimize_ field.
12660         (Stringpool_template::set_optimize): New function.
12661         * stringpool.cc (Stringpool_template::Stringpool_template):
12662         Initialize optimize_ field.
12663         (Stringpool_template::set_string_offsets): Test local optimize
12664         fild rather than parameter.
12665         * layout.cc (Layout::Layout): Call set_optimize on the section
12666         name stringpool.
12667
12668 2009-06-22  Ian Lance Taylor  <iant@google.com>
12669
12670         PR 10030
12671         * yyscript.y: Parse TARGET.
12672         * script.cc (script_set_target): New function.
12673         * script-c.h (script_set_target): Declare.
12674         * options.cc (General_options::string_to_object_format): Rename
12675         from string_to_object_format in anonymous namespace.  Change
12676         callers.
12677         * options.h (class General_options): Declare
12678         string_to_object_format.
12679
12680 2009-06-22  Ian Lance Taylor  <iant@google.com>
12681
12682         * script-sections.cc (Script_sections::create_segments): Don't put
12683         program headers in a PT_LOAD segment if -n or -N.
12684
12685 2009-06-22  Ian Lance Taylor  <iant@google.com>
12686
12687         PR 10141
12688         * options.h (class General_options): Add -z lazy and -z now.  Sort
12689         -z options into alphabetical order.
12690         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12691
12692 2009-06-21  Ian Lance Taylor  <iant@google.com>
12693
12694         * layout.cc (Layout::make_output_section): Call
12695         Target::new_output_section.
12696         (Layout::attach_allocated_section_to_segment): Put large section
12697         sections in a separate load segment with the large segment flag
12698         set.
12699         (Layout::segment_precedes): Sort large data segments after other
12700         load segments.
12701         (align_file_offset): New static function.
12702         (Layout::set_segment_offsets): Use align_file_offset.
12703         * output.h (class Output_section): Add is_small_section_ and
12704         is_large_section_ fields.
12705         (Output_section::is_small_section): New function.
12706         (Output_section::set_is_small_section):  New function.
12707         (Output_section::is_large_section): New function.
12708         (Output_section::set_is_large_section): New function.
12709         (Output_section::is_large_data_section): New function.
12710         (class Output_segment): Add is_large_data_segment_ field.
12711         (Output_segment::is_large_data_segment): New function.
12712         (Output_segment::set_is_large_data_segment): New function.
12713         * output.cc (Output_section::Output_section): Initialize new
12714         fields.
12715         (Output_segment::Output_segment): Likewise.
12716         (Output_segment::add_output_section): Add assertion that large
12717         data sections always go in large data segments.  Force small data
12718         sections to the end of the list of data sections.  Force small BSS
12719         sections to the start of the list of BSS sections.  For large BSS
12720         sections to the end of the list of BSS sections.
12721         * symtab.h (class Symbol): Declare is_common_shndx.
12722         (Symbol::is_defined): Check Symbol::is_common_shndx.
12723         (Symbol::is_common): Likewise.
12724         (class Symbol_table): Define enum Commons_section_type.  Update
12725         declarations.  Add small_commons_ and large_commons_ fields.
12726         * symtab.cc (Symbol::is_common_shndx): New function.
12727         (Symbol_table::Symbol_table): Initialize new fields.
12728         (Symbol_table::add_from_object): Put small and large common
12729         symbols in the right list.
12730         (Symbol_table::sized_finalized_symbol): Check
12731         Symbol::is_common_shndx.
12732         (Symbol_table::sized_write_globals): Likewise.
12733         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12734         common symbol lists.  Don't call do_allocate_commons_list if the
12735         list is empty.
12736         (Symbol_table::do_allocate_commons_list): Remove is_tls
12737         parameter.  Add comons_section_type parameter.  Change all
12738         callers.  Handle small and large common symbols.
12739         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12740         Symbol::is_common_shndx.
12741         * resolve.cc (symbol_to_bits): Likewise.
12742         * target.h (Target::small_common_shndx): New function.
12743         (Target::small_common_section_flags): New function.
12744         (Target::large_common_shndx): New function.
12745         (Target::large_common_section_flags): New function.
12746         (Target::new_output_section): New function.
12747         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12748         small_common_section_flags, and large_common_section_flags
12749         fields.
12750         (Target::do_new_output_section): New virtual function.
12751         * arm.cc (Target_arm::arm_info): Initialize new fields.
12752         * i386.cc (Target_i386::i386_info): Likewise.
12753         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12754         Likewise.
12755         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12756         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12757         (Target_x86_64::do_new_output_section): New function.
12758         * configure.ac: Define conditional MCMODEL_MEDIUM.
12759         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12760         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12761         (large_LDFLAGS): Define.
12762         * testsuite/large.c: New file.
12763         * testsuite/testfile.cc (Target_test::test_target_info):
12764         Initialize new fields.
12765         * configure, testsuite/Makefile.in: Rebuild.
12766
12767 2009-06-05  Doug Kwan  <dougkwan@google.com>
12768
12769         * Makefile.am (CCFILES): Add target.cc.
12770         * Makefile.in: Regenerate.
12771         * i386.cc (class Target_i386): Define new virtual method to
12772         override do_is_local_label_name in parent.
12773         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12774         local symbols if --discard-locals or -X is given.
12775         * options.h (class General_options): Declare new options
12776         '--discard-locals' and '-X' for discarding locals.
12777         * target.h (class Target): Define new methods is_local_label_name.
12778         Declare new virtual method do_is_local_label_name.
12779         * target.cc: New file.
12780         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12781         (check_SCRIPTS): Add discard_locals_test.sh.
12782         (check_DATA): Add discard_local_tests.syms.
12783         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12784         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12785         * testsuite/Makefile.in: Regenerate.
12786         * testsuite/discard_locals_test.c: New file.
12787         * testsuite/discard_locals_test.sh: Same.
12788
12789 2009-06-05  Doug Kwan  <dougkwan@google.com>
12790
12791         * object.cc (Sized_relobj::Sized_relobj): Initialize
12792         discarded_eh_frame_shndx_ to -1U.
12793         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12794         section.
12795         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12796         a discarded .eh_frame section.
12797         (Sized_relobj::do_finalize_local_symbols): Ditto.
12798         * object.h (class Sized_relobj): Declare new member
12799         discarded_eh_frame_shndx_.
12800         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12801         (local_labels_test.o, local_labels_test): New rules.
12802         * testsuite/Makefile.in: Regenerate.
12803
12804 2009-06-04  Doug Kwan  <dougkwan@google.com>
12805
12806         * layout.cc (Layout::section_name_mapping): Add mapping for
12807         special ARM sections.
12808
12809 2009-06-03  Doug Kwan  <dougkwan@google.com>
12810
12811         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12812         (utils::has_overflow): Same.
12813
12814 2009-06-03  Ian Lance Taylor  <iant@google.com>
12815
12816         * layout.cc (Layout::section_name_mapping): New array, replacing
12817         Layout::linkonce_mapping.
12818         (Layout::section_name_mapping_count): New variable, replacing
12819         Layout::linkonce_mapping_count.
12820         (Layout::linkonce_output_name): Remove.
12821         (Layout::output_section_name): Rewrite.
12822         * layout.h (class Layout): Rename Linkonce_mapping to
12823         Section_name_mapping, linkonce_mapping to section_name_mapping,
12824         linkonce_mapping_count to section_name_mapping_count.  Don't
12825         declare linkonce_output_name.
12826
12827 2009-06-03  Doug Kwan  <dougkwan@google.com>
12828
12829         * gold/arm.cc (namespace utils): New.
12830         (Target_arm::reloc_is_non_pic): Define new method.
12831         (class Arm_relocate_functions): New.
12832         (Target_arm::Relocate::relocate): Handle relocation types used by
12833         Android.
12834
12835 2009-06-03  Ian Lance Taylor  <iant@google.com>
12836
12837         * arm.cc (Target_arm::scan::global): Use || instead of |.
12838
12839 2009-06-02  Doug Kwan  <dougkwan@google.com>
12840
12841         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12842         issued_non_pic_error_.
12843         (class Target_arm::Scan): Declare new method check_non_pic.
12844         Define new method symbol_needs_plt_entry.
12845         Declare new data member issued_non_pic_error_.
12846         (class Target_arm::Relocate): Declare new method
12847         should_apply_static_reloc.
12848         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12849         (Target_arm::Scan::check_non_pic): Define new method.
12850         (Target_arm::Scan::local): Handle a small subset of reloc types used
12851         by Android.
12852         (Target_arm::Scan::local): Same.
12853         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12854
12855 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12856
12857         * incremental.cc (Incremental_inputs::report_command_line): Filter
12858         out --incremental-* options.
12859
12860 2009-05-29  Doug Kwan  <dougkwan@google.com>
12861
12862         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12863         template class.
12864         (class Target_arm): Update comment.
12865         (Target_arm::Target_arm): Initialize new data members GOT_,
12866         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12867         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12868         and Target_arm::rel_dyn_section.
12869         Declare new_enum Target_arm::Got_type.
12870         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12871         and DYNBSS_.
12872         Update commments for member do_dynsym_value.
12873         (Target_arm::got_size, Target_arm::plt_section,
12874         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12875         new methods inside class defintion.
12876         (Target_arm::got_section): Define new method.
12877         (Target_arm::rel_dyn_section): Same.
12878         (Output_data_plt_arm): New template class.
12879         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12880         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12881         (Output_data_plt_arm::add_entry): Same.
12882         (Output_data_plt_arm::first_plt_entry): Define new
12883         static data member for PLT instruction template.
12884         (Output_data_plt_arm::plt_entry): Same.
12885         (Output_data_plt_arm::do_write): Define new method.
12886         (Target_arm::make_plt_entry): Same.
12887         (Target_arm::do_finalize_sections): Same.
12888         (Target_arm::do_dynsym_value): Same.
12889
12890 2009-05-28  Doug Kwan  <dougkwan@google.com>
12891
12892         * Makefile.am (TARGETSOURCES): Add arm.cc.
12893         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12894         * Makefile.in: Regenerate.
12895         * arm.cc: New file.
12896         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12897
12898 2009-05-26  Doug Kwan  <dougkwan@google.com>
12899
12900         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12901         (General_options::check_excluded_libs): Strip off directories in
12902         archive name before matching like GNU ld does.
12903         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12904         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12905         (exclude_libs_test_LDFLAGS): Add linker option
12906         -Wl,--exclude-libs,libexclude_libs_test_3
12907         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12908         an explicit archive without using -l.
12909         (alt/libexclude_libs_test_3.a): New make rule.
12910         * testsuite/Makefile.in: Regenerate.
12911         * testsuite/exclude_libs_test.c : Declare lib3_default().
12912         (main): Call it.
12913         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12914         * exclude_libs_test_3.c: New file.
12915
12916 2009-05-26  Nick Clifton  <nickc@redhat.com>
12917
12918         * po/id.po: New Indonesian translation.
12919         * po/gold.pot: Updated template file.
12920
12921 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12922
12923         * testsuite/Makefile.am: Add -ffunction-sections to compile
12924         gc_comdat_test files.  Add -Wl,--gc-sections to build
12925         gc_comdat_test.
12926         * testsuite/Makefile.in: Regenerate.
12927         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12928
12929 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12930
12931         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12932         kept comdat section was garbage collected.
12933         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12934         * testsuite/Makefile.in: Regenerate.
12935         * testsuite/gc_comdat_test.sh: New file.
12936         * testsuite/gc_comdat_test_1.cc: New file.
12937         * testsuite/gc_comdat_test_2.cc: New file.
12938
12939 2009-05-19  Doug Kwan  <dougkwan@google.com>
12940
12941         * archive.cc (Archive::Archive): Move constructor from archive.h
12942         to here.  Initialize no_export_.
12943         (Archive::get_elf_object_for_member): Set no_export flag of object.
12944         * archive.h (Archive::Archive): Move constructor body to
12945         archive.cc.
12946         (Archive::no_export): New method.
12947         (Archive::no_export_): New field.
12948         * object.h (Object::Object): Initialize no_export_ to false.
12949         (Object::no_export, Object::set_no_export): New methods.
12950         (Object::no_export_): New field.
12951         * options.cc (General_options::parse_exclude_libs): New method.
12952         (General_options::check_excluded_libs) Same.
12953         * options.h (exclude_libs): New option.
12954         (General_options::check_excluded_libs): New method declaration.
12955         (General_options::excluded_libs_): New field.
12956         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12957         default or protected visibility if an object has no-export flag set.
12958         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12959         (check_SCRIPTS): Add exclude_libs_test.sh.
12960         (check_DATA): Add exclude_libs_test.syms.
12961         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12962         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12963         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12964         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12965         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12966         libexclude_libs_test_2.a): New rules.
12967         * testsuite/Makefile.in: Regenerate.
12968         * testsuite/exclude_libs_test.c: New file.
12969         * testsuite/exclude_libs_test.sh: Ditto.
12970         * testsuite/exclude_libs_test_1.c: Ditto.
12971         * testsuite/exclude_libs_test_2.c: Ditto.
12972
12973 2009-05-15  Ian Lance Taylor  <iant@google.com>
12974
12975         * configure.ac: Check for declarations for cases where libiberty.h
12976         checks HAVE_DECL_xxx.
12977         * configure, config.in: Rebuild.
12978
12979 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12980
12981         * gold.h (Incremental_argument_list): Remove (invalid) forward
12982         declaration.
12983         * incremental.cc (Incremental_inputs::report_achive): New method.
12984         (Incremental_inputs::report_object): New method.
12985         (Incremental_inputs::report_script): New method.
12986         (Incremental_inputs::finalize_inputs): New method.
12987         (Incremental_inputs::finalize): Call finalize_inputs().
12988         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12989         Create inputs entries.
12990         * incremental.h (Incremental_input_type): New enum.
12991         (Incremental_inputs::Incremental_input): Initialize new fields.
12992         (Incremental_inputs::report_inputs): New method.
12993         (Incremental_inputs::report_achive): New method.
12994         (Incremental_inputs::report_object): New method.
12995         (Incremental_inputs::report_script): New method.
12996         (Incremental_inputs::finalize_inputs): New method.
12997         (Incremental_inputs::Input_info): New struct.
12998         (Incremental_inputs::Input_info_map): New typedef.
12999         (Incremental_inputs::lock_): New field.
13000         (Incremental_inputs::Inputs_): New field.
13001         (Incremental_inputs::Inputs_map): New field.
13002         * main.cc (main): Call Incremental_input::report_inputs.
13003         * options.h (Input_argument_list): Typedef moved from
13004         Input_arguments.
13005         (Input_file_group::Files): Remove, use ::Input_argument_list.
13006         (Input_file_group::Input_argument_list): Remove, use
13007         ::Input_argument_list.
13008         * plugin.cc (Plugin_manager::add_input_file): Add error in
13009         incremental build.
13010         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13011         functions.
13012         * script.cc (read_input_script): Call
13013         Incremental_input::report_script.
13014         * script.h (Script_info): New class.
13015
13016 2009-04-27  Ian Lance Taylor  <iant@google.com>
13017
13018         * x86_64.cc (do_adjust_output_section): Set entsize to
13019         plt_entry_size.
13020
13021 2009-04-23  Elliott Hughes  <enh@google.com>
13022
13023         * output.cc (Output_file::close): After short writes, continue
13024         writing from the correct offset in the buffer being written.
13025
13026 2009-04-23  Chris Demetriou  <cgd@google.com>
13027
13028         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13029         * configure: Regenerate.
13030         * config.in: Regenerate.
13031         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13032         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13033
13034 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13035
13036         * incremental.cc (Incremental_inputs_header_data): Renamed from
13037         Incremental_input_header_data.
13038         (Incremental_inputs_header_data::data_size): New field.
13039         (Incremental_inputs_header_data::put_input_file_count): Renamed
13040         from input_file_count.
13041         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13042         from command_line_offset.
13043         (Incremental_inputs_header_data::put_reserved): Renamed from
13044         put_reserved.
13045         (Incremental_inputs_entry_data): Renamed from
13046         Incremental_input_entry_data.
13047         (Incremental_inputs_entry_data::data_size): New field.
13048         (Incremental_inputs::report_command_line): New method.
13049         (Incremental_inputs::finalize): New method.
13050         (Incremental_inputs::create_incremental_inputs_data): New method.
13051         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13052         * incremental.h: New file.
13053         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13054         (Layout::finalize): Create incremental inputs section in
13055         incremental builds.
13056         (Layout::create_incremental_info_sections): New method.
13057         * layout.h (Layout::incremental_inputs): New method.
13058         (Layout::create_incremental_info_sections): New method.
13059         (Layout::incremental_inputs_): New field.
13060         * main.cc (main): Notify Incremental_input of the command line.
13061
13062 2009-04-01  Ian Lance Taylor  <iant@google.com>
13063             Mikolaj Zalewski  <mikolajz@google.com>
13064
13065         * gold.h (reserve_unordered_map): Define, three versions, one for
13066         each version of Unordered_map.
13067         * layout.cc (Layout::Layout): Remove options parameter.  Add
13068         number_of_input_files parameter.  Don't initialize options_.
13069         Initialize number_of_input_files_ and resized_signatures_.  Move
13070         sections_are_attached_.
13071         (Layout::layout_group): Reserve space for group_signatures_.
13072         (Layout::find_or_add_kept_section): Change name parameter to be a
13073         reference.  Resize signatures_ map when it gets large enough.
13074         (Layout::layout_eh_frame): Use parameters->options() instead of
13075         this->options_.
13076         (Layout::make_output_section): Likewise.
13077         (Layout::attach_allocated_section_to_segment): Likewise.
13078         (Layout::finalize, Layout::create_executable_stack): Likewise.
13079         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13080         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13081         * layout.h (class Layout): Update declarations.  Remove options_
13082         field.  Add number_of_input_files_ and resized_signatures_
13083         fields.  Move sections_are_attached_ field.
13084         * main.cc (main): Pass number of input files to Layout
13085         constructor.  Don't pass options.
13086
13087 2009-03-30  Ian Lance Taylor  <iant@google.com>
13088
13089         * ffsll.c (ffsll): Correct implementation.
13090
13091 2009-03-27  Ian Lance Taylor  <iant@google.com>
13092
13093         * ffsll.c: New file.
13094         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13095         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13096         * ftruncate.c (ftruncate): Declare before definition.
13097         * mremap.c (mremap): Likewise.
13098         * pread.c (pread): Likewise.
13099         * configure, Makefile.in, config.in: Rebuild.
13100
13101         * mremap.c: New file.
13102         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13103         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13104         (mremap): Declare if HAVE_MREMAP is not defined.
13105         * configure, Makefile.in, config.in: Rebuild.
13106
13107 2009-03-27  Cary Coutant  <ccoutant@google.com>
13108
13109         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13110         position independent.
13111         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13112         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13113
13114 2009-03-24  Cary Coutant  <ccoutant@google.com>
13115
13116         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13117         an executable.
13118         (needs_dynamic_reloc): Likewise.
13119
13120 2009-03-24  Ian Lance Taylor  <iant@google.com>
13121
13122         * yyscript.y (file_cmd): Recognize EXTERN.
13123         (extern_name_list, extern_name_list_body): New nonterminals.
13124         * script.cc (script_add_extern): Define.
13125         * script-c.h (script_add_extern): Declare.
13126
13127 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13128
13129         * object.cc (is_elf_object): Define.
13130         * object.h (is_elf_object): Declare.
13131         * archive.cc (Archive::get_elf_object_for_member): Call
13132         is_elf_object.
13133         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13134
13135 2009-03-24  Elliott Hughes  <enh@google.com>
13136
13137         * output.cc (Output_file::map_anonymous): Define.
13138         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13139         try an anonymous one.  Report the size if the mmap fails.
13140         * output.h (class Output_file): Declare map_anonymous.
13141
13142 2009-03-24  Ian Lance Taylor  <iant@google.com>
13143
13144         * target-select.cc (instantiate_target): Don't acquire the lock if
13145         the instantiated_target_ field has already been set.
13146
13147 2009-03-23  Ian Lance Taylor  <iant@google.com>
13148
13149         * gold-threads.h (class Initialize_lock): Define.
13150         * gold-threads.cc (class Initialize_lock_once): Define.
13151         (initialize_lock_control): New static variable.
13152         (initialize_lock_pointer): New static variable.
13153         (initialize_lock_once): New static function.
13154         (Initialize_lock::Initialize_lock): Define.
13155         (Initialize_lock::initialize): Define.
13156         * target-select.h: Include "gold-threads.h".
13157         (class Target_selector): Add lock_ and initialize_lock_ fields.
13158         Don't define instantiate_target, just declare it.
13159         * target-select.cc (Target_selector::Target_selector): Initialize
13160         new fields.
13161         (Target_selector::instantiate_target): Define.
13162         * descriptors.h: Include "gold-threads.h".
13163         (class Descriptors): Add initialize_lock_ field.
13164         * descriptors.cc (Descriptors::Descriptors): Initialize new
13165         field.
13166         (Descriptors::open): Use initialize_lock_ field
13167         * errors.h (class Errors): Add initialize_lock_ field.
13168         * errors.cc (Errors::Errors): Initialize new field.
13169         (Errors::initialize_lock): Use initialize_lock_ field.
13170         * powerpc.cc (class Target_selector_powerpc): Remove
13171         instantiated_target_ field.  In do_recognize call
13172         instantiate_target rather than do_instantiate_target.  In
13173         do_instantiate_target just allocate a new target.
13174         * sparc.cc (class Target_selector_sparc): Likewise.
13175
13176         * freebsd.h: New file.
13177         * i386.cc: Include "freebsd.h".
13178         (Target_i386): Derive from Target_freebsd rather than
13179         Sized_target.
13180         (Target_selector_i386): Derive from Target_selector_freebsd rather
13181         than Target_selector.
13182         * x86_64.cc: Include "freebsd.h".
13183         (Target_x86_64): Derive from Target_freebsd rather than
13184         Sized_target.
13185         (Target_selector_x86_64): Derive from Target_selector_freebsd
13186         rather than Target_selector.
13187         * target.h (class Target): Add adjust_elf_header and
13188         do_adjust_elf_header.
13189         * output.cc (Output_file_header:: do_sized_write): Call target
13190         adjust_elf_header routine.
13191         * configure.tgt: Set targ_osabi.
13192         * configure.ac: Define GOLD_DEFAULT_OSABI.
13193         * parameters.cc (Parameters::default_target): Pass
13194         GOLD_DEFAULT_OSABI to select_target.
13195         * target-select.h (class Target_selector): Make instantiate_target
13196         protected rather than private.
13197         * Makefile.am (HFILES): Add freebsd.h.
13198         * configure, Makefile.in, config.in: Rebuild.
13199
13200         * merge.cc (do_add_input_section): Correct pend value.  Change
13201         message about last entry not being null terminated from error to
13202         warning.
13203
13204 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13205
13206         * incremental.cc: New file.
13207         * Makefile.am (CCFILES): Add incremental.cc.
13208         * Makefile.in: Rebuild.
13209
13210 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13211
13212         * layout.cc (Layout::output_section_name): Preserve names
13213         of '.note.' sections.
13214
13215 2009-03-19  Ian Lance Taylor  <iant@google.com>
13216
13217         * descriptors.cc (Descriptors::open): Check that the options are
13218         valid before using them.
13219
13220 2009-03-18  Ian Lance Taylor  <iant@google.com>
13221
13222         * script-sections.h: Include <list>.
13223         (class Script_sections): Change Sections_elements from std::vector
13224         to std::list.  Typedef public Elements_iterator.  Add
13225         orphan_section_placement_, data_segment_align_start_, and
13226         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13227         field.
13228         * script-sections.cc (class Orphan_section_placement): New class.
13229         (class Sections_element): Add virtual functions is_relro and
13230         orphan_section_init.  Remove virtual function place_orphan_here.
13231         (class Output_section_definition): Add is_relro and
13232         orphan_section_init.  Remove place_orphan_here.
13233         (class Orphan_output_section): Likewise.
13234         (Script_sections::Script_sections): Update for field changes.
13235         (Script_sections::data_segment_align): Set saw_data_segment_align_
13236         and data_segment_align_start_, not data_segment_align_index.
13237         (Script_sections::data_segment_relro_end): Check
13238         saw_data_segment_align_.  Use data_segment_align_start_ rather
13239         than data_segment_align_index_.
13240         (Script_sections::place_orphan): Rewrite to use
13241         Orphan_section_placement.
13242
13243 2009-03-17  Ian Lance Taylor  <iant@google.com>
13244
13245         * archive.cc (Archive::add_symbols): Check for a version attached
13246         to the symbol name in the archive map.
13247         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13248         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13249         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13250         (ver_test_11.a): New target.
13251         * testsuite/Makefile.in: Rebuild.
13252
13253         * configure.ac: Check for chsize and posix_fallocate.  Replace
13254         ftruncate.
13255         * ftruncate.c: New file, from gnulib.
13256         * output.cc (posix_fallocate): Define dummy version if not
13257         HAVE_POSIX_FALLOCATE.
13258         (Output_file::map): Call posix_fallocate rather than lseek and
13259         write.
13260         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13261         * configure, Makefile.in, config.in: Rebuild.
13262
13263 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13264
13265         * layout.h (Layout::create_note): Add section_name parameter.
13266         * layout.cc (Layout::create_note): Likewise.
13267         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13268
13269 2009-03-17  Ian Lance Taylor  <iant@google.com>
13270
13271         * descriptors.cc: Include "options.h".
13272         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13273         (Descriptors::open): Always use O_CLOEXEC when opening a new
13274         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13275         then set FD_CLOEXEC.
13276
13277         * sparc.cc (class Target_sparc): Add has_got_section.
13278         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13279         make sure we have a GOT section.
13280
13281         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13282         (Target_sparc::Scan::local): Likewise.
13283         (Target_sparc::Scan::global): Likewise.
13284         (Target_sparc::Relocate::relocate): Likewise.
13285         (Target_sparc::Relocate::relocate_tls): Likewise.
13286
13287         * symtab.cc (Symbol_table::define_default_version): New function,
13288         broken out of add_from_object.
13289         (Symbol_table::add_from_object): Call define_default_version.
13290         (Symbol_table::define_special_symbol): Add resolve_oldsym
13291         parameter.  Change all callers.  If the version for a symbol comes
13292         from a version script, resolve it with the symbol with the same
13293         name with no version.  Also add the symbol without a version if
13294         appropriate.
13295         (do_define_in_output_data): If resolving with oldsym, don't delete
13296         sym.
13297         (do_define_in_output_segment): Likewise.
13298         (do_define_as_constant): Likewise.
13299         * symtab.h (class Symbol_table): Update declarations.
13300
13301 2009-03-13  Ian Lance Taylor  <iant@google.com>
13302
13303         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13304         (Read_symbols::requeue): New function.
13305         (Read_symbols::do_read_symbols): If make_elf_object fails because
13306         the target type is not configured, and the file was searched for,
13307         issue a warning and retry with the next directory.
13308         (Add_symbols::run): If the file has an incompatible format, and
13309         it was searched for, requeue the Read_symbols task.  On error,
13310         release the object.
13311         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13312         dirindex parameter to constructor.  Change all callers.  Declare
13313         incompatible_warning and requeue.
13314         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13315         input_argument_ and input_group_ fields.  Add them to
13316         constructor.  Change all callers.
13317         (class Read_script): Add dirindex_ field.  Add it to constructor.
13318         Change all callers.
13319         * archive.cc (Archive::setup): Remove input_objects parameter.
13320         Change all callers.
13321         (Archive::get_file_and_offset): Likewise.
13322         (Archive::read_all_symbols): Likewise.
13323         (Archive::read_symbols): Likewise.
13324         (Archive::get_elf_object_for_member): Remove input_objects
13325         parameter.  Add punconfigured parameter.  Change all callers.
13326         (Archive::add_symbols): Change return type to bool.  Check return
13327         value of include_member.
13328         (Archive::include_all_members): Likewise.
13329         (Archive::include_member): Change return type to bool.  Return
13330         false if first included object has incompatible target.  Set
13331         included_member_ field.
13332         (Add_archive_symbols::run): If add_symbols returns false, requeue
13333         Read_symbols task.
13334         * archive.h (class Archive): Add included_member_ field.
13335         Initialize it in constructor.  Add input_file and searched_for
13336         methods.  Update declarations.
13337         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13338         input_argument_ fields.  Add them to constructor.  Change all
13339         callers.
13340         * script.cc: Include "target-select.h".
13341         (class Parser_closure): Add skip_on_incompatible_target_ and
13342         found_incompatible_target_ fields.  Add
13343         skip_on_incompatible_target parameter to constructor.  Change all
13344         callers.  Add methods skip_on_incompatible_target,
13345         clear_skip_on_incompatible_target, found_incompatible_target, and
13346         set_found_incompatible_target.
13347         (read_input_script): Add dirindex parameter.  Change all callers.
13348         If parser finds an incompatible target, requeue Read_symbols
13349         task.
13350         (script_set_symbol): Clear skip_on_incompatible_target in
13351         closure.
13352         (script_add_assertion, script_parse_option): Likewise.
13353         (script_start_sections, script_add_phdr): Likewise.
13354         (script_check_output_format): New function.
13355         * script.h (read_input_script): Update declaration.
13356         * script-c.h (script_check_output_format): Declare.
13357         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13358         (ignore_cmd): Remove OUTPUT_FORMAT.
13359         * fileread.cc (Input_file::Input_file): Add explicit this.
13360         (Input_file::will_search_for): New function.
13361         (Input_file::open): Add pindex parameter.  Change all callers.
13362         * fileread.h (class Input_file): Add input_file_argument method.
13363         Declare will_search_for.  Update declarations.
13364         * object.cc (make_elf_object): Add punconfigured parameter.
13365         Change all callers.
13366         * object.h (class Object): Make input_file public.  Add
13367         searched_for method.
13368         (make_elf_object): Update declaration.
13369         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13370         restart search.
13371         * dirsearch.h (class Dirsearch): Update declaration.
13372         * options.h (class General_options): Add --warn-search-mismatch.
13373         * parameters.cc (Parameters::is_compatible_target): New function.
13374         * parameters.h (class Parameters): Declare is_compatible_target.
13375         * workqueue.cc (Workqueue::add_blocker): New function.
13376         * workqueue.h (class Workqueue): Declare add_blocker.
13377
13378         * fileread.cc (Input_file::open): Remove options parameter.
13379         Change all callers.
13380         (Input_file::open_binary): Likewise.
13381         * script.cc (read_input_script): Likewise.
13382         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13383         options parameter from constructor.  Change all callers.
13384         (class Read_script): Likewise.
13385         * fileread.h (class Input_file): Update declarations.
13386         * script.h (read_input_script): Update declaration.
13387
13388 2009-03-10  Nick Clifton  <nickc@redhat.com>
13389
13390         * po/es.po: New Spanish translation.
13391
13392 2009-03-06  Cary Coutant  <ccoutant@google.com>
13393
13394         * options.cc (parse_short_option): Keep dash_z from registering itself.
13395
13396 2009-03-03  Ian Lance Taylor  <iant@google.com>
13397
13398         PR 9918
13399         * target-reloc.h (relocate_section): Pass output_section to
13400         relocate.
13401         * i386.cc (Target_i386::should_apply_static_reloc): Add
13402         output_section parameter.  Change all callers.
13403         (Target_i386::Relocate::relocate): Add output_section parameter.
13404         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13405         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13406         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13407         * testsuite/two_file_shared.sh: New script.
13408         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13409         (check_DATA): Add two_file_shared.dbg.
13410         (two_file_shared.dbg): New target.
13411         * testsuite/Makefile.in: Rebuild.
13412
13413 2009-03-01  Ian Lance Taylor  <iant@google.com>
13414
13415         * configure.ac: Check for byteswap.h.
13416         * configure: Rebuild.
13417         * config.in: Rebuild.
13418
13419 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13420
13421         * layout.cc (Layout::find_or_add_kept_section): New function.
13422         (Layout::add_comdat): Removed.
13423         * layout.h (struct Kept_section): Move out of class Layout.
13424         Remove trailing underscores from field names.  Add group_sections
13425         field.  Rename group_ field to is_group.  Change all uses.
13426         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13427         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13428         comdat_groups_ field.
13429         (Sized_relobj::include_section_group): Use
13430         find_or_add_kept_section and Kept_section::group_sections.
13431         (Sized_relobj::include_linkonce_section): Likewise.
13432         * object.cc (class Sized_relobj): Don't define Comdat_group or
13433         Comdat_group_table.  Remove find_comdat_group and
13434         add_comdat_group.  Remove comdat_groups_ field.
13435         * plugin.cc (include_comdat_group): Use
13436         Layout::find_or_add_kept_section.
13437
13438 2009-02-28  Ian Lance Taylor  <iant@google.com>
13439
13440         * README: --gc-sections and map files are now supported.  Document
13441         some build requirements.
13442
13443         PR 6992
13444         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13445         relocatable link set the value of the section symbol to zero.
13446         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13447         relocatable link don't include the section address in the local
13448         symbol value.
13449
13450 2009-02-27  Ian Lance Taylor  <iant@google.com>
13451
13452         PR 6811
13453         * options.h (class Search_directory): Add is_system_directory.
13454         (class General_options): Declare is_in_system_directory.
13455         * options.cc (get_relative_sysroot): Make static.
13456         (get_default_sysroot): Make static.
13457         (General_optoins::is_in_system_directory): New function.
13458         * fileread.cc (Input_file::is_in_system_directory): New function.
13459         * fileread.h (class Input_file): Declare is_in_system_directory.
13460         * object.h (class Object): Add is_in_system_directory.
13461         (class Input_objects): Remove system_library_directory_ field.
13462         * object.cc (Input_objects::add_object): Don't set
13463         system_library_directory_.
13464         (input_objects::found_in_system_library_directory): Remove.
13465         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13466         parameter.  Change all callers.
13467         (Symbol_table::sized_write_globals): Likewise.
13468         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13469         Call Object::is_in_system_directory.
13470         * symtab.h (class Symbol_table): Update declarations.
13471
13472         PR 5990
13473         * descriptors.h (Open_descriptor): Add is_on_stack field.
13474         * descriptors.cc (Descriptors::open): If the descriptor is on the
13475         top of the stack, remove it.  Initialize is_on_stack field.
13476         (Descriptors::release): Only add pod to stack if it is not on the
13477         stack already.
13478         (Descriptors::close_some_descriptor): Clear stack_next and
13479         is_on_stack fields.
13480
13481         PR 7091
13482         * output.cc (Output_section::find_starting_output_address): Rename
13483         from starting_output_address; add PADDR parameter; change return
13484         type.
13485         * output.h (class Output_section): Declare
13486         find_starting_output_address instead of starting_output_address.
13487         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13488         section symbol for which we can't find a merge section.
13489
13490         PR 9836
13491         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13492         hidden or internal, force the symbol to be local.
13493         * resolve.cc (Symbol::override_visibility): Define.
13494         (Symbol::override_base): Use override_visibility.
13495         (Symbol_table::resolve): Likewise.
13496         (Symbol::override_base_with_special): Likewise.
13497         (Symbol_table::override_with_special): If the visibility is hidden
13498         or internal, force the symbol to be local.
13499         * symtab.h (class Symbol): Add set_visibility and
13500         override_visibility.
13501         * testsuite/ver_test_1.sh: New file.
13502         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13503         (check_DATA): Add ver_test_1.syms.
13504         (ver_test_1.syms): New target.
13505         * testsuite/Makefile.in: Rebuild.
13506
13507 2009-02-25  Cary Coutant  <ccoutant@google.com>
13508
13509         * layout.cc (Layout::choose_output_section): Don't rename sections
13510         when using a linker script that has a SECTIONS clause.
13511         * Makefile.in: Regenerate.
13512
13513         * testsuite/Makefile.am (script_test_5.sh): New test case.
13514         * testsuite/Makefile.in: Regenerate.
13515         * testsuite/script_test_5.cc: New file.
13516         * testsuite/script_test_5.sh: New file.
13517         * testsuite/script_test_5.t: New file.
13518
13519 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13520
13521         * archive.cc (Archive::include_member): Update calls to add_symbols.
13522         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13523         the Layout argument.
13524         * dynobj.h (do_add_symbols): Add the Layout argument.
13525         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13526         Layout argument.
13527         * object.h (Object::add_symbols): Add the Layout argument.
13528         (Object::do_add_symbols): Add the Layout argument.
13529         (Sized_relobj::do_add_symbols): Add the Layout argument.
13530         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13531         Unify the two versions.
13532         (Add_plugin_symbols): Remove.
13533         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13534         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13535         (Add_plugin_symbols): Remove.
13536         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13537         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13538         (Add_symbols::run): Make it work with Pulginobj.
13539
13540 2009-02-06  Ian Lance Taylor  <iant@google.com>
13541
13542         * object.cc (Sized_relobj::do_layout): Make info message start
13543         with lower case letter.
13544
13545 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13546
13547         * binary.cc: Fix file comment.
13548
13549         * options.h (enum Incremental_disposition): Define.
13550         (class General_options): Add new options: --incremental,
13551         --incremental_changed, --incremental_unchanged,
13552         --incremental_unknown.  Add incremental_disposition_ and
13553         implicit_incremental_ fields.
13554         (General_options::incremental_disposition): New function.
13555         (class Position_dependent_options): Add incremental_disposition
13556         option.
13557         (Position_dependent_options::copy_from_options): Set incremental
13558         dispositions.
13559         * options.cc (General_options::parse_incremental_changed): New
13560         function.
13561         (General_options::parse_incremental_unchanged): New function.
13562         (General_options::parse_incremental_unknown): New function.
13563         (General_options::General_options): Initialize new fields
13564         incremental_disposition_ and implicit_incremental_.
13565         (General_options::finalize): Check for uasge of --incremental-*
13566         without --incremental.
13567
13568 2009-02-06  Chris Demetriou  <cgd@google.com>
13569
13570         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13571         pointer and to report location as the file name associated with
13572         the symbol.
13573         (gold_undefined_symbol_at_location): New function to replace the
13574         old gold_undefined_symbol functionality.
13575         * target-reloc.h (relocate_section): Update to use
13576         gold_undefined_symbol_at_location.
13577         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13578         Call gold_undefined_symbol function rather than gold_error.
13579         * errors.h (Errors::undefined_symbol): Take location as a
13580         string, rather than calculating it from a relocation.
13581         * errors.cc (Errors::fatal): Print "fatal error:" before the
13582         formatted message.
13583         (Errors::error, Errors::error_at_location): Print "error: "
13584         before the formatted message.
13585         (Errors::undefined_symbol): Take location as a string, rather
13586         than calculating it from a relocation.
13587         (gold_undefined_symbol_at_location): New function akin to
13588         old gold_undefined_symbol, calculates location from relocation.
13589         (gold_undefined_symbol): Change to take only a Symbol pointer
13590         and to report location as the file name associated with the symbol.
13591         * testsuite/debug_msg.sh: Update for changed error messages.
13592         * testsuite/undef_symbol.sh: Likewise.
13593
13594 2009-02-04  Duncan Sands  <baldrick@free.fr>
13595
13596         PR 9812
13597         * reduced_debug_output.h
13598         (Output_reduced_debug_abbrev_section::failed): Use format for
13599         gold_warning.
13600         (Output_reduced_debug_info_section::faild): Likewise.
13601
13602 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13603
13604         * script.cc (Lazy_demangler): New class.
13605         (Version_script_info::get_symbol_version_helper): Demangle a
13606         symbol only once.
13607
13608 2009-01-29  Cary Coutant  <ccoutant@google.com>
13609
13610         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13611         to __tls_get_addr.
13612         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13613
13614 2009-01-28  Ian Lance Taylor  <iant@google.com>
13615
13616         * version.cc (version_string): Bump to 1.9.
13617
13618         * gold.h: Include <cstring> and <stdint.h>.
13619         * version.cc: Include <cstdio>.
13620         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13621         warning.
13622         * reduced_debug_output.cc (insert_into_vector): Rename from
13623         Insert_into_vector; change all callers.  Use Swap_unaligned to
13624         avoid aliasing issue; remove union since it is unnecessary.
13625
13626 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13627
13628         * Makefile.am (CCFILES): Add gc.cc.
13629         (HFILES): Add gc.h.
13630         * Makefile.in: Regenerate.
13631         * gold.cc (Gc_runner): New class.
13632         (queue_initial_tasks): Call garbage collection related tasks
13633         when corresponding options are invoked.
13634         (queue_middle_gc_tasks): New function.
13635         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13636         processed early before laying out sections during garbage collection.
13637         * gold.h (queue_middle_gc_tasks): New function.
13638         (is_prefix_of): Move from "layout.cc".
13639         * i386.cc (Target_i386::gc_process_relocs): New function.
13640         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13641         * main.cc (main): Create object of class "Garbage_collection".
13642         * object.cc (Relobj::copy_symbols_data): New function.
13643         (Relobj::is_section_name_included): New function.
13644         (Sized_relobj::do_layout): Allow this function to be called twice
13645         during garbage collection and defer layout of section during the
13646         first call.
13647         * object.h (Relobj::get_symbols_data): New function.
13648         (Relobj::is_section_name_included): New function.
13649         (Relobj::copy_symbols_data): New function.
13650         (Relobj::set_symbols_data): New function.
13651         (Relobj::get_relocs_data): New function.
13652         (Relobj::set_relocs_data): New function.
13653         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13654         (Relobj::gc_process_relocs): New function.
13655         (Relobj::do_gc_process_relocs): New pure virtual function.
13656         (Relobj::sd_): New data member.
13657         (Sized_relobj::is_output_section_offset_invalid): New function.
13658         (Sized_relobj::do_gc_process_relocs): New function.
13659         * options.h (General_options::gc_sections): Modify to not be a no-op.
13660         (General_options::print_gc_sections): New option.
13661         * plugin.cc (Plugin_finish::run): Remove function call to
13662         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13663         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13664         * reloc.cc (Read_relocs::run): Add task to process relocs and
13665         determine unreferenced sections when doing garbage collection.
13666         (Gc_process_relocs): New class.
13667         (Sized_relobj::do_gc_process_relocs): New function.
13668         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13669         sections that are garbage collected.
13670         * reloc.h (Gc_process_relocs): New class.
13671         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13672         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13673         symbols whose corresponding sections are garbage collected.
13674         (Symbol_table::Symbol_table): Add new parameter for the garbage
13675         collection object.
13676         (Symbol_table::gc_mark_undef_symbols): New function.
13677         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13678         (Symbol_table::gc_mark_dyn_syms): New function.
13679         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13680         as garbage.
13681         (Symbol_table::add_from_object): Likewise.
13682         (Symbol_table::add_from_relobj): When building shared objects, do not
13683         treat externally visible symbols as garbage.
13684         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13685         table information for static and relocatable links.
13686         * symtab.h (Symbol_table::set_gc): New function.
13687         (Symbol_table::gc): New function.
13688         (Symbol_table::gc_mark_undef_symbols): New function.
13689         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13690         (Symbol_table::gc_mark_dyn_syms): New function.
13691         (Symbol_table::gc_): New data member.
13692         * target.h (Sized_target::gc_process_relocs): New pure virtual
13693         function.
13694         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13695         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13696
13697 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13698
13699         * options.h (General_options::gc_sections): Define as a no-op for now.
13700         (General_options::no_keep_memory): Ditto.
13701         (General_options::Bshareable): Define.
13702         * options.cc (General_options::finalize): Honor -Bshareable.
13703
13704 2009-01-20  Andreas Schwab  <schwab@suse.de>
13705
13706         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13707         read the value in the contents, since we don't use it.  Use the
13708         template endianness when writing.
13709         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13710
13711 2009-01-19  Andreas Schwab  <schwab@suse.de>
13712
13713         * configure.tgt (powerpc64-*): Fix targ_obj.
13714
13715 2009-01-15  Ian Lance Taylor  <iant@google.com>
13716
13717         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13718         local symbols when stripping all symbols.
13719
13720 2009-01-14  Cary Coutant  <ccoutant@google.com>
13721
13722         * output.cc (Output_reloc): Add explicit instantiations.
13723
13724 2009-01-14  Cary Coutant  <ccoutant@google.com>
13725
13726         * archive.cc (Archive::get_elf_object_for_member): Remove call
13727         to File_read::claim_for_plugin.
13728         * descriptors.cc (Descriptors::open): Remove reference to
13729         is_claimed.
13730         (Descriptors::claim_for_plugin): Remove.
13731         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13732         (Descriptors::is_claimed): Remove.
13733         (claim_descriptor_for_plugin): Remove.
13734         * fileread.cc (File_read::claim_for_plugin): Remove.
13735         * fileread.h (File_read::claim_for_plugin): Remove.
13736         (File_read::descriptor): Reopen descriptor if necessary.
13737         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13738         (Plugin_manager::all_symbols_read): Add task parameter. Change
13739         all callers.
13740         (Plugin_manager::get_input_file): New function.
13741         (Plugin_manager::release_input_file): New function.
13742         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13743         corresponding data member.
13744         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13745         and pass to base constructor. Change all callers.
13746         (get_input_file, release_input_file): New functions.
13747         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13748         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13749         (Plugin_manager::all_symbols_read): Add task parameter.
13750         (Plugin_manager::get_input_file): New function.
13751         (Plugin_manager::release_input_file): New function.
13752         (Plugin_manager::task_): New data member.
13753         (Pluginobj::Pluginobj): Add filesize parameter.
13754         (Pluginobj::filename): New function.
13755         (Pluginobj::descriptor): New function.
13756         (Pluginobj::filesize): New function.
13757         (Pluginobj::filesize_): New data member.
13758         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13759         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13760         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13761
13762         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13763         with archive libraries.
13764         * testsuite/Makefile.in: Regenerate.
13765         * testsuite/plugin_test.c (struct sym_info): New type.
13766         (get_input_file, release_input_file): New static variables.
13767         (onload): Capture new transfer vector entries.
13768         (claim_file_hook): Stop reading at end of file according to filesize.
13769         Factor out parsing of readelf output into separate function.
13770         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13771         APIs and get the source file name from the symbol table.  Convert
13772         source file name to corresponding object file name.  Print info
13773         message when adding new input files.
13774         (parse_readelf_line): New function.
13775         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13776         * testsuite/plugin_test_2.sh: Likewise.
13777         * testsuite/plugin_test_3.sh: Likewise.
13778         * testsuite/plugin_test_4.sh: New test case.
13779
13780 2009-01-07  Ian Lance Taylor  <iant@google.com>
13781
13782         * version.cc (version_string): Bump to 1.8.
13783
13784 2008-12-23  Cary Coutant  <ccoutant@google.com>
13785
13786         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13787         * plugin.cc (Plugin_manager::finish): Rename as
13788         layout_deferred_objects.  Move cleanup to separate function.
13789         (Plugin_manager::cleanup): New function.
13790         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13791         separately.
13792         * plugin.h (Plugin_manager::finish): Rename as
13793         layout_deferred_objects.
13794         (Plugin_manager::cleanup): New function.
13795         (Plugin_manager::cleanup_done): New field.
13796
13797 2008-12-23  Cary Coutant  <ccoutant@google.com>
13798
13799         * plugin.cc (is_visible_from_outside): New function.
13800         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13801         so we don't return "IR only" status for exported symbols or -r links.
13802
13803         * testsuite/Makefile.am (plugin_test_3): New test case.
13804         * testsuite/Makefile.in: Regenerate.
13805         * testsuite/plugin_test_3.sh: New file.
13806
13807 2008-12-22  Cary Coutant  <ccoutant@google.com>
13808
13809         * object.cc (Sized_relobj::layout_section): New function.
13810         (Sized_relobj::do_layout): Defer layout of input sections until after
13811         plugin has provided replacement files.
13812         (Sized_relobj::do_layout_deferred_sections): New function.
13813         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13814         (Relobj::layout_deferred_sections): New function.
13815         (Relobj::do_layout_deferred_sections): New function.
13816         (Sized_relobj::do_layout_deferred_sections): New function.
13817         (Sized_relobj::layout_section): New function.
13818         (Sized_relobj::Deferred_layout): New structure.
13819         (Sized_relobj::deferred_layout_): New field.
13820         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13821         Change all callers.  Layout deferred sections.
13822         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13823         references.
13824         (Plugin_hook::run): Move code from do_plugin_hook inline.
13825         (Plugin_hook::do_plugin_hook): Remove.
13826         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13827         (Plugin_manager::finish): Renamed, was cleanup.
13828         (Plugin_manager::should_defer_layout): New function.
13829         (Plugin_manager::add_deferred_layout_object): New function.
13830         (Plugin_manager::Deferred_layout_list): New type.
13831         (Plugin_manager::deferred_layout_objects_): New field.
13832         (Plugin_hook::do_plugin_hook): Remove.
13833
13834 2008-12-17  Ian Lance Taylor  <iant@google.com>
13835
13836         * options.h (class General_options): Add --no case for
13837         --export-dynamic.
13838
13839 2008-12-16  Cary Coutant  <ccoutant@google.com>
13840
13841         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13842         vector.
13843         (Plugin_manager::claim_file): Create plugin object even if
13844         plugin did not call the add_symbols callback.
13845         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13846         asking for more symbols than were added.
13847         * testsuite/Makefile.am (plugin_test_1): Add test case with
13848         no global symbols.
13849         (empty.syms): New target.
13850         * testsuite/Makefile.in: Regenerate.
13851         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13852         message. Don't call add_symbols if no globals.
13853         (all_symbols_read_hook): Don't provide replacement for empty
13854         claimed file.
13855
13856 2008-12-12  Ian Lance Taylor  <iant@google.com>
13857
13858         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13859         r_type == 0 for a local symbol with r_sym == 0.
13860         (scan_relocatable_relocs): Pass r_sym to
13861         local_non_section_strategy.
13862         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13863         r_sym parameter.
13864
13865         * configure.ac: Update test for TLS descriptors: they are
13866         supported as of glibc 2.9.
13867         * configure: Rebuild.
13868
13869 2008-12-11  Ian Lance Taylor  <iant@google.com>
13870
13871         PR 7091
13872         * target-reloc.h (Default_scan_relocatable_relocs): For each
13873         function, map r_type == 0 to RELOC_DISCARD.
13874
13875 2008-12-10  Cary Coutant  <ccoutant@google.com>
13876
13877         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13878         object to override a kept COMDAT group from a plugin object.
13879
13880 2008-12-09  Ian Lance Taylor  <iant@google.com>
13881
13882         PR 7088
13883         * yyscript.y (file_cmd): Handle INPUT.
13884
13885         * testsuite/initpri1.c: Change all declarations to be full
13886         prototypes by adding void, to avoid compiler warnings.
13887
13888 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13889
13890         * options.cc (General_options::parse_plugin_opt): New.
13891         (General_options::add_plugin): The argument now is just the filename.
13892         (General_options::add_plugin_option): New.
13893         * options.h (plugin_opt): New.
13894         (add_plugin): Change argument name.
13895         (add_plugin_option): New.
13896         * plugin.cc (Plugin::load): Don't parse the plugin option.
13897         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13898         (Plugin::add_option): New.
13899         (Plugin::args_): Change type.
13900         (Plugin::filename_): New.
13901         (Plugin_manager::add_plugin_option): New.
13902         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13903         * testsuite/Makefile.in: Regenerate.
13904
13905 2008-12-05  Cary Coutant  <ccoutant@google.com>
13906
13907         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13908         Handle --strip-lto-sections option.
13909         * options.h (strip_lto_sections): New option.
13910
13911 2008-12-01  Cary Coutant  <ccoutant@google.com>
13912
13913         * plugin.cc (ld_plugin_message): Change format parameter to const.
13914         Fix mismatch between new[] and delete.
13915
13916 2008-11-14  Cary Coutant  <ccoutant@google.com>
13917
13918         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13919         instead of -1U.
13920
13921 2008-11-05  Craig Silverstein  <csilvers@google.com>
13922
13923         * options.cc (General_options::parse_dynamic_list): New function.
13924         * options.h (General_options): New flags dynamic_list,
13925         dynamic_list_data, dynamic_list_cpp_new, and
13926         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13927         (General_options::in_dynamic_list): New function.
13928         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13929         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13930         (Lex::can_continue_name): Likewise.
13931         (yylex): Likewise.
13932         (read_script_file): New parameter script_options.
13933         (read_dynamic_list): New function.
13934         (Script_options::define_dynamic_list): New function.
13935         (dynamic_list_keyword_parsecodes): New variable.
13936         (dynamic_list_keywords): New variable.
13937         * script.h (Script_options::define_dynamic_list): New function
13938         prototype.
13939         (read_dynamic_list): New function prototype.
13940         * symtab.cc (strprefix): New macro.
13941         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13942         dynamic_list_data, dynamic_list_cpp_new, and
13943         dynamic_list_cpp_typeinfo.
13944         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13945         (dynamic_list_expr): New rule.
13946         (dynamic_list_nodes): Likewise.
13947         (dynamic_list_node): Likewise.
13948         * testsuite/Makefile.am (dynamic_list): New test.
13949         * testsuite/Makefile.in: Regenerated.
13950         * testsuite/dynamic_list.t: New file.
13951         * testsuite/dynamic_list.sh: New file.
13952
13953 2008-11-05  Craig Silverstein  <csilvers@google.com>
13954
13955         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13956         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13957         (t11_last): Likewise.
13958         * testsuite/ver_test_6.c (main): Likewise.
13959
13960 2008-10-07  Cary Coutant  <ccoutant@google.com>
13961
13962         * options.c (General_options::finalize): Add check for -static and
13963         -shared.
13964         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13965         is not empty.
13966
13967 2008-10-02  Cary Coutant  <ccoutant@google.com>
13968
13969         * plugin.cc (make_sized_plugin_object): Fix conditional
13970         compilation to work when not all targets are enabled.
13971
13972 2008-09-29  Cary Coutant  <ccoutant@google.com>
13973
13974         * archive.cc (Archive::get_file_and_offset): Use filename instead
13975         of name to get library path.
13976         (Archive::include_member): Unlock external member of a thin archive.
13977
13978         * testsuite/Makefile.am (TEST_AR): New variable.
13979         (thin_archive_test_1): New test.
13980         (thin_archive_test_2): New test.
13981         * testsuite/Makefile.in: Regenerate.
13982         * testsuite/thin_archive_main.cc: New file.
13983         * testsuite/thin_archive_test_1.cc: New file.
13984         * testsuite/thin_archive_test_2.cc: New file.
13985         * testsuite/thin_archive_test_3.cc: New file.
13986         * testsuite/thin_archive_test_4.cc: New file.
13987
13988 2008-09-29  Cary Coutant  <ccoutant@google.com>
13989
13990         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13991         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13992         instead of -1U.
13993         (Sized_relobj::do_finalize_local_symbols): Likewise.
13994         (Sized_relobj::map_to_kept_section): Likewise.
13995         * object.h (Sized_relobj::invalid_address): New constant.
13996         (Sized_relobj::do_output_section_offset): Check for invalid_address
13997         and return -1ULL.
13998         * output.cc (Output_reloc::local_section_offset): Use constant
13999         invalid_address instead of -1U.
14000         (Output_reloc::get_address): Likewise.
14001         (Output_section::output_address): Change -1U to -1ULL.
14002         * output.h (Output_reloc::invalid_address): New constant.
14003         * reloc.cc (Sized_relobj::write_sections): Use constant
14004         invalid_address instead of -1U.
14005         (Sized_relobj::relocate_sections): Likewise.
14006         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14007         values for merge sections.
14008         * target-reloc.h (relocate_for_relocatable): Use constant
14009         invalid_address instead of -1U.
14010
14011 2008-09-19  Cary Coutant  <ccoutant@google.com>
14012
14013         Add plugin functionality for link-time optimization (LTO).
14014         * configure.ac (plugins): Add --enable-plugins option.
14015         * configure: Regenerate.
14016         * config.in: Regenerate.
14017         * Makefile.am (LIBDL): New variable.
14018         (CCFILES): Add plugin.cc.
14019         (HFILES): Add plugin.h.
14020         (ldadd_var): Add LIBDL.
14021         * Makefile.in: Regenerate.
14022
14023         * archive.cc: Include "plugin.h".
14024         (Archive::setup): Don't preread archive symbols when using a plugin.
14025         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14026         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14027         files.
14028         (Archive::include_member): Add symbols from plugin objects.
14029         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14030         * descriptors.cc (Descriptors::open): Check for file descriptors
14031         abandoned by plugins.
14032         (Descriptors::claim_for_plugin): New function.
14033         * descriptors.h (Descriptors::claim_for_plugin): New function.
14034         (Open_descriptor::is_claimed): New field.
14035         (claim_descriptor_for_plugin): New function.
14036         * fileread.cc (File_read::claim_for_plugin): New function.
14037         * fileread.h (File_read::claim_for_plugin): New function.
14038         (File_read::descriptor): New function.
14039         * gold.cc: Include "plugin.h".
14040         (queue_initial_tasks): Add task to call plugin hooks for generating
14041         new object files.
14042         * main.cc: Include "plugin.h".
14043         (main): Load plugin libraries.
14044         * object.h (Pluginobj): Declare.
14045         (Object::pluginobj): New function.
14046         (Object::do_pluginobj): New function.
14047         (Object::set_target): New function.
14048         * options.cc: Include "plugin.h".
14049         (General_options::parse_plugin): New function.
14050         (General_options::General_options): Initialize plugins_ field.
14051         (General_options::add_plugin): New function.
14052         * options.h (Plugin_manager): Declare.
14053         (General_options): Add --plugin option.
14054         (General_options::has_plugins): New function.
14055         (General_options::plugins): New function.
14056         (General_options::add_plugin): New function.
14057         (General_options::plugins_): New field.
14058         * plugin.cc: New file.
14059         * plugin.h: New file.
14060         * readsyms.cc: Include "plugin.h".
14061         (Read_symbols::do_read_symbols): Check for archive before checking
14062         for ELF file.  Call plugin hooks to claim files.
14063         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14064         from a real object file; force override when processing replacement
14065         files.
14066         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14067         (Symbol::init_base_object): Likewise.
14068         (Symbol::init_base_output_data): Likewise.
14069         (Symbol::init_base_output_segment): Likewise.
14070         (Symbol::init_base_constant): Likewise.
14071         (Symbol::init_base_undefined): Likewise.
14072         (Symbol::output_section): Assert that object is not a plugin.
14073         (Symbol_table::add_from_pluginobj): New function.
14074         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14075         undefined.
14076         (Symbol_table::sized_write_globals): Likewise.
14077         (Symbol_table::add_from_pluginobj): Instantiate template.
14078         * symtab.h (Sized_pluginobj): Declare.
14079         (Symbol::in_real_elf): New function.
14080         (Symbol::set_in_real_elf): New function.
14081         (Symbol::in_real_elf_): New field.
14082         (Symbol_table::add_from_pluginobj): New function.
14083
14084         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14085         (LIBDL): New variable.
14086         (LDADD): Add LIBDL.
14087         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14088         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14089         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14090         (MOSTLYCLEANFILES): Likewise.
14091         * testsuite/Makefile.in: Regenerate.
14092         * testsuite/plugin_test.c: New file.
14093         * testsuite/plugin_test_1.sh: New file.
14094         * testsuite/plugin_test_2.sh: New file.
14095
14096 2008-09-16  Ian Lance Taylor  <iant@google.com>
14097
14098         * target-reloc.h (relocate_section): Check whether a symbol is
14099         defined by the ABI before reporting an undefined symbol error.
14100         * target.h (Target::is_defined_by_abi): Make parameter const.
14101         (Target::do_is_defined_by_abi): Likewise.
14102         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14103         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14104         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14105         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14106         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14107         * testsuite/Makefile.in: Rebuild.
14108
14109         * fileread.cc (make_view): Add casts to avoid warning.
14110
14111 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14112
14113         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14114         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14115
14116 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14117
14118         * options.h (General_options::output_is_executable): New.
14119         (General_options::output_is_pie): New.
14120         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14121         for shared libraries.
14122         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14123
14124 2008-09-11  Chris Demetriou  <cgd@google.com>
14125
14126         * options.h (origin): New -z option.
14127         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14128         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14129         in DT_FLAGS_1.
14130
14131 2008-09-05  Cary Coutant  <ccoutant@google.com>
14132
14133         * fileread.cc (File_read::make_view): Add check for attempt to map
14134         beyond end of file.
14135
14136 2008-09-05  Cary Coutant  <ccoutant@google.com>
14137
14138         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14139         explicit instantiations.
14140
14141 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14142
14143         PR gold/6858
14144         * options.cc (General_options::finalize): Allow undefined symbols
14145         in shlibs if linking -shared.
14146
14147         PR gold/6859
14148         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14149         symbols as not needing a dynsym entry.
14150
14151 2008-08-20  Craig Silverstein  <csilvers@google.com>
14152
14153         * fileread.cc (File_read::open): Do not lock the file unless it
14154         was successfully opened.
14155
14156 2008-08-14  Cary Coutant  <ccoutant@google.com>
14157
14158         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14159         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14160         * testsuite/tls_test.cc (struct int128): 128-bit struct
14161         for testing TLS relocs with non-zero addend.
14162         (v12): New TLS variable.
14163         (t12): New test.
14164         (t_last): Add check for v12.
14165         * testsuite/tls_test.h (t12): New function.
14166         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14167
14168 2008-08-13  Ian Lance Taylor  <iant@google.com>
14169
14170         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14171         set tls_segment_ or relro_segment_.
14172         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14173         when appropriate.
14174         * output.h (Output_section::clear_is_relro): New function.
14175         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14176         sections specially even when output_data_ is empty.
14177         (Output_segment::maximum_alignment): When first section is relro,
14178         only force alignment for PT_LOAD segments.
14179         * script.cc (script_data_segment_align): New function.
14180         (script_data_segment_relro_end): New function.
14181         * script-c.h (script_data_segment_align): Declare.
14182         (script_data_segment_relro_end): Declare.
14183         * script-sections.h (class Script_sections): Declare
14184         data_segment_align and data_segment_relro_end.  Add fields
14185         segment_align_index_ and saw_relro_end_.
14186         * script-sections.cc (class Sections_element): Add set_is_relro
14187         virtual function.  Add new bool* parameter to place_orphan_here.
14188         Add get_output_section virtual function.
14189         (class Output_section_definition): Add set_is_relro.  Add new
14190         bool* parameter to place_orphan_here.  Add get_output_section.
14191         Add is_relro_ field.
14192         (Output_section_definition::Output_section_definition): Initialize
14193         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14194         and is_relro_ fields.
14195         (Output_section_definition::place_orphan_here): Add is_relro
14196         parameter.
14197         (Output_section_definition::set_section_addresses): Set relro for
14198         output section.
14199         (Output_section_definition::alternate_constraint): Likewise.
14200         (class Orphan_output_section): Add new bool* parameter to
14201         place_orphan_here.  Add get_output_section.
14202         (Orphan_output_section::place_orphan_here): Add is_relro
14203         parameter.
14204         (Script_sections::Script_sections): Initialize
14205         data_segment_align_index_ and saw_relro_end_.
14206         (Script_sections::data_segment_align): New function.
14207         (Script_sections::data_segment_relro_end): New function.
14208         (Script_sections::place_orphan): Set or clear is_relro.
14209         (Script_sections::set_section_addresses): Force alignment of first
14210         TLS section.
14211         * yyscript.y (exp): Call script_data_segment_align and
14212         script_data_segment_relro_end.
14213         * testsuite/relro_script_test.t: New file.
14214         * testsuite/relro_test.cc (using_script): Declare.
14215         (t1, t2): Test using_script.
14216         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14217         (relro_script_test_SOURCES): Define.
14218         (relro_script_test_DEPENDENCIES): Define.
14219         (relro_script_test_LDFLAGS): Define.
14220         (relro_script_test_LDADD): Define.
14221         (relro_script_test.so): New target.
14222         * testsuite/Makefile.in: Rebuild.
14223
14224 2008-08-06  Cary Coutant <ccoutant@google.com>
14225
14226         * archive.cc (Archive::total_archives, Archive::total_members)
14227         (Archive::total_members_loaded): New variables.
14228         (Archive::setup): Add parameter.  Add option to preread
14229         archive symbols.
14230         (Archive::read_armap): Add counter.
14231         (Archive::get_file_and_offset): New function.
14232         (Archive::get_elf_object_for_member): New function.
14233         (Archive::read_all_symbols): New function.
14234         (Archive::read_symbols): New function.
14235         (Archive::add_symbols): Add counters.
14236         (Archive::include_all_members): Use armap to find members if it's
14237         already built.
14238         (Archive::include_member): Skip reading symbols if already read.
14239         Factored code into Archive::get_file_and_offset and
14240         Archive::get_elf_object_for_member.  Changed call to
14241         Mapfile::report_include_archive_member.
14242         (Archive::print_stats): New function.
14243         * archive.h: Declare Object and Read_symbols_data classes.
14244         (Archive::Archive): Add initializers for new members.
14245         (Archive::setup): Add parameter.
14246         (Archive::print_stats): New function.
14247         (Archive::total_archives, Archive::total_members)
14248         (Archive::total_members_loaded): New variables.
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::Archive_member): New class.
14254         (Archive::members_): New member.
14255         (Archive::num_members_): New member.
14256         * main.cc: Include archive.h.
14257         (main): Call Archive::print_stats.
14258         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14259         archive parameter; member_name is now the fully-decorated name.
14260         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14261         * options.h: (General_options): Add --preread-archive-symbols option.
14262         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14263         Archive::setup.
14264
14265 2008-08-04  Ian Lance Taylor  <iant@google.com>
14266
14267         * symtab.h (Symbol::use_plt_offset): New function.
14268         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14269         * powerpc.cc (Relocate::relocate): Likewise.
14270         * sparc.cc (Relocate::relocate): Likewise.
14271         * x86_64.cc (Relocate::relocate): Likewise.
14272         * testsuite/weak_plt.sh: New test.
14273         * testsuite/weak_plt_main.cc: New test.
14274         * testsuite/weak_plt_shared.cc: New test.
14275         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14276         (check_PROGRAMS): Add weak_plt.
14277         (check_DATA): Add weak_plt_shared.so.
14278         (weak_plt_main_pic.o, weak_plt): New targets.
14279         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14280         * testsuite/Makefile.in: Rebuild.
14281
14282         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14283         gcctestdir/ld.
14284         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14285         * testsuite/Makefile.in: Rebuild.
14286
14287 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14288
14289         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14290         * Makefile.in: Regenerate.
14291         * po/POTFILES.in: Regenerate.
14292
14293 2008-07-29  Ian Lance Taylor  <iant@google.com>
14294
14295         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14296         symbols before other symbols.
14297         * testsuite/script_test_2.cc (test_addr): Declare.
14298         (test_addr_alias): Declare.
14299         (main): Check that test_addr and test_addr_alias have the right
14300         values.
14301         * testsuite/script_test_2.t: Define test_addr_alias and
14302         test_addr.
14303
14304 2008-07-24  Ian Lance Taylor  <iant@google.com>
14305
14306         PR 5990
14307         * descriptors.cc: New file.
14308         * descriptors.h: New file.
14309         * gold-threads.h (class Hold_optional_lock): New class.
14310         * fileread.cc: Include "descriptors.h".
14311         (File_read::~File_read): Release descriptor rather than closing
14312         it.
14313         (File_read::open) [file]: Call open_descriptor rather than open.
14314         Set is_descriptor_opened_.
14315         (File_read::open) [memory]: Assert that descriptor is not open.
14316         (File_read::reopen_descriptor): New function.
14317         (File_read::release): Release descriptor.
14318         (File_read::do_read): Make non-const.  Reopen descriptor.
14319         (File_read::read): Make non-const.
14320         (File_read::make_view): Reopen descriptor.
14321         (File_read::do_readv): Likewise.
14322         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14323         Update declarations.
14324         * layout.cc: Include "descriptors.h".
14325         (Layout::create_build_id): Use open_descriptor rather than open.
14326         * output.cc: Include "descriptors.h".
14327         (Output_file::open): Use open_descriptor rather than open.
14328         * archive.cc (Archive::const_iterator): Change Archive to be
14329         non-const.
14330         (Archive::begin, Archive::end): Make non-const.
14331         (Archive::count_members): Likewise.
14332         * archive.h (class Archive): Update declarations.
14333         * object.h (Object::read): Make non-const.
14334         * Makefile.am (CCFILES): Add descriptors.cc.
14335         (HFILES): Add descriptors.h.
14336         * Makefile.in: Rebuild.
14337
14338         PR 6716
14339         * gold.h: Always include <clocale>.  Add Solaris workarounds
14340         following code in binutils/sysdep.h.
14341
14342         PR 6048
14343         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14344         this->eh_frame_hdr_ is NULL before using it.
14345
14346         * dynobj.cc (Versions::Versions): Update comment.
14347
14348         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14349         the base version name.
14350
14351         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14352         array size plus one.
14353         (Stringpool_template::set_string_offsets): Subtract one from key
14354         before using it as an array index.
14355         (Stringpool_template::get_offset_with_length): Likewise.
14356         (Stringpool_template::write_to_buffer): Likewise.
14357         * stringpool.h (Stringpool_template::get_offset_from_key):
14358         Likewise.
14359
14360 2008-07-23  Ian Lance Taylor  <iant@google.com>
14361
14362         PR 6658
14363         * object.h (Merged_symbol_value::value): Do our best to handle a
14364         negative addend.
14365
14366         PR 6647
14367         * script.cc (Version_script_info::get_versions): Don't add empty
14368         version tag to return value.
14369         (Version_script_info::get_symbol_version_helper): Change return
14370         type to bool.  Add pversion parameter.  Change all callers.
14371         (script_register_vers_node): Don't require a non-NULL tag.
14372         * script.h (class Version_script_info): Update declarations.
14373         (Version_script_info::get_symbol_version): Change return type to
14374         bool.  Add version parameter.  Change all callers.
14375         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14376         handling.  Handle an empty version from a version script.
14377         (Symbol_table::define_special_symbol): Likewise.
14378         * testsuite/ver_test_10.script: New file.
14379         * testsuite/ver_test_10.sh: New file.
14380         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14381         (check_DATA): Add ver_test_10.syms.
14382         (ver_test_10.syms, ver_test_10.so): New target.
14383         * testsuite/Makefile.in: Rebuild.
14384
14385 2008-07-23  Simon Baldwin  <simonb@google.com>
14386
14387         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14388         to zero for undefined symbols from dynamic libraries.
14389
14390 2008-07-23  Ian Lance Taylor  <iant@google.com>
14391
14392         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14393         Change all callers.
14394         * symtab.h (class Symbol_table): Update declaration.
14395         * testsuite/ver_test_9.cc: New file.
14396         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14397         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14398         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14399         (ver_test_9.so, ver_test_9.o): New targets.
14400         * testsuite/Makefile.in: Rebuild.
14401
14402 2008-07-22  Ian Lance Taylor  <iant@google.com>
14403
14404         * options.h (class General_options): Define --check-sections.
14405         * layout.cc (Layout::set_segment_offsets): Handle
14406         --check-sections.
14407
14408         * options.h (class General_options): Define -n/--nmagic and
14409         -N/--omagic.
14410         * options.cc (General_options::finalize): For -n/--nmagic or
14411         -N/--omagic, set -static.
14412         * layout.cc (Layout::attach_allocated_section_to_segment): If
14413         -N/--omagic, don't put read-only and read-write sections in
14414         different segments.
14415         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14416         finding a read-only segment.
14417         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14418         don't set the minimum segment alignment to the common page size,
14419         and don't set the file offset to the address modulo the page size.
14420         * script-sections.cc (Script_sections::create_segments): If
14421         -n/--omagic, don't put read-only and read-write sections in
14422         different segments.
14423
14424         * cref.cc: New file.
14425         * cref.h: New file.
14426         * options.h (class General_options): Add --print-symbol-counts.
14427         * main.cc (main): Issue defined symbol report if requested.
14428         * archive.cc (Archive::interpret_header): Make into a const member
14429         function.
14430         (Archive::add_symbols): Call Input_objects::archive_start and
14431         archive_stop.
14432         (Archive::const_iterator): Define new class.
14433         (Archive::begin, Archive::end): New functions.
14434         (Archive::include_all_members): Rewrite to use iterator.
14435         (Archive::count_members): New function.
14436         * archive.h (class Archive): Update declarations.
14437         (Archive::filename): New function.
14438         * object.cc: Include "cref.h".
14439         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14440         (Sized_relobj::do_get_global_symbol_counts): New function.
14441         (Input_objects::add_object): Add object to cross-referencer.
14442         (Input_objects::archive_start): New function.
14443         (Input_objects::archive_stop): New function.
14444         (Input_objects::print_symbol_counts): New function.
14445         * object.h: Declare Cref and Archive.
14446         (Object::get_global_symbol_counts): New function.
14447         (Object::do_get_global_symbol_counts): New pure virtual function.
14448         (class Sized_relobj): Add defined_count_ field.  Update
14449         declarations.
14450         (class Input_objects): Add cref_ field.  Update constructor.
14451         Update declarations.
14452         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14453         defined_count_.
14454         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14455         symbol counts.
14456         (Sized_dynobj::do_get_global_symbol_counts): New function.
14457         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14458         defined_count_.  Update declarations.  Define Symbols typedef.
14459         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14460         parameter.  Change all callers.
14461         (Symbol_table::add_from_dynobj): Add sympointers and defined
14462         parameters.  Change all callers.
14463         * symtab.h (class Symbol_table): Update declarations.
14464         * Makefile.am (CCFILES): Add cref.cc.
14465         (HFILES): Add cref.h.
14466         * Makefile.in: Rebuild.
14467
14468 2008-07-22  Simon Baldwin  <simonb@google.com>
14469
14470         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14471         to zero when writing undefined symbols.
14472
14473 2008-07-22  Ian Lance Taylor  <iant@google.com>
14474
14475         * output.cc (Output_section::add_input_section): Don't try to
14476         merge empty merge sections.
14477
14478 2008-07-21  Craig Silverstein  <csilvers@google.com>
14479
14480         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14481         Include symbol version in error message.
14482
14483 2008-07-20  Chris Demetriou  <cgd@google.com>
14484
14485         * configure.ac (gold_cv_c_random_seed): New configured variable.
14486         (RANDOM_SEED_CFLAGS): New substituted variable.
14487         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14488         * configure: Rebuild.
14489         * Makefile.in: Likewise.
14490         * testsuite/Makefile.in: Likewise.
14491
14492 2008-07-18  Ian Lance Taylor  <iant@google.com>
14493
14494         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14495         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14496         * testsuite/ver_test_main.cc (main): Call t4.
14497         (t4, t4_2a): Define.
14498         * testsuite/ver_test_2.cc (t4_2): Define.
14499         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14500         * testsuite/ver_test_4.cc (t4_2a): Define.
14501         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14502         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14503
14504 2008-07-17  Ian Lance Taylor  <iant@google.com>
14505
14506         * dynobj.cc (Versions::add_def): If we give an error about a
14507         missing version, go ahead and create the version anyhow.
14508
14509 2008-07-10  Ian Lance Taylor  <iant@google.com>
14510
14511         Handle output sections with more than 0x7fffffff bytes.
14512         * object.h (class Relobj): Change map_to_output_ to
14513         output_sections_, and just keep a section pointer.  Change all
14514         uses.  Move comdat group support to Sized_relobj.
14515         (Relobj::is_section_specially_mapped): Remove.
14516         (Relobj::output_section): Remove poff parameter.  Change all
14517         callers.
14518         (Relobj::output_section_offset): New function.
14519         (Relobj::set_section_offset): Rewrite.
14520         (Relobj::map_to_output): Remove.
14521         (Relobj::output_sections): New function.
14522         (Relobj::do_output_section_offset): New pure virtual function.
14523         (Relobj::do_set_section_offset): Likewise.
14524         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14525         group support from Relobj.  Update declarations.
14526         (Sized_relobj::get_output_section_offset): New function.
14527         (Sized_relobj::do_output_section_offset): New function.
14528         (Sized_relobj::do_set_section_offset): New function.
14529         * object.cc (Relobj::output_section_address): Remove.
14530         (Sized_relobj::Sized_relobj): Initialize new fields.
14531         (Sized_relobj::include_section_group): Cast find_kept_object to
14532         Sized_relobj.
14533         (Sized_relobj::include_linkonce_section): Likewise.
14534         (Sized_relobj::do_layout): Use separate arrays for output section
14535         and output offset.
14536         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14537         output_sections.
14538         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14539         output_sections and section_offsets.
14540         (Sized_relobj::write_local_symbols): Likewise.
14541         (map_to_kept_section): Compute output address directly.
14542         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14543         output_sections and section_offsets.
14544         (Sized_relobj::write_sections): Likewise.
14545         (Sized_relobj::relocate_sections): Likewise.
14546         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14547         * output.h (class Output_reloc): Update declarations.  Change
14548         u2_.relobj to Sized_relobj*.
14549         (class Output_data_reloc): Change add functions to use
14550         Sized_relobj*.
14551         * output.cc (Output_reloc::Output_reloc): Change relobj to
14552         Sized_relobj*.
14553         (Output_reloc::local_section_offset): Change return type to
14554         Elf_Addr.  Use get_output_section_offset.
14555         (Output_reloc::get_address): Likewise.
14556         (Output_section::is_input_address_mapped): Don't call
14557         is_section_specially_mapped.
14558         (Output_section::output_offset): Likewise.
14559         (Output_section::output_address): Likewise.
14560         (Output_section::starting_output_address): Likewise.
14561         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14562         parameter to Sized_relobj*.
14563         (Copy_relocs::need_copy_reloc): Likewise.
14564         (Copy_relocs::save): Likewise.
14565         * copy-relocs.h (class Copy_relocs): Update declarations.
14566         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14567         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14568         * target-reloc.h (relocate_for_relocatable): Change
14569         offset_in_output_section type to Elf_Addr.  Change code that uses
14570         it as well.
14571         * layout.cc (Layout::layout): Always set *off.
14572         * mapfile.cc (Mapfile::print_input_section): Use
14573         output_section_offset.
14574         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14575         Sized_relobj*.
14576         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14577         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14578         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14579
14580 2008-07-03  Ian Lance Taylor  <iant@google.com>
14581
14582         * layout.cc (Layout::include_section): Do not discard unrecognized
14583         SHT_STRTAB sections.
14584
14585 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14586
14587         * script.cc (Lex::can_continue_name): Make '?' allowable in
14588         version-script names.
14589         * testsuite/version_script.map: Change glob pattern to use '?'
14590
14591 2008-06-30  Manish Singh  <yosh@gimp.org>
14592
14593         PR 6585
14594         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14595         Correct typo.
14596
14597 2008-06-30  Ian Lance Taylor  <iant@google.com>
14598
14599         PR 6660
14600         PR 6682
14601         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14602         versions]: Don't try to read the value in the contents, since we
14603         don't use it.  Use the template endianness when writing.
14604
14605 2008-06-25  Cary Coutant  <ccoutant@google.com>
14606
14607         * fileread.cc (File_read::make_view): Assert on zero-length view.
14608         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14609         symbol table when there are no symbols to read.
14610
14611 2008-06-23  Craig Silverstein  <csilvers@google.com>
14612
14613         * version.cc (version_string): Bump to 1.7
14614
14615 2008-06-18  Craig Silverstein  <csilvers@google.com>
14616
14617         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14618         constant 0xFFFF to type Valtype.
14619         (Powerpc_relocate_functions::rel16_ha): Likewise.
14620
14621 2008-06-17  Ian Lance Taylor  <iant@google.com>
14622
14623         * output.h (Output_section::Input_section): Initialize p2align_ to
14624         zero for Output_section_data constructors.
14625         (Output_section::Input_section::addralign): If not an input
14626         section, return the alignment of the Output_section_data.
14627         * testsuite/copy_test.cc: New file.
14628         * testsuite/copy_test_1.cc: New file.
14629         * testsuite/copy_test_2.cc: New file.
14630         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14631         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14632         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14633         (copy_test_1_pic.o, copy_test_1.so): New targets.
14634         (copy_test_2_pic.o, copy_test_2.so): New targets.
14635         * testsuite/Makefile.in: Rebuild.
14636
14637         * script-sections.cc (Script_sections::place_orphan): Initialize
14638         local variable exact.
14639
14640 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14641
14642         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14643
14644 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14645             David S. Miller  <davem@davemloft.net>
14646
14647         * powerpc.cc: New file.
14648         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14649         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14650         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14651         * Makefile.in: Rebuild.
14652
14653 2008-06-09  Ian Lance Taylor  <iant@google.com>
14654
14655         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14656         <exception>.
14657         (throwing, orig_terminate): New static variables.
14658         (terminate_handler): New static function.
14659         (t2): Set terminate handler.
14660
14661 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14662
14663         PR 6584
14664         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14665         alignment.
14666
14667 2008-05-30  Cary Coutant  <ccoutant@google.com>
14668
14669         * archive.cc (Archive::include_all_members) Correct to step
14670         over symbol table and extended name table in thin archives.
14671
14672 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14673
14674         PR 6407
14675         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14676         calculation.
14677
14678 2008-05-28  Caleb Howe  <cshowe@google.com>
14679
14680         * reduced_debug_output.cc: New file.
14681         * reduced_debug_output.h: New file.
14682         * options.h (class General_options): Add --strip-debug-non-line.
14683         * options.cc (General_options::finalize): Add strip_debug_non_line
14684         to the strip heirarchy.
14685         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14686         fields.
14687         * layout.cc: Include "reduced_debug_output.h".
14688         (Layout::Layout): Initialize new fields.
14689         (line_only_debug_sections): New static array.
14690         (is_lines_only_debug_sections): New static inline function.
14691         (Layout::include_section): Handle --strip-debug-non-line.
14692         (Layout::make_output_section): If --strip-debug-non-line, build
14693         new output sections for .debug_abbrev and .debug_info.
14694         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14695         gold.  Warn about possible overflow.
14696         (read_signed_LEB_128): Likewise.
14697         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14698         (read_signed_LEB_128): Declare.
14699         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14700         (HFILES): Add reduced_debug_output.h.
14701         * Makefile.in: Rebuild.
14702
14703 2008-05-21  Ian Lance Taylor  <iant@google.com>
14704
14705         * mapfile.cc: New file.
14706         * mapfile.h: New file.
14707         * options.h (class General_options): Add -M/--print-map and -Map.
14708         * options.cc (General_options::finalize): Make -M equivalent to
14709         -Map -.
14710         * main.cc: Include <cstdio> and "mapfile.h".
14711         (main): Open mapfile if requested.
14712         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14713         constructor.  Change caller.
14714         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14715         (queue_middle_tasks): Likewise.
14716         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14717         declarations.
14718         * archive.cc: Include "mapfile.h".
14719         (Archive::add_symbols): Add mapfile parameter.  Change all
14720         callers.  Pass mapfile, symbol, and reason to include_member.
14721         (Archive::include_all_members): Add mapfile parameter.  Change all
14722         callers.
14723         (Archive::include_member): Add mapfile, sym, and why parameters.
14724         Change all callers.  Report inclusion to map file.
14725         * archive.h: Include "fileread.h".
14726         (class Archive): Update declarations.
14727         (Archive::file): New const method.
14728         (class Add_archive_symbols): Add mapfile_ field.  Update
14729         constructor.  Change all callers.
14730         * readsyms.h (class Read_symbols): Likewise.
14731         (class Finish_group): Likewise.
14732         (class Read_script): Likewise.
14733         * common.cc: Include "mapfile.h".
14734         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14735         all callers.
14736         (Symbol_table::do_allocate_commons): Likewise.
14737         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14738         symbol allocation to mapfile.
14739         * common.h (class Allocate_commons_task): Add mapfile_ field.
14740         Update constructor.  Change all callers.
14741         * symtab.h (class Symbol_table): Update declarations.
14742         * layout.cc: Include "mapfile.h".
14743         (Layout_task_runner::run): Print information to mapfile.
14744         (Layout::create_gold_note): Change Output_data_fixed_space to
14745         Output_data_zero_fill.
14746         (Layout::create_build_id): Likewise.
14747         (Layout::print_to_mapfile): New function.
14748         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14749         constructor.  Change caller.
14750         (class Layout): Declare print_to_mapfile.
14751         * output.cc (Output_section::Input_section::print_to_mapfile): New
14752         function.
14753         (Output_section::add_input_section): If producing a map, always
14754         add to input_sections_ list.
14755         (Output_section::do_print_to_mapfile): New function.
14756         (Output_segment::print_sections_to_mapfile): New function.
14757         (Output_segment::print_section_list_to_mapfile): New function.
14758         * output.h: Include "mapfile.h".
14759         (Output_data::print_to_mapfile): New function.
14760         (Output_data::do_print_to_mapfile): New virtual function.
14761         (Output_segment_headers::do_print_to_mapfile): New function.
14762         (Output_file_header::do_print_to_mapfile): New function.
14763         (Output_data_const::do_print_to_mapfile): New function.
14764         (class Output_data_const_buffer): Add map_name_ field.  Update
14765         constructor.  Change all callers.  Add do_print_to_mapfile
14766         function.
14767         (class Output_data_fixed_space): Likewise.
14768         (class Output_data_space): Likewise.
14769         (class Output_data_zero_fill): New class.
14770         (Output_data_strtab::do_print_to_mapfile): New function.
14771         (Output_data_reloc_base::do_print_to_mapfile): New function.
14772         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14773         (Output_data_group::do_print_to_mapfile): New function.
14774         (Output_data_got::do_print_to_mapfile): New function.
14775         (Output_data_dynamic::do_print_to_mapfile): New function.
14776         (Output_symtab_xindex::do_print_to_mapfile): New function.
14777         (class Output_section): Declare do_print_to_mapflie.  Declare
14778         print_to_mapfile in Input_section.
14779         (class Output_segment): Declare new functions.
14780         * object.h (Sized_relobj::symbol_count): New function.
14781         * script-sections.cc
14782         (Output_section_element_dot_assignment::set_section_addresses):
14783         Change Output_data_fixed_space to Output_data_zero_fill.
14784         (Output_data_expression::do_print_to_mapfile): New function.
14785         * script.cc (read_input_script): Add mapfile parameter.  Change
14786         all callers.
14787         * script.h (read_input_script): Update declaration.
14788         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14789         (Eh_frame::do_print_to_mapfile): New function.
14790         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14791         (Output_merge_string::do_print_to_mapfile): New function.
14792         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14793         function.
14794         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14795         function.
14796         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14797         function.
14798         * Makefile.am (CCFILES): Add mapfile.cc.
14799         (HFILES): Add mapfile.h.
14800         * Makefile.in: Rebuild.
14801
14802 2008-05-19  Ian Lance Taylor  <iant@google.com>
14803
14804         * options.h (class General_options): Add -z relro.
14805         * layout.cc (Layout::Layout): Initialize relro_segment_.
14806         (Layout::add_output_section_data): Return the output section.
14807         (Layout::make_output_section): Rcognize relro sections and mark
14808         them appropriately.
14809         (Layout::attach_allocated_section_to_segment): Put relro sections
14810         in a PT_GNU_RELRO segment.
14811         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14812         section as relro.
14813         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14814         PT_TLS segments.
14815         (Layout::linkonce_mapping): Map d.rel.ro.local to
14816         .data.rel.ro.local.
14817         (Layout::output_section_name): Us .data.rel.ro.local for any
14818         section which begins with that.
14819         * layout.h (class Layout): Update add_output_section_data
14820         declaration.  Add relro_segment_ field.
14821         * output.cc (Output_section::Output_section): Initialize is_relro_
14822         and is_relro_local_ fields.
14823         (Output_segment::add_output_section): Group relro sections.
14824         (Output_segment::is_first_section_relro): New function.
14825         (Output_segment::maximum_alignment): If there is a relro section,
14826         align the segment to the common page size.
14827         (Output_segment::set_section_addresses): Track whether we are
14828         looking at relro sections.  If the last section is a relro
14829         section, align to the common page size.
14830         (Output_segment::set_section_list_addresses): Add in_relro
14831         parameter.  Change all callers.  Align to the page size when
14832         moving from relro to non-relro section.
14833         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14834         segment.
14835         * output.h (class Output_section): Add is_relro_ and
14836         is_relro_local_ fields.
14837         (Output_section::is_relro): New function.
14838         (Output_section::set_is_relro): New function.
14839         (Output_section::is_relro_local): New function.
14840         (Output_section::set_is_relro_local): New function.
14841         (class Output_segment): Update declarations.
14842         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14843         * sparc.cc (Target_sparc::got_section): Likewise.
14844         * x86_64.cc (Target_x86_64::got_section): Likewise.
14845         * testsuite/relro_test_main.cc: New file.
14846         * testsuite/relro_test.cc: New file.
14847         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14848         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14849         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14850         (relro_test.so, relro_test_pic.o): New targets.
14851         * testsuite/Makefile.in: Rebuild.
14852
14853 2008-05-16  Ian Lance Taylor  <iant@google.com>
14854
14855         * output.cc (Output_segment::add_output_section): Remove front
14856         parameter.
14857         * output.h (class Output_segment): Remove
14858         add_initial_output_section and overloaded add_output_section.
14859         Update declaration of remaining add_output_section.
14860         * layout.cc (Layout::create_interp): Call add_output_section
14861         rather than add_initial_output_section.
14862         (Layout::finish_dynamic_section): Likewise.
14863
14864         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14865         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14866         know the dynamic type.
14867         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14868         field.  Initialize it in constructor.
14869         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14870         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14871         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14872         reloc.
14873
14874         * output.cc (Output_reloc::get_address): Change return type to
14875         Elf_Addr.
14876         * output.h (class Output_reloc): Update get_address declaration.
14877         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14878         for section addresses.
14879
14880 2008-05-09  Ian Lance Taylor  <iant@google.com>
14881
14882         PR 6493
14883         * gold.cc (gold_nomem): Use return value of write.
14884
14885 2008-05-08  Ian Lance Taylor  <iant@google.com>
14886
14887         * symtab.c (Symbol::init_base_output_data): Add version
14888         parameter.  Change all callers.
14889         (Symbol::init_base_output_segment): Likewise.
14890         (Symbol::init_base_constant): Likewise.
14891         (Symbol::init_base_undefined): Likewise.
14892         (Sized_symbol::init_output_data): Likewise.
14893         (Sized_symbol::init_output_segment): Likewise.
14894         (Sized_symbol::init_constant): Likewise.
14895         (Sized_symbol::init_undefined): Likewise.
14896         (Symbol_table::do_define_in_output_data): If the new symbol has a
14897         version, mark it as the default.
14898         (Symbol_table::do_define_in_output_segment): Likewise.
14899         (Symbol_table::do_define_as_constant): Likewise.
14900         * symtab.h (class Symbol): Update declarations.
14901         (class Sized_symbol): Likewise.
14902         * resolve.cc (Symbol::override_version): New function.
14903         (Symbol::override_base): Call override_version.
14904         (Symbol::override_base_with_special): Likewise.
14905         * testsuite/ver_script_8.script: New file.
14906         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14907         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14908         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14909         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14910
14911 2008-05-06  Ian Lance Taylor  <iant@google.com>
14912
14913         PR 6049
14914         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14915         functions.
14916         (class General_options): Remove existing --undefined, and add
14917         --no-undefined instead.  Add new --undefined as synonym for -u.
14918         * archive.cc (Archive::add_symbols): Check whether symbol was
14919         named with -u.
14920         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14921         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14922         all uses.  Add IS_UNDEFINED.  Update declarations to split
14923         different versions of init_base.  Declare init_base_undefined.
14924         (Symbol::is_defined): Handle IS_UNDEFINED.
14925         (Symbol::is_undefined): Likewise.
14926         (Symbol::is_weak_undefined): Call is_undefined.
14927         (Symbol::is_absolute): Handle IS_CONSTANT.
14928         (class Sized_symbol): Update declarations to split different
14929         versions of init.  Declare init_undefined.
14930         (class Symbol_table): Declare new functions.
14931         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14932         Change all callers.
14933         (Symbol::init_base_output_data): Likewise.
14934         (Symbol::init_base_output_segment): Likewise.
14935         (Symbol::init_base_constant): Likewise.
14936         (Symbol::init_base_undefined): New function.
14937         (Sized_symbol::init_object): Rename from init.  Change all
14938         callers.
14939         (Sized_symbol::init_output_data): Likewise.
14940         (Sized_symbol::init_output_segment): Likewise.
14941         (Sized_symbol::init_constant): Likewise.
14942         (Sized_symbol::init_undefined): New function.
14943         (Symbol_table::add_undefined_symbols_from_command_line): New
14944         function.
14945         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14946         function.
14947         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14948         (Symbol::output_section): Likewise.
14949         (Symbol::set_output_section): Likewise.
14950         (Symbol_table::sized_finalize_symbol): Likewise.
14951         (Symbol_table::sized_write_globals): Likewise.
14952         * resolve.cc (Symbol_table::should_override): Likewise.
14953         (Symbol::override_base_with_special): Likewise.
14954
14955         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14956         symbol, change it to have default visibility.
14957         * testsuite/protected_1.cc: New file.
14958         * testsuite/protected_2.cc: New file.
14959         * testsuite/protected_3.cc: New file.
14960         * testsuite/protected_main_1.cc: New file.
14961         * testsuite/protected_main_2.cc: New file.
14962         * testsuite/protected_main_3.cc: New file.
14963         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14964         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14965         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14966         (protected_1.so): New target.
14967         (protected_1_pic.o, protected_2_pic.o): New targets.
14968         (protected_3_pic.o): New target.
14969         (check_PROGRAMS): Add protected_2.
14970         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14971         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14972         * testsuite/Makefile.in: Rebuild.
14973
14974         * options.h (DEFINE_var): Add set_user_set_##varname__.
14975         (DEFINE_bool_alias): New macro.
14976         (class General_options): Define -Bstatic using DEFINE_bool_alias
14977         rather than DEFINE_special.  Add --undefined as an alias for -z
14978         defs.
14979         * options.cc (General_options::parse_Bstatic): Remove.
14980
14981         * options.h (class General_options): Add --fatal-warnings.
14982         * main.cc (main): Implement --fatal-warnings.
14983         * errors.h (Errors::warning_count): New function.
14984
14985         * options.h (class General_options): Add -Bsymbolic-functions.
14986         * symtab.h (Symbol::is_preemptible): Check for
14987         -Bsymbolic-functions.
14988
14989 2008-05-05  Ian Lance Taylor  <iant@google.com>
14990
14991         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14992         as noVARNAME rather than no-VARNAME.
14993         (class General_options): Add option -z combreloc.
14994         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14995         get_address.
14996         (Output_reloc::sort_before) [SHT_REL]: New function.
14997         (Output_reloc::sort_before) [SHT_RELA]: New function.
14998         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14999         Sort_relocs_comparison.
15000         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15001         parameter.  Change all callers.
15002         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15003         sort_relocs parameter.  Change all callers.
15004         * output.cc (Output_reloc::get_address): New function, broken out
15005         of write_rel.
15006         (Output_reloc::write_rel): Call it.
15007         (Output_reloc::compare): New function.
15008         (Output_data_reloc_base::do_write): Optionally sort relocs.
15009
15010         * configure.ac: If targ_extra_obj is set, link it in.
15011         * configure.tgt: Initialize all variables.
15012         (x86_64*): Set targ_extra_obj and targ_extra_size.
15013         * configure: Rebuild.
15014
15015         * object.cc (Sized_relobj::include_section_group): Adjust section
15016         indexes read from group data.  Build vector to pass to
15017         layout_group.
15018         * layout.cc (Layout::layout_group): Add flags and shndxes
15019         parameters.  Remove contents parameter.  Change caller.  Update
15020         explicit instantiations.
15021         * layout.h (class Layout): Update layout_group declaration.
15022         * output.cc (Output_data_group::Output_data_group): Add flags and
15023         input_shndxes parameters.  Remove contents parameter.  Change
15024         caller.
15025         (Output_data_group::do_write): Change input_sections_ to
15026         input_shndxes_.
15027         * output.h (class Output_data_group): Update constructor
15028         declaration.  Rename input_sections_ to input_shndxes_.
15029         * testsuite/many_sections_test.cc: Add template.
15030
15031 2008-04-30  Cary Coutant  <ccoutant@google.com>
15032
15033         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15034
15035         * layout.cc (Layout::include_section): Refactored check for debug
15036         info section.
15037         (Layout::add_comdat): Add new parameters.  Change type
15038         of signature parameter.  Add object and shndx to signatures table.
15039         (Layout::find_kept_object): New function.
15040         * layout.h: Include <cstring>.
15041         (Layout::is_debug_info_section): New function.
15042         (Layout::add_comdat): Add new parameters.
15043         (Layout::find_kept_object): New function.
15044         (Layout::Kept_section): New struct.
15045         (Layout::Signatures): Change type of map range.
15046         * object.cc (Relobj::output_section_address): New function.
15047         (Sized_relobj::include_section_group): Add new parameters.  Change
15048         calls to Layout::add_comdat.  Change to build table of kept comdat
15049         groups and table mapping discarded sections to kept sections.
15050         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15051         (Sized_relobj::do_layout): Change calls to include_section_group and
15052         include_linkonce_section.
15053         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15054         value to zero when section is discarded.
15055         (Sized_relobj::map_to_kept_section): New function.
15056         * object.h (Relobj::output_section_address): New function.
15057         (Relobj::Comdat_group): New type.
15058         (Relobj::find_comdat_group): New function.
15059         (Relobj::Comdat_group_table): New type.
15060         (Relobj::Kept_comdat_section): New type.
15061         (Relobj::Kept_comdat_section_table): New type.
15062         (Relobj::add_comdat_group): New function.
15063         (Relobj::set_kept_comdat_section): New function.
15064         (Relobj::get_kept_comdat_section): New function.
15065         (Relobj::comdat_groups_): New field.
15066         (Relobj::kept_comdat_sections_): New field.
15067         (Symbol_value::input_value): Update comment.
15068         (Sized_relobj::map_to_kept_section) New function.
15069         (Sized_relobj::include_linkonce_section): Add new parameter.
15070         * target-reloc.h (Comdat_behavior): New type.
15071         (get_comdat_behavior): New function.
15072         (relocate_section): Add code to map a discarded section to the
15073         corresponding kept section when applying a relocation.
15074
15075 2008-04-30  Craig Silverstein  <csilvers@google.com>
15076
15077         * dwarf_reader.cc (next_generation_count): New static var.
15078         (Addr2line_cache_entry): New struct.
15079         (addr2line_cache): New static var.
15080         (Dwarf_line_info::one_addr2line): Added caching.
15081         (Dwarf_line_info::clear_addr2line_cache): New function.
15082         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15083         cache-size parameter.
15084         (Dwarf_line_info::one_addr2line_cache): New function.
15085         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15086         new cache-size argument to one_addr2line(), and clear cache.
15087
15088 2008-04-28  Cary Coutant  <ccoutant@google.com>
15089
15090         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15091         R_386_PC8 relocations.
15092
15093 2008-04-23  Ian Lance Taylor  <iant@google.com>
15094
15095         * object.cc (Sized_relobj::include_section_group): Check for
15096         invalid section group.
15097
15098         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15099         header size.
15100
15101         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15102         than read for file header.
15103         * archive.cc (Archive::include_member): Likewise.
15104
15105 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15106
15107         * aclocal.m4: Regenerate.
15108         * configure: Regenerate.
15109
15110 2008-04-19  Ian Lance Taylor  <iant@google.com>
15111
15112         * version.cc (version_string): Bump to 1.6.
15113
15114         * testsuite/Makefile.am (many_sections_r_test): New target.
15115         (many_sections_r_test_SOURCES): Remove.
15116         (many_sections_r_test_DEPENDENCIES): Remove.
15117         (many_sections_r_test_LDFLAGS): Remove.
15118         (many_sections_r_test_LDADD): Remove.
15119
15120         * object.cc (Sized_relobj::do_add_symbols): Always pass
15121         local_symbol_count_ to add_from_relobj.
15122
15123         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15124         every thousand variables.
15125         * testsuite/Makefile.in: Rebuild.
15126
15127         * object.cc (Xindex::initialize_symtab_xindex): New function.
15128         (Xindex::read_symtab_xindex): New function.
15129         (Xindex::sym_xindex_to_shndx): New function.
15130         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15131         available.
15132         (Sized_relobj::do_initialize_xindex): New function.
15133         (Sized_relobj::do_read_symbols): Adjust section links.
15134         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15135         parameter.  Change all callers.
15136         (Sized_relobj::include_section_group): Adjust section links and
15137         symbol section indexes.
15138         (Sized_relobj::do_layout): Adjust section links.
15139         (Sized_relobj::do_count_local_symbols): Adjust section links and
15140         symbol section indexes.
15141         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15142         ordinary and special symbols.
15143         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15144         dynsym_xindex parameters.  Change all callers.  Adjust section
15145         links.  Use SHN_XINDEX when needed.
15146         (Sized_relobj::get_symbol_location_info): Adjust section links.
15147         Don't get fooled by special symbols.
15148         * object.h (class Xindex): Define.
15149         (class Object): Add xindex_ parameter.  Declare virtual functoin
15150         do_initialize_xindex.
15151         (Object::adjust_sym_shndx): New function.
15152         (Object::set_xindex): New protected function.
15153         (class Symbol_value): Add is_ordinary_shndx_ field.
15154         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15155         (Symbol_value::value): Assert ordinary section.
15156         (Symbol_value::initialize_input_to_output_map): Likewise.
15157         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15158         Change all callers.
15159         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15160         all callers.
15161         (class Sized_relobj): Update declarations.
15162         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15163         parameter.  Change all callers.
15164         (Sized_relobj::adjust_shndx): New function.
15165         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15166         field.
15167         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15168         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15169         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15170         (Sized_dynobj::read_dynsym_section): Adjust section links.
15171         (Sized_dynobj::read_dynamic): Likewise.
15172         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15173         section links.
15174         (Sized_dynobj::do_initialize_xindex): New function.
15175         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15176         do_initialize_xindex.
15177         (Sized_dynobj::adjust_shndx): New function.
15178         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15179         dynsym_xindex_ fields.
15180         (Layout::finalize): Add a call to set_section_indexes before
15181         creating the symtab sections.
15182         (Layout::set_section_indexes): Don't do anything if the section
15183         already has a section index.
15184         (Layout::create_symtab_sections): Add shnum parameter.  Change
15185         caller.  Create .symtab_shndx section if needed.
15186         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15187         caller.
15188         (Layout::allocated_output_section_count): New function.
15189         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15190         needed.
15191         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15192         fields.  Update declarations.
15193         (Layout::symtab_xindex): New function.
15194         (Layout::dynsym_xindex): New function.
15195         (class Write_symbols_task): Add layout_ field.
15196         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15197         Change caller.
15198         * output.cc (Output_section_headers::Output_section_headers): Add
15199         shstrtab_section parameter.  Change all callers.
15200         (Output_section_headers::do_sized_write): Store overflow values
15201         for section count and section string table section index in
15202         section header zero.
15203         (Output_file_header::do_sized_write): Check for overflow of
15204         section count and section string table section index.
15205         (Output_symtab_xindex::do_write): New function.
15206         (Output_symtab_xindex::endian_do_write): New function.
15207         * output.h (class Output_section_headers): Add shstrtab_section_.
15208         Update declarations.
15209         (class Output_symtab_xindex): Define.
15210         (Output_section::has_out_shndx): New function.
15211         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15212         field.
15213         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15214         Change all callers.
15215         (Sized_symbol::init): Likewise.
15216         (Symbol::output_section): Check for ordinary symbol.
15217         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15218         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15219         callers.
15220         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15221         Change all callers.  Simplify handling of symbols from sections
15222         not included in the link.
15223         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15224         distinction.
15225         (Weak_alias_sorter::operator()): Assert that symbols are
15226         ordinary.
15227         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15228         distinction.
15229         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15230         parameters.  Change all callers.
15231         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15232         symbol distinction.  Use SHN_XINDEX when needed.
15233         (Symbol_table::write_section_symbol): Add symtab_xindex
15234         parameter.  Change all callers.
15235         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15236         SHN_XINDEX when needed.
15237         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15238         declarations.
15239         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15240         (Symbol::is_defined): Check is_ordinary.
15241         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15242         (Symbol::is_absolute, Symbol::is_common): Likewise.
15243         (class Sized_symbol): Update declarations.
15244         (class Symbol_table): Update declarations.
15245         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15246         parameters.  Change all callers.
15247         (Sized_symbol::override): Likewise.
15248         (Symbol_table::override): Likewise.
15249         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15250         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15251         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15252         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15253         to be in an ordinary section.
15254         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15255         object and is_ordinary parameters.  Change all callers.
15256         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15257         Change all callers.  Don't add undefined or non-ordinary symbols
15258         to reloc_map_.
15259         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15260         Change all callers.
15261         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15262         declarations.
15263         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15264         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15265         (Sized_relobj::relocate_sections): Likewise.
15266         * target-reloc.h (scan_relocs): Adjust section symbol index.
15267         (scan_relocatable_relocs): Likewise.
15268         * i386.cc (Scan::local): Check for ordinary symbols.
15269         * sparc.cc (Scan::local): Likewise.
15270         * x86_64.cc (Scan::local): Likewise.
15271         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15272         to symbol_section_and_value.
15273         * testsuite/many_sections_test.cc: New file.
15274         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15275         (check_PROGRAMS): Add many_sections_test.
15276         (many_sections_test_SOURCES): Define.
15277         (many_sections_test_DEPENDENCIES): Define.
15278         (many_sections_test_LDFLAGS): Define.
15279         (BUILT_SOURCES): Add many_sections_define.h.
15280         (many_sections_define.h): New target.
15281         (BUILT_SOURCES): Add many_sections_check.h.
15282         (many_sections_check.h): New target.
15283         (check_PROGRAMS): Add many_sections_r_test.
15284         (many_sections_r_test_SOURCES): Define.
15285         (many_sections_r_test_DEPENDENCIES): Define.
15286         (many_sections_r_test_LDFLAGS): Define.
15287         (many_sections_r_test_LDADD): Define.
15288         (many_sections_r_test.o): New target.
15289         * testsuite/Makefile.in: Rebuild.
15290
15291 2008-04-17  Cary Coutant  <ccoutant@google.com>
15292
15293         * errors.cc (Errors::info): New function.
15294         (gold_info): New function.
15295         * errors.h (Errors::info): New function.
15296         * gold.h (gold_info): New function.
15297         * object.cc (Input_objects::add_object): Print trace output.
15298         * options.cc (options::parse_set): New function.
15299         (General_options::parse_wrap): Deleted.
15300         (General_options::General_options): Deleted initializer.
15301         * options.h (options::String_set): New typedef.
15302         (options::parse_set): New function.
15303         (DEFINE_set): New macro.
15304         (General_options::wrap): Changed to use DEFINE_set. Changed
15305         callers of any_wrap_symbols and is_wrap_symbol.
15306         (General_options::trace, General_options::trace_symbol):
15307         New options.
15308         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15309         (General_options::wrap_symbols_): Deleted.
15310         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15311
15312 2008-04-17  David S. Miller  <davem@davemloft.net>
15313
15314         * options.cc (General_options::parse_V): New function.
15315         * options.h: Add entries for -V and -Qy.
15316
15317 2008-04-17  Ian Lance Taylor  <iant@google.com>
15318
15319         * common.cc (Symbol_table::allocate_commons): Remove options
15320         parameter.  Change caller.
15321         (Symbol_table::do_allocate_commons): Remove options parameter.
15322         Change caller.  Just call do_allocate_commons_list twice.
15323         (Symbol_table::do_allocate_commons_list): New function, broken out
15324         of do_allocate_commons.
15325         * common.h (class Allocate_commons_task): Remove options_ field.
15326         Update constructor.
15327         * symtab.cc (Symbol_table::Symbol_table): Initialize
15328         tls_commons_.
15329         (Symbol_table::add_from_object): Put TLS common symbols on
15330         tls_commons_ list.
15331         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15332         which are IN_OUTPUT_DATA.
15333         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15334         allocate_commons and do_allocate_commons declarations.  Declare
15335         do_allocate_commons_list.
15336         * gold.cc (queue_middle_tasks): Update creation of
15337         Allocate_commons_task to not pass options.
15338         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15339         (TLS_TEST_C_FLAGS): New variable.
15340         (tls_test_c_pic.o): New target.
15341         (tls_test_shared.so): Link in tls_test_c_pic.o.
15342         (tls_test_c_pic_ie.o): New target.
15343         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15344         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15345         (tls_test_c.o): New target.
15346         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15347         (tls_pic_test_LDADD): Likewise.
15348         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15349         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15350         (tls_test_c_gnu2.o): New target.
15351         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15352         tls_test_c_gnu2.o.
15353         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15354         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15355         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15356         * testsuite/tls_test.cc: Include "config.h".
15357         (t_last): Call t11_last.
15358         * testsuite/tls_test.h (t11, t11_last): Declare.
15359         * testsuite/tls_test_c.c: New file.
15360         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15361         * configure.ac: Check for OpenMP support.
15362         * configure, config.in, Makefile.in: Rebuild.
15363         * testsuite/Makefile.in: Rebuild.
15364
15365 2008-04-16  Cary Coutant  <ccoutant@google.com>
15366
15367         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15368         (Target_i386::tls_base_symbol_defined_): New field.
15369         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15370         (Target_i386::Scan::global): Likewise.
15371         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15372         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15373         (Target_x86_64::tls_base_symbol_defined_): New field.
15374         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15375         (Target_x86_64::Scan::global): Likewise.
15376
15377 2008-04-16  Cary Coutant  <ccoutant@google.com>
15378
15379         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15380         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15381         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15382         building shared libraries.
15383         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15384         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15385         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15386         * testsuite/Makefile.in: Rebuild.
15387         * testsuite/weak_undef.h: New file.
15388         * testsuite/weak_undef_file1.cc: Add extra test cases.
15389         * testsuite/weak_undef_file2.cc: Likewise.
15390         * testsuite/weak_undef_test.cc: Likewise.
15391
15392 2008-04-16  David S. Miller  <davem@davemloft.net>
15393
15394         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15395         Add issued_non_pic_error_ field.  Declare check_non_pic.
15396         (Target_sparc::Scan::check_non_pic): New function.
15397         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15398         (Target_sparc::Scan::global): Likewise.
15399
15400         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15401         * configure: Rebuild.
15402
15403         * options.h (DEFINE_enable): New macro.
15404         (new_dtags): New enable option.
15405         (initfirst, interpose, loadfltr, nodefaultlib,
15406         nodelete, nodlopen, nodump): New -z options.
15407         * layout.cc (Layout:finish_dynamic_section): If new
15408         dtags enabled, emit DT_RUNPATH.  Also, emit a
15409         DT_FLAGS_1 containing any specified -z flags.
15410
15411 2008-04-16  Ian Lance Taylor  <iant@google.com>
15412
15413         * copy-relocs.cc: New file.
15414         * copy-relocs.h: New file.
15415         * reloc.cc: Remove Copy_relocs code.
15416         * reloc.h: Likewise.
15417         * reloc-types.h (struct Reloc_types) [both versions]: Add
15418         get_reloc_addend_noerror.
15419         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15420         variants of add_global which take an addend which must be zero.
15421         * i386.cc: Include "copy-relocs.h".
15422         (class Target_i386): Change type of copy_relocs_ to variable,
15423         update initializer.
15424         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15425         Change all callers.
15426         (Target_i386::do_finalize_sections): Change handling of
15427         copy_relocs_.
15428         * sparc.cc: Include "copy-relocs.h".
15429         (class Target_sparc): Change type of copy_relocs_ to variable,
15430         update initializer.
15431         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15432         Change all callers.
15433         (Target_sparc::do_finalize_sections): Change handling of
15434         copy_relocs_.
15435         * x86_64.cc: Include "copy-relocs.h".
15436         (class Target_x86_64): Change type of copy_relocs_ to variable,
15437         update initializer.
15438         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15439         class.  Change all callers.
15440         (Target_x86_64::do_finalize_sections): Change handling of
15441         copy_relocs_.
15442         * Makefile.am (CCFILES): Add copy-relocs.cc.
15443         (HFILES): Add copy-relocs.h.
15444
15445         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15446
15447         * testsuite/script_test_4.sh: Permit leading zeroes.
15448
15449 2008-04-15  Ian Lance Taylor  <iant@google.com>
15450
15451         * script-sections.cc (Script_sections::create_segments): Use
15452         header_size_adjustment even when there is enough room for the
15453         headers.
15454         * testsuite/script_test_4.sh: New file.
15455         * testsuite/script_test_4.t: New file.
15456         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15457         (check_DATA): Add script_test_4.stdout.
15458         (MOSTLYCLEANFILES): Likewise.
15459         (script_test_4): New target.
15460         (script_test_4.stdout): New target.
15461         * testsuite/Makefile.in: Rebuild.
15462
15463         * sparc.cc: Add definitions for Output_data_plt_sparc class
15464         constants.
15465
15466 2008-04-14  David S. Miller  <davem@davemloft.net>
15467
15468         * sparc.cc: New file.
15469         * Makefile.am (TARGETSOURCES): Add sparc.cc
15470         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15471         * configure.tgt: Document targ_extra_size and
15472         targ_extra_big_endian.  Add entries for sparc-* and
15473         sparc64-*.
15474         * configure.ac: Handle targ_extra_size and
15475         targ_extra_big_endian.
15476         * Makefile.in: Rebuild.
15477         * configure: Likewise.
15478         * po/POTFILES.in: Likewise.
15479         * po/gold.pot: Likewise.
15480
15481 2008-04-14  Ian Lance Taylor  <iant@google.com>
15482
15483         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15484         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15485         in the name/type/flags to section mapping.  Don't call
15486         allocate_output_section.
15487         (Layout::choose_output_section): Change parameter from adjust_name
15488         to is_input_section.  Don't permit input sections after sections
15489         are attached to segments.  Don't call allocate_output_section.
15490         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15491         not write_enable_output_section.
15492         (Layout::make_output_section): Don't push to
15493         unattached_section_list_ nor call attach_to_segment.  Call
15494         attach_section_to_segment if sections are attached.
15495         (Layout::attach_sections_to_segments): New function.
15496         (Layout::attach_section_to_segment): New function.
15497         (Layout::attach_allocated_section_to_segment): Rename from
15498         attach_to_segment.  Remove flags parameter.
15499         (Layout::allocate_output_section): Remove function.
15500         (Layout::write_enable_output_section): Remove function.
15501         * layout.h (class Layout): Update for above changes.  Add new
15502         field sections_are_attached_.
15503         * output.h (Output_section::update_flags_for_input_section): New
15504         function.
15505         * output.cc (Output_section::add_input_section): Call
15506         update_flags_for_input_section.
15507         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15508
15509 2008-04-11  Cary Coutant  <ccoutant@google.com>
15510
15511         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15512         thought unnecessary.
15513         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15514
15515 2008-04-11  Ian Lance Taylor  <iant@google.com>
15516
15517         * output.h (class Output_section_data): Remove inline definition
15518         of set_addralign.
15519         * output.cc (Output_section_data::set_addralign): New function.
15520
15521 2008-04-11  Cary Coutant  <ccoutant@google.com>
15522
15523         Add support for TLS descriptors for i386 and x86_64.
15524         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15525         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15526         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15527         GOT_TYPE_TLS_DESC.
15528         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15529         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15530         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15531         relocations.
15532         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15533         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15534         Fix problem with initial-exec relocations.
15535         (Target_i386::Relocate::relocate_tls): Likewise.
15536         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15537         relaxation.
15538         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15539         support for section-plus-offset dynamic table entries.
15540         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15541         (Output_data_dynamic::Dynamic_entry): Add support for
15542         section-plus-offset dynamic table entries.
15543         (Output_data_dynamic::Classification): Likewise.
15544         (Output_data_dynamic::classification_): Renamed offset_.
15545         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15546         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15547         (Target_x86_64::make_plt_section): New function.
15548         (Target_x86_64::reserve_tlsdesc_entries): New function.
15549         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15550         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15551         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15552         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15553         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15554         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15555         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15556         add extra PLT entry for TLS descriptors.
15557         (Output_data_plt_x86_64::got_): New field.
15558         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15559         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15560         fields.
15561         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15562         descriptors.
15563         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15564         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15565         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15566         R_386_TLS_DESC_CALL relocations.
15567         (Target_x86_64::Scan::global): Likewise.
15568         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15569         for TLS descriptors.
15570         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15571         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15572         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15573         GD-to-IE relaxation.
15574         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15575         and TLS_DESCRIPTORS.
15576         * Makefile.in: Rebuild.
15577         * configure: Rebuild.
15578         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15579         (tls_test_shared2.so): New target.
15580         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15581         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15582         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15583         (tls_shared_gd_to_ie_test_LDADD): New variable.
15584         (tls_shared_gnu2_gd_to_ie_test): New target.
15585         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15586         New targets.
15587         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15588         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15589         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15590         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15591         (tls_shared_gnu2_test): New target.
15592         (tls_test_gnu2_shared.so): New target.
15593         (tls_shared_gnu2_test_SOURCES): New variable.
15594         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15595         (tls_shared_gnu2_test_LDFLAGS): New variable.
15596         (tls_shared_gnu2_test_LDADD): New variable.
15597         * testsuite/Makefile.in: Rebuild.
15598         * testsuite/Makefile.
15599
15600 2008-04-11  Ian Lance Taylor  <iant@google.com>
15601
15602         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15603         justsyms.t.
15604         * testsuite/Makefile.in: Rebuild.
15605
15606         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15607         long.
15608         * testsuite/script_test_2.cc (main): Adjust test.
15609
15610 2008-04-11  David S. Miller  <davem@davemloft.net>
15611             Ian Lance Taylor  <iant@google.com>
15612
15613         * options.h (General_options): Add entries for '-Y' and
15614         '-relax'.
15615         * options.cc (General_options:finalize): If -Y was used, add those
15616         entries to the library path instead of the default "/lib" and
15617         "/usr/lib".
15618
15619 2008-04-11  David S. Miller  <davem@davemloft.net>
15620
15621         * testsuite/justsyms.t: Start at 0x100.
15622         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15623         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15624         long.
15625         * testsuite/script_test_2.cc: Adjust string and section length
15626         checks.
15627
15628 2008-04-09  Ian Lance Taylor  <iant@google.com>
15629
15630         PR gold/5996
15631         * script-sections.cc (Sections_element::allocate_to_segment): Add
15632         orphan parameter.
15633         (Output_section_definition::allocate_to_segment): Likewise.
15634         (Orphan_output_section::allocate_to_segment): Likewise.
15635         (Script_sections::attach_sections_using_phdrs_clause): Don't
15636         propagate non-PT_LOAD segments to orphan sections.
15637         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15638         readelf rather than objdump.
15639         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15640         .interp section and PT_INTERP segment are the same size.
15641         * testsuite/Makefile.in: Rebuild.
15642
15643         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15644         aliases for symbols defined in the same object.
15645         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15646         (weak_alias_test_SOURCES): New variable.
15647         (weak_alias_test_DEPENDENCIES): New variable.
15648         (weak_alias_test_LDFLAGS): New variable.
15649         (weak_alias_test_LDADD): New variable.
15650         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15651         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15652         (weak_alias_test_3.o): New target.
15653         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15654         * testsuite/weak_alias_test_main.cc: New file.
15655         * testsuite/weak_alias_test_1.cc: New file.
15656         * testsuite/weak_alias_test_2.cc: New file.
15657         * testsuite/weak_alias_test_3.cc: New file.
15658
15659 2008-04-08  Ian Lance Taylor  <iant@google.com>
15660
15661         * options.h (class General_options): Add --noinhibit-exec option.
15662         * main.cc (main): Check --noinhibit-exec.
15663
15664         * options.h (class General_options): Define --wrap as a special
15665         option.  Add wrap_symbols_ field.
15666         (General_options::any_wrap_symbols): New function.
15667         (General_options::is_wrap_symbol): New function.
15668         * options.cc (General_options::parse_wrap): New function.
15669         (General_options::General_options): Initialize wrap_symbols_.
15670         * symtab.cc (Symbol_table::wrap_symbol): New function.
15671         (Symbol_table::add_from_object): Handle --wrap.
15672         * symtab.h (class Symbol_table): Declare wrap_symbol.
15673         * target.h (Target::wrap_char): New function.
15674         (Target::Target_info): Add wrap_char field.
15675         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15676         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15677         * testsuite/testfile.cc (Target_test::test_target_info):
15678         Likewise.
15679
15680         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15681         there is one.
15682
15683         * layout.h (class Layout): Add added_eh_frame_data_ field.
15684         * layout.cc (Layout::Layout): Initialize new field.
15685         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15686         output section until we find a section we merged successfully.
15687         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15688         that the size be non-zero.
15689
15690         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15691         qualifier.
15692
15693 2008-04-08  Craig Silverstein  <csilvers@google.com>
15694
15695         * configure.ac: Export new conditional variable HAVE_ZLIB.
15696         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15697         on HAVE_ZLIB.
15698         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15699         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15700
15701 2008-04-07  Ian Lance Taylor  <iant@google.com>
15702
15703         * version.cc (version_string): Set to "1.5".
15704
15705         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15706         Add issued_non_pic_error_ field.  Declare check_non_pic.
15707         (Target_x86_64::Scan::check_non_pic): New function.
15708         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15709         (Target_x86_64::Scan::global): Likewise.
15710
15711         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15712         addend parameter.  Change caller.  Handle merge sections.
15713         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15714         Address to Addend.  Don't add in the result of
15715         local_section_offset, pass down the addend and use the returned
15716         value.
15717         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15718         Update declarations of local_section_offset and symbol_value.
15719         * testsuite/two_file_test_1.cc (t18): New function.
15720         * testsuite/two_file_test_2.cc (f18): New function.
15721         * testsuite/two_file_test_main.cc (main): Call t18.
15722         * testsuite/two_file_test.h (t18, f18): Declare.
15723
15724         * configure.ac: Don't test for objdump, c++filt, or readelf.
15725         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15726         conditionals.
15727         (TEST_READELF): New variable.
15728         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15729         (check_PROGRAMS): Add two_file_strip_test.
15730         (two_file_strip_test): New target.
15731         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15732         (two_file_same_shared_strip_test_SOURCES): New variable.
15733         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15734         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15735         (two_file_same_shared_strip_test_LDADD): New variable.
15736         (two_file_shared_strip.so): New target.
15737         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15738         (ver_test_5.syms, ver_test_7.syms): Likewise.
15739         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15740         (strip_test_3.stdout): Use TEST_OBJDUMP.
15741         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15742
15743 2008-04-04  Cary Coutant  <ccoutant@google.com>
15744
15745         * symtab.h (Symbol::is_weak_undefined): New function.
15746         (Symbol::is_strong_undefined): New function.
15747         (Symbol::is_absolute): New function.
15748         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15749         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15750         absolute symbols.
15751         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15752         (weak_undef_test): New target.
15753         * testsuite/Makefile.in: Rebuild.
15754         * testsuite/weak_undef_file1.cc: New file.
15755         * testsuite/weak_undef_file2.cc: New file.
15756         * testsuite/weak_undef_test.cc: New file.
15757
15758 2008-04-03  Craig Silverstein  <csilvers@google.com>
15759
15760         * compressed_output.h (class Output_compressed_section): Use
15761         unsigned buffer.
15762         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15763         add zlib header.
15764         (zlib_compressed_suffix): Removed.
15765         (Output_compressed_section::set_final_data_size): Use unsigned
15766         buffers.
15767         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15768         Fix linker invocation.
15769         (flagstest_o_specialfile_and_compress_debug_sections):
15770         Likewise.
15771         * testsuite/Makefile.in: Regenerated.
15772
15773 2008-04-02  David S. Miller  <davem@davemloft.net>
15774
15775         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15776         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15777
15778 2008-04-02  Craig Silverstein  <csilvers@google.com>
15779
15780         * TODO: New file.
15781
15782 2008-04-02  Ian Lance Taylor  <iant@google.com>
15783
15784         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15785         parameters.  Update for new key type to views_.  Change all
15786         callers.
15787         (File_read::read): Adjust for byteshift in returned view.
15788         (File_read::add_view): New function, broken out of
15789         find_and_make_view.
15790         (File_read::make_view): New function, broken out of
15791         find_and_make_view.
15792         (File_read::find_or_make_view): Add offset and aligned
15793         parameters.  Rewrite accordingly.  Change all callers.
15794         (File_read::get_view): Add offset and aligned parameters.  Adjust
15795         for byteshift in return value.
15796         (File_read::get_lasting_view): Likewise.
15797         * fileread.h (class File_read): Update declarations.
15798         (class File_read::View): Add byteshift_ field.  Add byteshift to
15799         constructor.  Add byteshift method.
15800         * archive.h (Archive::clear_uncached_views): New function.
15801         (Archive::get_view): Add aligned parameter.  Change all callers.
15802         * object.h (Object::get_view): Add aligned parameter.  Change all
15803         callers.
15804         (Object::get_lasting_view): Likewise.
15805
15806         * fileread.cc (File_read::release): Don't call clear_views if
15807         there are multiple objects.
15808         * fileread.h (File_read::clear_uncached_views): New function.
15809         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15810         on the archive.
15811
15812 2008-03-31  Cary Coutant  <ccoutant@google.com>
15813
15814         Add thin archive support.
15815         * archive.cc (Archive::armagt): New const.
15816         (Archive::setup): Remove task parameter and calls to unlock.
15817         (Archive::unlock_nested_archives): New function.
15818         (Archive::read_header): Add nested_off parameter. Change
15819         all callers.
15820         (Archive::interpret_header): Likewise.
15821         (Archive::include_all_members): Change to handle thin
15822         archives.
15823         (Archive::include_member): Likewise.
15824         * archive.h (Archive::Archive): Add new parameters and
15825         initializers.
15826         (Archive::armagt): New const.
15827         (Archive::setup): Remove task parameter.
15828         (Archive::unlock_nested_archives): New function.
15829         (Archive::read_header): Add nested_off parameter.
15830         (Archive::interpret_header): Likewise.
15831         (Archive::Nested_archive_table): New typedef.
15832         (Archive::is_thin_archive_): New field.
15833         (Archive::nested_archives_): New field.
15834         (Archive::options_): New field.
15835         (Archive::dirpath_): New field.
15836         (Archive::task_): New field.
15837         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15838         for thin archives.  Pass additional parameters to
15839         Archive::Archive.  Unlock the archive file after calling
15840         Archive::setup.
15841
15842 2008-03-29  Ian Lance Taylor  <iant@google.com>
15843
15844         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15845         version symbol to be local.
15846         * testsuite/ver_test_4.sh: New file.
15847         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15848         (check_DATA): Add ver_test_4.syms.
15849         (ver_test_4.syms): New target.
15850         * testsuite/Makefile.in: Rebuild.
15851
15852         * output.cc
15853         (Output_section::Input_section_sort_entry::has_priority): New
15854         function.
15855         (Output_section::Input_section_sort_entry::match_file_name): New
15856         function.
15857         (Output_section::Input_section_sort_entry::match_section_name):
15858         Remove.
15859         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15860         Remove.
15861         (Output_section::Input_section_sort_entry::match_section_file):
15862         Remove.
15863         (Output_section::Input_section_sort_compare::operator()): Rewrite
15864         using new Input_section_sort_entry functions.  Sort crtbegin and
15865         crtend first.  Sort sections with no priority before sections with
15866         a priority.
15867         * testsuite/initpri1.c (d3): Check j != 4.
15868         (cd5): New constructor/destructor function.
15869         (main): Check j != 2.
15870
15871         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15872         new symbol when resolving, don't call set_is_default.
15873         * testsuite/ver_test_7.cc: New file.
15874         * testsuite/ver_test_7.sh: New file.
15875         * testsuite/Makefile.am (ver_test_7.so): New target.
15876         (ver_test_7.o): New target.
15877         (check_SCRIPTS): Add ver_test_7.sh.
15878         (check_DATA): Add ver_test_7.syms.
15879         (ver_test_7.syms): New target.
15880
15881 2008-03-28  Ian Lance Taylor  <iant@google.com>
15882
15883         * layout.cc (Layout::layout): If we see an input section with a
15884         name that needs sorting, set the must_sort flag for the output
15885         section.
15886         (Layout::make_output_section): If the name of the output section
15887         indicates that it might require sorting, set the may_sort flag.
15888         * output.h (Output_section::may_sort_attached_input_sections): New
15889         function.
15890         (Output_section::set_may_sort_attached_input_sections): New
15891         function.
15892         (Output_section::must_sort_attached_input_sections): New
15893         function.
15894         (Output_section::set_must_sort_attached_input_sections): New
15895         function.
15896         (class Output_section): Declare Input_section_sort_entry.  Define
15897         Input_section_sort_compare.  Declare
15898         sort_attached_input_sections.  Add new fields:
15899         may_sort_attached_input_sections_,
15900         must_sort_attached_input_sections_,
15901         attached_input_sections_are_sorted_.
15902         * output.cc (Output_section::Output_section): Initialize new
15903         fields.
15904         (Output_section::add_input_section): Add an entry to
15905         input_sections_ if may_sort or must_sort are true.
15906         (Output_section::set_final_data_size): Call
15907         sort_attached_input_sections if necessary.
15908         (Output_section::Input_section_sort_entry): Define new class.
15909         (Output_section::Input_section_sort_compare::operator()): New
15910         function.
15911         (Output_section::sort_attached_input_sections): New function.
15912         * configure.ac: Check whether the compiler supports constructor
15913         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15914         * testsuite/initpri1.c: New file.
15915         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15916         CONSTRUCTOR_PRIORITY.
15917         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15918         (initpri1_LDFLAGS): New variable.
15919         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15920
15921 2008-03-27  Ian Lance Taylor  <iant@google.com>
15922
15923         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15924         * testsuite/common_test_1.c: New file.
15925         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15926         (common_test_1_SOURCES): New variable.
15927         (common_test_1_DEPENDENCIES): New variable.
15928         (common_test_1_LDFLAGS): New variable.
15929
15930         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15931         and commons_ correctly when NAME/VERSION does not override
15932         NAME/NULL.
15933         * testsuite/ver_test_6.c: New file.
15934         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15935         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15936         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15937
15938 2008-03-26  Ian Lance Taylor  <iant@google.com>
15939
15940         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15941         of an undefined symbol from a version script.
15942         * testsuite/Makefile.am (ver_test_5.so): New target.
15943         (ver_test_5.o): New target.
15944         (check_SCRIPTS): Add ver_test_5.sh.
15945         (check_DATA): Add ver_test_5.syms.
15946         (ver_test_5.syms): New target.
15947         * testsuite/ver_test_5.cc: New file.
15948         * testsuite/ver_test_5.script: New file.
15949         * testsuite/ver_test_5.sh: New file.
15950         * Makefile.in, testsuite/Makefile.in: Rebuild.
15951
15952         PR gold/5986
15953         Fix problems building gold with gcc 4.3.0.
15954         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15955         (gold_error_at_location, gold_warning_at_location): Use it.
15956         * configure.ac: Check whether we can compile and use a template
15957         function with a printf attribute.
15958         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15959         when jumping over bytes.
15960         * object.cc: Instantiate Object::read_section_data.
15961         * debug.h: Include <cstring>
15962         * dwarf_reader.cc: Include <algorithm>
15963         * main.cc: Include <cstring>.
15964         * options.cc: Include <cstring>.
15965         * output.cc: Include <cstring>.
15966         * script.cc: Include <cstring>.
15967         * script.h: Include <string>.
15968         * symtab.cc: Include <cstring> and <algorithm>.
15969         * target-select.cc: Include <cstring>.
15970         * version.cc: Include <string>.
15971         * testsuite/testmain.cc: Include <cstdlib>.
15972         * configure, config.in: Rebuild.
15973
15974 2008-03-25  Ian Lance Taylor  <iant@google.com>
15975
15976         * options.cc: Include "../bfd/bfdver.h".
15977         (options::help): Print bug reporting address.
15978
15979         * version.cc (print_version): Adjust output for current value of
15980         BFD_VERSION_STRING.
15981
15982         * NEWS: New file.
15983
15984         * options.cc (options::help): Print list of supported targets.
15985         * target-select.h: Include <vector>.
15986         (class Target_selector): Make machine_, size_, and is_big_endian_
15987         fields const.  Add bfd_name_ and instantiated_target_ fields.
15988         (Target_selector::Target_selector): Add bfd_name parameter.
15989         (Target_selector::recognize): Make non-virtual, call
15990         do_recognize.
15991         (Target_selector::recognize_by_name): Make non-virtual, call
15992         do_recognize_by_name.
15993         (Target_selector::supported_names): New function.
15994         (Target_selector::bfd_name): New function.
15995         (Target_selector::do_instantiate_target): New pure virtual
15996         function.
15997         (Target_selector::do_recognize): New virtual function.
15998         (Target_selector::do_recognize_by_name): New virtual function.
15999         (Target_selector::instantiate_target): New private function.
16000         (supported_target_names): Declare.
16001         * target-select.cc (Target_selector::Target_selector): Update for
16002         new parameter and fields.
16003         (select_target_by_name): Check that the name matches before
16004         calling recognize_by_name.
16005         (supported_target_names): New function.
16006         * i386.cc (class Target_selector_i386): Update Target_selector
16007         constructor call.  Remove recognize and recognize_by_name.  Add
16008         do_instantiate_target.
16009         * x86_64.cc (class Target_selector_x86_64): Likewise.
16010         * testsuite/testfile.cc (class Target_selector_test): Update for
16011         changes to Target_selector.
16012
16013         * README: Rewrite, with some notes on unsupported features.
16014
16015 2008-03-24  Cary Coutant  <ccoutant@google.com>
16016
16017         * i386.cc (Target_i386::Got_type): New enum declaration.
16018         (Target_i386::Scan::local): Updated callers of Output_data_got
16019         member functions.
16020         (Target_i386::Scan::global): Likewise.
16021         (Target_i386::Relocate::relocate): Likewise.
16022         (Target_i386::Relocate::relocate_tls): Likewise.
16023         * object.h (Got_offset_list): New class.
16024         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16025         (Sized_relobj::local_got_offset): Likewise.
16026         (Sized_relobj::set_local_got_offset): Likewise.
16027         (Sized_relobj::local_has_tls_got_offset): Removed.
16028         (Sized_relobj::local_tls_got_offset): Removed.
16029         (Sized_relobj::set_local_tls_got_offset): Removed.
16030         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16031         * output.cc (Output_data_got::add_global): Added got_type parameter.
16032         (Output_data_got::add_global_with_rel): Likewise.
16033         (Output_data_got::add_global_with_rela): Likewise.
16034         (Output_data_got::add_global_pair_with_rel): New function.
16035         (Output_data_got::add_global_pair_with_rela): New function.
16036         (Output_data_got::add_local): Added got_type parameter.
16037         (Output_data_got::add_local_with_rel): Likewise.
16038         (Output_data_got::add_local_with_rela): Likewise.
16039         (Output_data_got::add_local_pair_with_rel): New function.
16040         (Output_data_got::add_local_pair_with_rela): New function.
16041         (Output_data_got::add_global_tls): Removed.
16042         (Output_data_got::add_global_tls_with_rel): Removed.
16043         (Output_data_got::add_global_tls_with_rela): Removed.
16044         (Output_data_got::add_local_tls): Removed.
16045         (Output_data_got::add_local_tls_with_rel): Removed.
16046         (Output_data_got::add_local_tls_with_rela): Removed.
16047         * output.h (Output_data_got::add_global): Added got_type parameter.
16048         (Output_data_got::add_global_with_rel): Likewise.
16049         (Output_data_got::add_global_with_rela): Likewise.
16050         (Output_data_got::add_global_pair_with_rel): New function.
16051         (Output_data_got::add_global_pair_with_rela): New function.
16052         (Output_data_got::add_local): Added got_type parameter.
16053         (Output_data_got::add_local_with_rel): Likewise.
16054         (Output_data_got::add_local_with_rela): Likewise.
16055         (Output_data_got::add_local_pair_with_rel): New function.
16056         (Output_data_got::add_local_pair_with_rela): New function.
16057         (Output_data_got::add_global_tls): Removed.
16058         (Output_data_got::add_global_tls_with_rel): Removed.
16059         (Output_data_got::add_global_tls_with_rela): Removed.
16060         (Output_data_got::add_local_tls): Removed.
16061         (Output_data_got::add_local_tls_with_rel): Removed.
16062         (Output_data_got::add_local_tls_with_rela): Removed.
16063         * resolve.cc (Symbol::override_base_with_special): Removed
16064         reference to has_got_offset_ field.
16065         * symtab.cc (Symbol::init_fields): Replaced initialization
16066         of got_offset_ with got_offsets_.  Removed initialization
16067         of has_got_offset_
16068         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16069         (Symbol::got_offset): Likewise.
16070         (Symbol::set_got_offset): Likewise.
16071         (Symbol::has_tls_got_offset): Removed.
16072         (Symbol::tls_got_offset): Removed.
16073         (Symbol::set_tls_got_offset): Removed.
16074         (Symbol::got_offset_): Removed.
16075         (Symbol::tls_mod_got_offset_): Removed.
16076         (Symbol::tls_pair_got_offset_): Removed.
16077         (Symbol::got_offsets_): New field.
16078         (Symbol::has_got_offset): Removed.
16079         (Symbol::has_tls_mod_got_offset): Removed.
16080         (Symbol::has_tls_pair_got_offset): Removed.
16081         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16082         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16083         member functions.
16084         (Target_x86_64::Scan::global): Likewise.
16085         (Target_x86_64::Relocate::relocate): Likewise.
16086         (Target_x86_64::Relocate::relocate_tls): Likewise.
16087
16088 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16089
16090         * yyscript.y: Fix spelling error in comment.
16091
16092 2008-03-24  Ian Lance Taylor  <iant@google.com>
16093
16094         * options.h (class General_options): Define build_id option.
16095         * layout.h (class Layout): Declare write_build_id, create_note,
16096         create_build_id.  Add build_id_note_ member.
16097         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16098         "libiberty.h", "md5.h", "sha1.h".
16099         (Layout::Layout): Initialize eh_frame_data_,
16100         eh_frame_hdr_section_, and build_id_note_.
16101         (Layout::finalize): Call create_build_id.
16102         (Layout::create_note): New function, broken out of
16103         Layout::create_gold_note.
16104         (Layout::create_gold_note): Call create_note.
16105         (Layout::create_build_id): New function.
16106         (Layout::write_build_id): New function.
16107         (Close_task_runner::run): Call write_build_id.
16108
16109         * x86_64.cc: Correct license to GPLv3.
16110
16111 2008-03-23  Ian Lance Taylor  <iant@google.com>
16112
16113         * options.cc: Include "demangle.h".
16114         (parse_optional_string): New function.
16115         (parse_long_option): Handle takes_optional_argument.
16116         (parse_short_option): Update dash_z initializer.  Handle
16117         takes_optional_argument.
16118         (General_options::General_options): Initialize do_demangle_.
16119         (General_options::finalize): Set do_demangle_.  Handle demangling
16120         style.
16121         * options.h (parse_optional_string): Declare.
16122         (struct One_option): Add optional_arg field.  Update constructor.
16123         Update call constructor calls.  Add takes_optional_argument
16124         function.
16125         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16126         (DEFINE_optional_string): Define.
16127         (General_options::demangle): Change from DEFINE_bool to
16128         DEFINE_optional_string.
16129         (General_options::no_demangle): New function.
16130         (General_options::do_demangle): New function.
16131         (General_options::set_do_demangle): New function.
16132         (General_options::execstack_status_): Move definition to end of
16133         class definition.
16134         (General_options::static_): Likewise.
16135         (General_options::do_demangle_): New field.
16136         * object.cc (big_endian>::get_symbol_location_info): Call
16137         Options::do_demangle, not Options::demangle.
16138         * symtab.cc (demangle): Likewise.
16139
16140 2008-03-22  Ian Lance Taylor  <iant@google.com>
16141
16142         * gold.h: Include <cstddef> and <sys/types.h>
16143         * options.h: Include <cstring>.
16144
16145 2008-03-21  Ian Lance Taylor  <iant@google.com>
16146
16147         * Added source code to GNU binutils.
16148 \f
16149 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16150
16151 Copying and distribution of this file, with or without modification,
16152 are permitted in any medium without royalty provided the copyright
16153 notice and this notice are preserved.
16154
16155 Local Variables:
16156 mode: change-log
16157 left-margin: 8
16158 fill-column: 74
16159 version-control: never
16160 End: