Fix SysV-style hash table when --hash-style=both.
[external/binutils.git] / gold / ChangeLog
1 2014-09-30  Kito Cheng  <kito@0xlab.org>
2
3         PR gold/13597
4         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
5         hash table before sysv-style hash table.
6
7 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
8
9         * options.h (--pic-executable): Add negative to alias to -no-pie.
10
11 2014-09-26  Cary Coutant  <ccoutant@google.com>
12
13         PR gold/16773
14         * object.cc (Sized_relobj_file): Compute value of section symbols
15         for TLS sections the same as TLS symbols.
16
17 2014-09-25  Cary Coutant  <ccoutant@google.com>
18
19         PR gold/17432
20         * resolve.cc (Symbol_table::resolve): Override common placeholder
21         symbols, but adjust sizes.
22         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
23         symbols to common lists.
24
25 2014-09-24  Alan Modra  <amodra@gmail.com>
26
27         * po/POTFILES.in: Regenerate.
28
29 2014-09-23  Taiju Tsuiki  <tzik@google.com>
30             Cary Coutant  <ccoutant@google.com>
31
32         PR gold/14860
33         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
34         on input_sections_blocker.
35         * layout.cc (Write_sections_task::locks): Unblock
36         input_sections_blocker_.
37         * layout.h (Write_sections_task::Write_sections_task): Add
38         input_sections_blocker.
39         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
40         to DEPENDENCIES.
41         * testsuite/Makefile.in: Regenerate.
42
43 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
44
45         * testsuite/Makefile.am (plugin_test_10): New test.
46         * testsuite/Makefile.in: Regenerate
47         * testsuite/plugin_common_test_2.c (c1): Align to 8.
48         * testsuite/plugin_test_10.sh: New file.
49
50 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
51
52         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
53         * resolve.cc (Symbol_table::resolve): Don't override common symbols
54         during the replacement phase.
55
56 2014-09-17  Han Shen  <shenhan@google.com>
57             Jing Yu  <jingyu@google.com>
58
59         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
60         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
61         * aarch64.cc (Target_aarch64): Add data members
62         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
63         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
64         constructor.
65         (Target_aarch64::do_reloc_symbol_index): New method.
66         (Target_aarch64::do_reloc_addend): New method.
67         (Target_aarch64::add_tlsdesc_info): New method.
68         (Target_aarch64::do_dynsym_value): New method.
69         (Target_aarch64::do_make_data_plt): Add new parameters: got,
70         got_irelative. Pass them to Output_data_plt_aarch64_standard.
71         (Target_aarch64::make_data_plt): Add new parameters: got,
72         got_irelative. Pass them to do_make_data_plt.
73         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
74         (Target_aarch64::Relocate:tls_gd_to_le): New method.
75         (Target_aarch64::Relocate:tls_ie_to_le): New method.
76         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
77         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
78         (Target_aarch64::got_tlsdesc_section): New method.
79         (Target_aarch64::make_local_ifunc_plt_entry): New method.
80         (Target_aarch64::define_tls_base_symbol): New method.
81         (Target_aarch64::reserve_tlsdesc_entries): New method.
82         (Target_aarch64::got_mod_index_entry): New method.
83         (Target_aarch64::rela_tlsdesc_section): New method.
84         (Target_aarch64::rela_irelative_section): New method.
85         (Target_aarch64::Tlsdesc_info): New struct.
86         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
87         relocations and tlsdesc relocations.
88         (Target_aarch64::optimize_tls_reloc): Implement method.
89         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
90         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
91         in constructor.
92         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
93         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
94         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
95         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
96         (Output_data_plt_aarch64::rela_tlsdesc): New method.
97         (Output_data_plt_aarch64::rela_irelative): New method.
98         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
99         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
100         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
101         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
102         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
103         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
104         (Output_data_plt_aarch64_standard): New member variables:
105         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
106         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
107         New parameter: got, got_irelative.
108         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
109         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
110         (Output_data_plt_aarch64::do_write): Replace got_address with
111         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
112         (AArch64_relocate_functions::update_movnz): New method.
113         (AArch64_relocate_functions): Correct format.
114         (AArch64_relocate_functions::movnz): New method.
115         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
116         before the switch. Add new cases to switch.
117         Check ie_to_le relaxation on tlsie relocations. Add code handling
118         tlsgd tlsdesc cases.
119         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
120         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
121         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
122         Call reloc_name_in_error_message to print unsupported reloc.
123         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
124         make_data_plt.
125         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
126         relocs. Fill in some more dynamic tags.
127         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
128         Skip call tls_get_addr when tlsgd is relaxed.
129         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
130         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
131         tlsdesc->ie relaxation.
132
133 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
134
135         * mips.cc (Target_mips_nacl): New class.
136         (Target_selector_mips_nacl): New class.
137         (target_selector_mips32): Rename from target_selector_mips32be and use
138         Target_selector_mips_nacl instead of Target_selector_mips.
139         (target_selector_mips32el): Rename from target_selector_mips32 and use
140         Target_selector_mips_nacl instead of Target_selector_mips.
141         (target_selector_mips64): Rename from target_selector_mips64be and use
142         Target_selector_mips_nacl instead of Target_selector_mips.
143         (target_selector_mips64el): Rename from target_selector_mips64 and use
144         Target_selector_mips_nacl instead of Target_selector_mips.
145         (Target_mips::mips_info): Add const attribute.
146
147 2014-09-02  Cary Coutant  <ccoutant@google.com>
148
149         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
150         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
151         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
152         (Sized_incr_dynobj::do_section_name): Likewise.
153         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
154         (Sized_incr_dynobj::do_section_name): Likewise.
155         * object.h (Object::section_name): Likewise.
156         (Object::do_section_name): Likewise.
157         (Sized_relobj_file::do_section_name): Likewise.
158         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
159         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
160
161 2014-09-02  Cary Coutant  <ccoutant@google.com>
162
163         PR gold/17005
164         * ehframe.cc (Fde::write): Add output_offset parameter.
165         (Cie::write): Likewise.
166         (Eh_frame::set_final_data_size): Account for offset within output
167         section.
168         (Eh_frame::do_sized_write): Likewise.
169         * ehframe.h (Fde::write): Add output_offset parameter.
170         (Cie::write): Likewise.
171         * output.cc (Output_section::Input_section_sort_entry): Remove
172         section_has_name_; add output_section_name parameter. Use
173         output section name for non-input sections.
174         (Output_section::Input_section_sort_entry::section_has_name): Remove.
175         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
176         (Output_section::Input_section_sort_compare): Remove logic for
177         sections without names.
178         (Output_section::Input_section_sort_init_fini_compare): Likewise.
179         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
180         Likewise.
181         (Output_section::Input_section_sort_section_name_compare): Likewise.
182
183 2014-08-29 Han Shen <shenhan@google.com>
184            Jing Yu <jingyu@google.com>
185
186         * aarch64-reloc-property.cc
187         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
188         reference reloc property in the table.
189         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
190         3 other entries.
191         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
192         2 new overloaded methods.
193         (Output_data_got_aarch64::do_write): Add code to write out
194         static relocs.
195         (class Output_data_got_aarch64::Static_reloc): New class to wrap
196         static relocs.
197         (Output_data_got_aarch64::static_relocs): New vector to
198         hold static relocs.
199         (Target_aarch64::TCB_SIZE): New const static memeber.
200         (Target_aarch64::tcb_size): New method.
201         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
202         (Target_aarch64::Relocate::relocate_tls): New method.
203         (Target_aarch64::Scan::local): Add code handling new reloc types.
204         (Target_aarch64::Scan::global): Add code handling new reloc types.
205
206 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
207
208         * options.h (-no-pie): Add option.
209
210 2014-08-08  Jing Yu  <jingyu@google.com>
211             Han Shen  <shenhan@google.com>
212
213         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
214         (DEFFILES): add aarch64-reloc.def.
215         (TARGETSOURCES): Add aarch64-reloc-property.cc.
216         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
217         * Makefile.in: Regenerate.
218         * aarch64-reloc-property.cc: New file.
219         * aarch64-reloc-property.h: New file.
220         * aarch64-reloc.def: New file.
221         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
222         with tab to make the format consistent.
223         (Output_data_got_aarch64::symbol_table_): New method.
224         (Target_aarch64::do_plt_address_for_global): New method.
225         (Target_aarch64::do_plt_address_for_local): New method.
226         (Target_aarch64::do_select_as_default_target): New method.
227         (Target_aarch64::do_make_data_plt): New method.
228         (Target_aarch64::make_data_plt): New method.
229         (Output_data_plt_aarch64::has_irelative_section): New method.
230         (Output_data_plt_aarch64::address_for_global): New method.
231         (Output_data_plt_aarch64::address_for_local): New method.
232         (Output_data_plt_aarch64::irelative_rel_): New parameter.
233         (Output_data_plt_aarch64::add_entry): Implement contents.
234         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
235         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
236         the got_pov entry to plt0.
237         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
238         Implement contents.
239         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
240         (AArch64_howto): New struct.
241         (aarch64_howto[]): New static const array.
242         (AArch64_relocate_functions): New class.
243         (Target_aarch64::Scan::get_reference_flags): Remove method.
244         (Target_aarch64::Scan::local): Implement to support a few relocations.
245         (Target_aarch64::Scan::global): Implement to support a few relocations.
246         (Target_aarch64::make_plt_section): Implement contents.
247         (Target_aarch64::make_plt_entry): Implement contents.
248         (Target_aarch64::do_finalize_sections): Implement contents.
249         (Target_aarch64::Relocate::relocate): Implement a few relocations.
250         (Target_aarch64::relocate_section): Implement contents.
251
252 2014-08-06  Alan Modra  <amodra@gmail.com>
253
254         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
255
256 2014-08-06  Alan Modra  <amodra@gmail.com>
257
258         PR 13227
259         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
260
261 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
262
263         * object.cc (Relobj::is_section_name_included): Add
264         ".rodata.nptl_version" to not garbage collect this section.
265
266 2014-07-08  Cary Coutant  <ccoutant@google.com>
267
268         * expression.cc (struct Expression::Expression_eval_info): Add
269         new fields type_pointer, vis_pointer, and nonvis_pointer.
270         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
271         nonvis_pointer parameters. Adjust all calls.
272         (Symbol_expression::value): Update type, visibility, and nonvis bits
273         in caller.
274         * script.cc (Symbol_assignment::sized_finalize): Update type,
275         visibility, and remaining st_other bits for new symbol.
276         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
277         vis_pointer, and nonvis_pointer parameters.
278         * symtab.h (Symbol::set_type): New method.
279
280         * testsuite/Makefile.am (defsym_test): New test.
281         * testsuite/Makefile.in: Regenerate.
282         * testsuite/defsym_test.c: New file.
283         * testsuite/defsym_test.sh: New file.
284
285 2014-07-08  Cary Coutant  <ccoutant@google.com>
286
287         PR gold/15639
288         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
289         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
290         (Sized_dynobj::base_read_symbols): ...new method.
291         * object.h (Sized_relobj_file::base_read_symbols): New method.
292         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
293         (Sized_relobj_file::base_read_symbols): ...new method.
294         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
295         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
296         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
297
298 2014-07-04  Alan Modra  <amodra@gmail.com>
299
300         * po/POTFILES.in: Regenerate.
301
302 2014-07-02  Jing Yu  <jingyu@google.com>
303
304         * aarch64.cc: New file
305         * Makefile.am (TARGETSOURCES): Add aarch64.cc
306         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
307         * Makefile.in: Regenerate.
308         * configure.tgt: Add entries for aarch64*.
309         * configure.ac:  Likewise.
310         * configure: Likewise.
311
312 2014-06-27  Alan Modra  <amodra@gmail.com>
313
314         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
315
316 2014-06-24  Cary Coutant  <ccoutant@google.com>
317
318         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
319         sections.
320         (Dwo_file::sized_read_unit_index): Likewise.
321
322 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
323
324         * mips.cc: New file.
325         * Makefile.am (TARGETSOURCES): Add mips.cc
326         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
327         * configure.tgt: Add entries for mips*.
328         * configure.ac: Likewise.
329         * Makefile.in: Regenerate.
330         * configure: Likewise.
331
332 2014-06-09  Cary Coutant  <ccoutant@google.com>
333
334         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
335         unit_length is within section bounds.
336
337 2014-06-09  Cary Coutant  <ccoutant@google.com>
338
339         PR gold/16980
340         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
341         map.
342
343 2014-06-07  Alan Modra  <amodra@gmail.com>
344
345         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
346
347 2014-06-06  Cary Coutant  <ccoutant@google.com>
348
349         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
350         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
351         (Dwarf_pubnames_table::read_header): Likewise.
352         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
353         .debug_gnu_pubtypes.
354
355 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
356
357         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
358         * Makefile.in, configure: Regenerate.
359
360 2014-06-03  Alan Modra  <amodra@gmail.com>
361
362         * powerpc.cc (addis_12_2): Define.
363         (Stub_table::do_write): Support fusion on ELFv2 stubs.
364
365 2014-06-03  Alan Modra  <amodra@gmail.com>
366
367         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
368         st_other output.
369
370 2014-06-02  Alan Modra  <amodra@gmail.com>
371
372         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
373         Only ignore relocs on ELFv1.
374         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
375
376 2014-05-30  Cary Coutant  <ccoutant@google.com>
377
378         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
379         * testsuite/Makefile.in: Regenerate.
380         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
381
382 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
383
384         PR gold/16945
385         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
386         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
387
388 2014-05-15  Alan Modra  <amodra@gmail.com>
389
390         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
391         Compare FDE contents with DW_CFA_nop rather than 0.
392
393 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
394
395         * symtab.h (may_need_copy_reloc): Remove check for position independent
396         code.
397         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
398         position independence before pc absolute may_need_copy_reloc call.
399         Add check for executable output befor pc relative may_need_copy_reloc
400         call.
401         * i386.cc: Ditto.
402         * arm.cc: Ditto.
403         * sparc.cc: Ditto.
404         * tilegx.cc: Ditto.
405         * powerpc.cc: Add check for no position independence before
406         may_need_copy_reloc calls.
407         * testsuite/pie_copyrelocs_test.cc: New file.
408         * testsuite/pie_copyrelocs_shared_test.cc: New file.
409         * Makefile.am (pie_copyrelocs_test): New test.
410         * Makefile.in: Regenerate.
411
412 2014-05-08  Martin Liška  <mliska@suse.cz>
413
414         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
415
416 2014-05-06  Cary Coutant  <ccoutant@google.com>
417
418         PR gold/16900
419         * i386.cc (Output_data_got_plt_i386): New class.
420         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
421         parameter. Change all callers.
422         (Output_data_plt_i386::layout_): Remove.
423         (Output_data_plt_i386::got_plt_): Change type.
424         (Target_i386::got_plt_): Change type. Change all references.
425         (Target_i386::got_section): Create instance of new class.
426         (Output_data_got_plt_i386::do_write): New function.
427         * x86_64.cc (Output_data_got_plt_x86_64): New class.
428         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
429         parameter. Change all callers.
430         (Output_data_plt_x86_64::layout_): Remove.
431         (Output_data_plt_x86_64::got_plt_): Change type.
432         (Target_x86_64::got_plt_): Change type. Change all references.
433         (Target_x86_64::got_section): Create instance of new class.
434         (Output_data_got_plt_x86_64::do_write): New function.
435         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
436         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
437         class.
438
439 2014-05-05  Cary Coutant  <ccoutant@google.com>
440
441         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
442         if we have pubnames/pubtypes.
443
444 2014-05-02  Cary Coutant  <ccoutant@google.com>
445
446         * defstd.cc (in_segment): Define __ehdr_start here...
447         * layout.cc (Layout::finalize): ...Instead of here.  Set the
448         output segment when known.
449         * resolve.cc (Symbol::override_base_with_special): Remember
450         the original binding.
451         * symtab.cc (Symbol::set_output_segment): New function.
452         (Symbol::set_undefined): New function.
453         * symtab.h (Symbol::is_weak_undefined): Check original undef
454         binding.
455         (Symbol::is_strong_undefined): New function.
456         (Symbol::set_output_segment): New function.
457         (Symbol::set_undefined): New function.
458         * target-reloc.h (is_strong_undefined): Remove.
459         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
460         Check for hidden undefs.
461         (relocate_section): Call Symbol::is_strong_undefined.
462
463         * testsuite/Makefile.am (ehdr_start_test_1)
464         (ehdr_start_test_2, ehdr_start_test_3)
465         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
466         * testsuite/Makefile.in: Regenerate.
467         * testsuite/ehdr_start_def.cc: New source file.
468         * testsuite/ehdr_start_test.cc: New source file.
469         * testsuite/ehdr_start_test.t: New linker script.
470         * testsuite/ehdr_start_test_4.sh: New shell script.
471
472 2014-04-23  Cary Coutant  <ccoutant@google.com>
473
474         PR gold/16870
475         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
476
477 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
478
479         * layout.cc (Layout::include_section): Allow a target to decide
480         whether to include a section.
481         * target.h (Target::should_include_section): New function.
482         (Target::do_should_include_section): New function.
483
484 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
485
486         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
487         inline into ...
488         (Copy_relocs::emit): ... here.
489         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
490         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
491         (Copy_reloc_entry::entries_): Change from private to protected.
492
493 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
494
495         * icf.cc (get_section_contents): Replace copies of reloc
496         vectors with const references.
497
498 2014-04-02  Cary Coutant  <ccoutant@google.com>
499
500         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
501         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
502         * configure: Regenerate.
503         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
504         -fno-use-linker-plugin.
505         (LINK1, CXXLINK1): Add it to the link command.
506         * testsuite/Makefile.in: Regenerate.
507
508 2014-03-12  Alan Modra  <amodra@gmail.com>
509
510         * Makefile.in: Regenerate.
511
512 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
513
514         * symtab.h (Symbol::set_nonvis): New function.
515
516 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
517
518         * symtab.cc (Sized_symbol<32>::init_output_data):
519         Instantiate the template.
520         (Sized_symbol<64>::init_output_data): Likewise.
521
522 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
523
524         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
525         adjust dynamic symbol value.
526         * target.h (Target::adjust_dyn_symbol): New function.
527         (Target::do_adjust_dyn_symbol): New function.
528
529 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
530
531         * output.cc (Output_data_dynamic::Dynamic_entry::write):
532         Get the value of DYNAMIC_CUSTOM dynamic entry.
533         * output.h (Output_data_dynamic::add_custom): New function.
534         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
535         dynamic entry.
536         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
537         * target.h (Target::dynamic_tag_custom_value): New function.
538         (Target::do_dynamic_tag_custom_value): New function.
539
540 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
541
542         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
543         dynsym indexes.
544         * target.h (Target::has_custom_set_dynsym_indexes): New function.
545         (Target::do_has_custom_set_dynsym_indexes): New function.
546         (Target::set_dynsym_indexes): New function.
547         (Target::do_set_dynsym_indexes): New function.
548
549 2014-03-07  Alan Modra  <amodra@gmail.com>
550
551         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
552         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
553         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
554         (Powerpc_relocate_functions::has_overflow_bitfield,
555         overflowed): Use the above.
556         (Target_powerpc::Relocate::relocate): Correct overflow checking
557         for a number of relocations.  Modify overflow test for 16-bit
558         fields in instructions to signed/unsigned according to whether
559         the field takes a signed or unsigned value.
560
561 2014-03-05  Alan Modra  <amodra@gmail.com>
562
563         Update copyright years.
564
565 2014-03-05  Alan Modra  <amodra@gmail.com>
566
567         * powerpc.cc (Target_powerpc::Scan::local, global): Support
568         R_PPC64_ADDR64_LOCAL.
569         (Target_powerpc::Relocate::relocate): Likewise.
570
571 2014-03-03  Alan Modra  <amodra@gmail.com>
572
573         * dwp.cc (print_version): Update copyright year to current.
574
575 2014-02-10  Alan Modra  <amodra@gmail.com>
576
577         * po/gold.pot: Regenerate.
578
579 2014-02-06  Cary Coutant  <ccoutant@google.com>
580
581         Fix problem where -u is ignored when a weak undef is seen.
582
583         * archive.cc (Library_base::should_include_member): Reorder
584         code to check for -u option if a weak undef has already been seen.
585         * testsuite/Makefile.am (weak_undef_test_2): New test case.
586         * testsuite/Makefile.in: Regenerate.
587         * testsuite/weak_undef_file3.cc: New file.
588         * testsuite/weak_undef_file4.cc: New file.
589         * testsuite/weak_undef_test_2.cc: New file.
590
591 2014-02-05  Cary Coutant  <ccoutant@google.com>
592
593         Fix issues with gold undefined symbol diagnostics.
594
595         PR binutils/15435
596         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
597         check to here.
598         * target-reloc.h (is_strong_undefined): New function.
599         (relocate_section): Move undef vtable symbol check from here.
600         Check for is_strong_undefined.
601
602 2014-02-05  Cary Coutant  <ccoutant@google.com>
603
604         Fix problems with the --dynamic-list option.
605
606         PR gold/13577
607         * options.cc (General_options::parse_dynamic_list):
608         Set have_dynamic_list_.
609         (General_options::General_options): Initialize have_dynamic_list_.
610         (General_options::finalize): Turn off -Bsymbolic and
611         -Bsymbolic-functions if --dynamic-list provided.
612         * options.h (General_options::have_dynamic_list): New function.
613         (General_options::have_dynamic_list_): New data member.
614         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
615         correctly.
616
617         PR gold/16530
618         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
619         in --dynamic-list, mark it.
620
621         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
622         (dynamic_list_2): New test case.
623         * testsuite/Makefile.in: Regenerate.
624         * testsuite/dynamic_list_2.cc: New file.
625         * testsuite/dynamic_list_2.t: New file.
626         * testsuite/dynamic_list_lib1.cc: New file.
627         * testsuite/dynamic_list_lib2.cc: New file.
628         * testsuite/gc_dynamic_list_test.c: New file.
629         * testsuite/gc_dynamic_list_test.sh: New file.
630         * testsuite/gc_dynamic_list_test.t: New file.
631
632 2014-01-28  Cary Coutant  <ccoutant@google.com>
633
634         Add .gdb_index version 7 support.
635
636         * gold/dwarf_reader.cc: include <utility> (for make_pair).
637         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
638         debug sections.
639         (Dwarf_ranges_table::read_ranges_table): Likewise.
640         (Dwarf_pubnames_table::read_section): Check for GNU-style
641         sections, and for compressed debug sections.
642         (Dwarf_pubnames_table::read_header): Compute end address of table.
643         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
644         for end of list by offset, not by offset == 0.
645         (Dwarf_info_reader::do_read_string_table): Check for compressed
646         debug sections.
647         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
648         Initialize new data members.
649         (Dwarf_pubnames_table::next_name): return flag_byte.
650         (Dwarf_pubnames_table::end_of_table_): New data member.
651         (Dwarf_pubnames_table::is_gnu_style_): New data member.
652         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
653         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
654         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
655         read skeleton type unit DIEs.
656         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
657         (Gdb_index::do_write): Write flag_byte.
658         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
659         (Gdb_index::Cu_vector): Store flags along with cu indexes.
660         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
661         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
662
663 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
664
665         * version.cc (print_version): Update copyright year to 2014.
666
667 2013-12-19  Dimitry Andric  <dimitry@andric.com>
668
669         * stringpool.cc (Stringpool_template::reserve): Add
670         HAVE_UNORDERED_MAP case.
671         * stringpool.cc (Stringpool_template::print_stats): Likewise.
672
673 2013-12-18  Cary Coutant  <ccoutant@google.com>
674
675         * configure.ac: Check for <unordered_set> and <unordered_map>.
676         * config.in: Regenerate.
677         * configure: Regenerate.
678         * system.h: Use <unordered_set> and <unordered_map> if available.
679
680 2013-12-10  Roland McGrath  <mcgrathr@google.com>
681
682         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
683         with $(INSTALL_PROGRAM_ENV).
684         * Makefile.in: Regenerate.
685
686 2013-11-22  Cary Coutant  <ccoutant@google.com>
687
688         * configure.ac: Add check for which library is needed for
689         dlopen.
690         * configure: Regenerate.
691
692 2013-11-22  Cary Coutant  <ccoutant@google.com>
693
694         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
695         assembler.
696         * testsuite/Makefile.in: Regenerate.
697
698 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
699
700         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
701         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
702         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
703         (Target_x86_64<size>::Scan::local): Likewise.
704         (Target_x86_64<size>::Scan::global): Likewise.
705         (Target_x86_64<size>::Relocate::relocate): Likewise.
706         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
707         Likewise.
708         (Target_x86_64<size>::Scan::check_non_pic(): Handle
709         R_X86_64_PC32_BND.
710
711         * testsuite/Makefile.am (check_PROGRAMS): Add
712         exception_x86_64_bnd_test.
713         (exception_x86_64_bnd_test_SOURCES): New macro.
714         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
715         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
716         (exception_x86_64_bnd_test_LDADD): Likewise.
717         (exception_x86_64_bnd_1.o): New rule.
718         (exception_x86_64_bnd_2.o): Likewise.
719         * testsuite/Makefile.in: Regenerated.
720
721 2013-11-15  Alan Modra  <amodra@gmail.com>
722
723         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
724         accessor.
725         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
726         Only call ppc64_local_entry_offset for 64-bit.  Restrict
727         symval_for_branch lookup to ELFv1.
728         (Stub_table::add_plt_call_entry): Use unsigned int off.
729         (Output_data_glink::Address, invalid_address): New.
730         (Output_data_glink::add_eh_frame): Move out of line.  Add
731         support for ELFv2.
732         (Output_data_glink::add_global_entry, find_global_entry,
733         global_entry_address): New functions.
734         (Output_data_glink::global_entry_stubs_, end_branch_table_,
735         ge_size): New variables.
736         (Output_data_glink::set_final_data_size): Add global entry
737         stub sizing.
738         (Output_data_glink::do_write): Write global entry stubs.
739         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
740         parameter.  Return true for ELFv2.  Adjust callers.
741         (Target_powerpc::Scan::local, global): Restrict opd lookup to
742         ELFv1.  Similarly for ifunc and dynamic relocation processing
743         specific to ELFv1.  Recognize that symbols are defined on
744         their plt entries for ELFv2.
745         (Target_powerpc::symval_for_branch): Assert if called for
746         ELFv2 or ppc32.
747         (Target_powerpc::Relocate::relocate): Use global entry plt
748         stub for symbol value if such exists on ELFv2.
749         (Target_powerpc::Relocate::relocate): Don't call
750         symval_for_branch when ELFv2.  Do adjust for local entry
751         offset when ELFv2.
752         (Target_powerpc::do_dynsym_value): Set symbols to global entry
753         plt stub for ELFv2.
754         (Target_powerpc::do_plt_address_for_global): Similarly.
755
756 2013-11-14  Cary Coutant  <ccoutant@google.com>
757
758         Revert patch -- this did not fix the problem, and there is
759         no race there.
760
761         2013-11-14  Cary Coutant  <ccoutant@google.com>
762
763             PR gold/14860
764             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
765             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
766             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
767             updating fde_offsets_.
768             (Eh_frame_hdr::lock_): New data member.
769
770 2013-11-14  Cary Coutant  <ccoutant@google.com>
771
772         * dwp.cc (Dwo_file_entry): New type.
773         (File_list): Use Dwo_file_entry.
774         (Dwo_file::verify): New function.
775         (Dwo_file::verify_dwo_list): New function.
776         (Dwo_file::sized_verify_dwo_list): New function.
777         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
778         list.
779         (Dwp_options): New enum type.
780         (dwp_options): Add --verify-only.
781         (usage): Likewise.
782         (main): Likewise.
783         * dwp.h (gold_info): Add declaration.
784
785 2013-11-14  Cary Coutant  <ccoutant@google.com>
786
787         PR gold/14860
788         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
789         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
790         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
791         updating fde_offsets_.
792         (Eh_frame_hdr::lock_): New data member.
793
794 2013-11-06  Cary Coutant  <ccoutant@google.com>
795
796         PR gold/15758
797         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
798         before reloc sections.
799
800 2013-11-04  Alan Modra  <amodra@gmail.com>
801
802         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
803         (Symbol::needs_dynamic_reloc): Test new flag.
804         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
805         (Target_powerpc::Scan::get_reference_flags): Add target param.
806         Return FUNC_DESC_ABI for 64-bit ELFv1.
807         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
808         call.
809         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
810         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
811
812 2013-10-31  Cary Coutant  <ccoutant@google.com>
813
814         Restore support for dwp v2 DWARF package file format.
815
816         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
817         tu_length parameter.  Adjust all callers.
818         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
819         * dwp.cc: Include dwarf.h.
820         (Section_bounds): New struct type.
821         (Unit_set): New struct type.
822         (Dwo_file::Dwo_file): Initialize new data member.
823         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
824         Combine and rename to...
825         (Dwo_file::read_unit_index): ...this.
826         (Dwo_file::sized_read_compunit_index)
827         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
828         (Dwo_file::sized_read_unit_index): ...this.
829         (Dwo_file::copy_section): Remove section_name, is_str_offsets
830         parameters; add section_id parameter.
831         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
832         (Dwo_file::add_unit_set): ...this.
833         (Dwo_file::shndx_map_): Remove.
834         (Dwo_file::sect_offsets_): New data member.
835         (Dwp_output_file::Dwp_output_file): Initialize new data members.
836         (Dwp_output_file::add_section): Rename to...
837         (Dwp_output_file::add_contribution): ...this.
838         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
839         (Dwp_output_file::add_tu_set): Likewise.
840         (Dwp_output_file::Contribution): New type.
841         (Dwp_output_file::Section::contributions): New data member.
842         (Dwp_output_file::Cu_or_tu_set): Remove.
843         (Dwp_output_file::Section::Section): New ctor.
844         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
845         (Dwp_output_file::Dwp_index::Section_table): New type.
846         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
847         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
848         parameter.
849         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
850         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
851         (Dwp_output_file::Dwp_index::section_table): New member function.
852         (Dwp_output_file::Dwp_index::section_table_end): New member function.
853         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
854         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
855         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
856         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
857         (Dwp_output_file::Dwp_index::section_table_): New data member.
858         (Dwp_output_file::Dwp_index::section_mask_): New data member.
859         (Dwp_output_file::add_output_section): New member function.
860         (Dwp_output_file::write_new_section): New member function.
861         (Dwp_output_file::write_contributions): New member function.
862         (Dwp_output_file::section_id_map_): New data member.
863         (class Dwo_id_info_reader): Remove.
864         (class Unit_reader): New class.
865         (get_dwarf_section_name): New function.
866         (Dwo_file::read_executable): Adjust initializations of class data.
867         (Dwo_file::read): Add support for v2 package file format.
868         (Dwo_file::read_unit_index): Likewise.
869         (Dwo_file::sized_read_unit_index): Likewise.
870         (Dwo_file::copy_section): Likewise.
871         (Dwo_file::add_unit_set): Likewise.
872         (Dwp_output_file::add_output_section): Likewise.
873         (Dwp_output_file::add_contribution): Likewise.
874         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
875         for empty slot.
876         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
877         file format.
878         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
879         slot.
880         (Dwp_output_file::initialize): Remove unused function.
881         (Dwp_output_file::finalize): Add support for v2 package file format.
882         (Dwp_output_file::write_index): Likewise.
883         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
884         function prototype.
885
886 2013-10-31  Cary Coutant  <ccoutant@google.com>
887
888         * configure.ac: Fix check for -fmerge-constants.
889         * configure.ac: Regenerate.
890
891 2013-10-30  Roland McGrath  <mcgrathr@google.com>
892
893         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
894         Correct 9-byte nop sequence to match what the assembler generates.
895
896 2013-10-30  Alan Modra  <amodra@gmail.com>
897
898         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
899         ppc64_local_entry_offset, ppc64_local_entry_offset,
900         do_read_symbols): New functions.
901         (Powerpc_relobj::e_flags_, st_other_): New vars.
902         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
903         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
904         (Powerpc_relobj::e_flags_): New var.
905         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
906         and adjust for ELFv2.
907         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
908         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
909         (Powerpc_dynobj::do_find_special_sections): Likewise.
910         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
911         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
912         to ELFv2 local entry.
913         (Target_powerpc::do_relax): No thread safe barriers needed for
914         ELFv2.
915         (Output_data_plt_powerpc::initial_plt_entry_size_,
916         plt_entry_size): Delete.  Replace all uses with
917         first_plt_entry_offset() and plt_entry_size().
918         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
919         reserved_size parm.  Update callers.
920         (Output_data_plt_powerpc::entry_count): Update.
921         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
922         and use Target_powerpc::first_plt_entry_offset().
923         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
924         rename to plt_entry_size.
925         (Output_data_plt_powerpc::add_ifunc_entry,
926         add_local_ifunc_entry): Adjust reloc for ELFv2.
927         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
928         (glink_eh_frame_fde_64v2): New.
929         (Stub_table::plt_call_size): Support ELFv2 sizing.
930         (Output_data_glink::add_eh_frame): Use the new FDE.
931         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
932         (Stub_table::do_write): Write ELFv2 stubs and glink.
933         (Target_powerpc::Relocate::relocate): Replaces nop after call
934         with ld 2,24(1) and adjust local offset destination for ELFv2.
935
936 2013-10-30  Alan Modra  <amodra@gmail.com>
937
938         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
939         (Target_powerpc::Scan::global, local): Likewise.
940         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
941         on all ppc64 @h and @ha relocs.
942
943 2013-10-14  Alan Modra  <amodra@gmail.com>
944
945         * output.h (Output_data_got::add_constant): Tidy.
946         (Output_data_got::add_constant_pair): New function.
947         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
948         methods used so as to first call reserve_ent().
949
950 2013-10-11  Roland McGrath  <mcgrathr@google.com>
951
952         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
953         add_got_entry and add_got_entry_pair.
954
955         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
956         (HAVE_PUBNAMES): Likewise.
957         * configure: Regenerate.
958
959         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
960         * testsuite/Makefile.in: Regenerate.
961
962         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
963         Remove const from declaration.
964         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
965         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
966         * output.h (Output_file_header): Remove const from member target_
967         and corresponding constructor argument.
968         * output.cc (Output_file_header::Output_file_header): Update prototype.
969         (Output_file_header::do_sized_write): Use this->target_ in place
970         of parameters()->target().
971
972         * testsuite/undef_symbol.cc (Foo::get_a): New method.
973
974         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
975         * configure: Regenerate.
976         * Makefile.in: Regenerate.
977         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
978         * testsuite/merge_string_literals_2.c: Likewise.
979         * testsuite/Makefile.am
980         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
981         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
982         literal -fmerge-constants.
983         * testsuite/Makefile.in: Regenerate.
984
985         * i386.cc (Target_i386): Remove unused member dynbss_.
986         * arm.cc (Target_arm): Likewise.
987         * powerpc.cc (Target_powerpc): Likewise.
988         * sparc.cc (Target_sparc): Likewise.
989         * tilegx.cc (Target_tilegx): Likewise.
990         * x86_64.cc (Target_x86_64): Likewise.
991         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
992         type_signature_, type_offset_.
993         * plugin.h (Plugin_hook): Remove unused member layout_.
994         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
995         mapfile_.
996         (Read_member): Remove unused members input_objects_, symtab_,
997         mapfile_, layout_.
998         (Check_library): Remove unused member symtab_.
999         * archive.h (Lib_group): Remove unused member lib_.
1000         * archive.cc (Lib_group::Lib_group): Update initializer.
1001         * incremental.h (Incremental_binary): Remove unused member target_.
1002         (Incremental_script_entry): Removed unused member script_.
1003         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1004         * icf.h (Icf): Remove unused member num_tracked_relocs.
1005
1006         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1007         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1008         its only use.
1009         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1010
1011         * archive.h: Use struct rather than class for forward declaration
1012         of Read_symbols_data.
1013
1014 2013-10-07  Cary Coutant  <ccoutant@google.com>
1015
1016         PR gold/16010
1017         * testsuite/Makefile.am (icf_test): Fix dependencies.
1018         (icf_safe_test): Likewise.
1019         (icf_safe_so_test): Likewise.
1020         (large_symbol_alignment): Add empty _LDADD rule.
1021         * testsuite/Makefile.in: Regenerate.
1022
1023 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1024
1025         PR gold/15927
1026         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1027         relocation for R_X86_64_32 on x32.
1028
1029 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1030
1031         * output.cc (Output_segment::set_section_addresses): Take new
1032         Target* argument.  If target->isolate_execinstr() and the segment
1033         is executable and starts at a target->abi_pagesize() boundary,
1034         pad its end out to a target->abi_pagesize() boundary with code fill.
1035         * output.h (Output_segment::set_section_addresses): Update decl.
1036         * layout.h (Layout::check_output_data_for_reset_values): Take new
1037         argument RELAX_OUTPUTS.
1038         (Layout): New member relax_output_list_.
1039         (Layout::add_relax_output): New method.
1040         * layout.cc (Layout::Layout): Update constructor.
1041         (Layout::reset_relax_output): New method.
1042         (Layout::clean_up_after_relaxation): Call it.
1043         (Layout::prepare_for_relaxation): Update caller.
1044         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1045         Call reset_relax_output before re-processing segments for
1046         isolate_execinstr case.
1047         (Layout::write_data): Handle relax_output_list_.
1048         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1049         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1050
1051 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1052
1053         PR binutils/15834
1054         * object.h: Fix typos.
1055
1056 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1057
1058         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1059         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1060
1061 2013-08-07  Cary Coutant  <ccoutant@google.com>
1062
1063         Revert support for v2 DWP files:
1064
1065         2013-03-01  Cary Coutant  <ccoutant@google.com>
1066
1067             Add dwp support for v2 DWARF package file format.
1068             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1069             tu_length parameter.  Adjust all callers.
1070             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1071             * dwp.cc: Include dwarf.h.
1072             (Section_bounds): New struct type.
1073             (Unit_set): New struct type.
1074             (Dwo_file::Dwo_file): Initialize new data member.
1075             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1076             Combine and rename to...
1077             (Dwo_file::read_unit_index): ...this.
1078             (Dwo_file::sized_read_compunit_index)
1079             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1080             (Dwo_file::sized_read_unit_index): ...this.
1081             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1082             parameters; add section_id parameter.
1083             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1084             (Dwo_file::add_unit_set): ...this.
1085             (Dwo_file::shndx_map_): Remove.
1086             (Dwo_file::sect_offsets_): New data member.
1087             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1088             (Dwp_output_file::add_section): Rename to...
1089             (Dwp_output_file::add_contribution): ...this.
1090             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1091             (Dwp_output_file::add_tu_set): Likewise.
1092             (Dwp_output_file::Contribution): New type.
1093             (Dwp_output_file::Section::contributions): New data member.
1094             (Dwp_output_file::Cu_or_tu_set): Remove.
1095             (Dwp_output_file::Section::Section): New ctor.
1096             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1097             (Dwp_output_file::Dwp_index::Section_table): New type.
1098             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1099             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1100             parameter.
1101             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1102             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1103             (Dwp_output_file::Dwp_index::section_table): New member function.
1104             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1105             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1106             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1107             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1108             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1109             (Dwp_output_file::Dwp_index::section_table_): New data member.
1110             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1111             (Dwp_output_file::add_output_section): New member function.
1112             (Dwp_output_file::write_new_section): New member function.
1113             (Dwp_output_file::write_contributions): New member function.
1114             (Dwp_output_file::section_id_map_): New data member.
1115             (class Dwo_id_info_reader): Remove.
1116             (class Unit_reader): New class.
1117             (get_dwarf_section_name): New function.
1118             (Dwo_file::read_executable): Adjust initializations of class data.
1119             (Dwo_file::read): Add support for v2 package file format.
1120             (Dwo_file::read_unit_index): Likewise.
1121             (Dwo_file::sized_read_unit_index): Likewise.
1122             (Dwo_file::copy_section): Likewise.
1123             (Dwo_file::add_unit_set): Likewise.
1124             (Dwp_output_file::add_output_section): Likewise.
1125             (Dwp_output_file::add_contribution): Likewise.
1126             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1127             for empty slot.
1128             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1129             file format.
1130             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1131             slot.
1132             (Dwp_output_file::initialize): Remove unused function.
1133             (Dwp_output_file::finalize): Add support for v2 package file format.
1134             (Dwp_output_file::write_index): Likewise.
1135             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1136             function prototype.
1137
1138 2013-07-31  Cary Coutant  <ccoutant@google.com>
1139
1140         * object.cc (Sized_relobj::do_output_section_address): New function.
1141         (Sized_relobj): Instantiate explicitly.
1142         * object.h (Object::output_section_address): New function.
1143         (Object::do_output_section_address): New function.
1144         (Sized_relobj::do_output_section_address): New function.
1145         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1146
1147 2013-07-30  Cary Coutant  <ccoutant@google.com>
1148             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1149
1150         * parameters.cc (Parameters::entry): Return target-specific entry
1151         symbol name.
1152         * target.h (Target::entry_symbol_name): New function.
1153         (Target_info::entry_symbol_name): New data member.
1154
1155         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1156         * i386.cc (Target_i386::i386_info): Likewise.
1157         (Target_i386_nacl::i386_nacl_info): Likewise.
1158         * sparc.cc (Target_sparc::sparc_info): Likewise.
1159         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1160         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1161         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1162         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1163
1164 2013-07-22  Sterling Augustine  <saugustine@google.com>
1165
1166         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1167         Convert parameter shndx to local variable. Add parameters symtab
1168         and symtab_size.  Scan over section names.  Find relocation
1169         section corresponding to current section.  Create and initialize
1170         reloc_mapper_ and reloc_type_.
1171         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1172         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1173         cu_offset_.
1174         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1175         Initialize new fields unit_length_ and cu_offset_.
1176         (Dwarf_pubnames_table::read_section): Update prototype.
1177         (Dwarf_pubnames_table::cu_offset): New member function.
1178         (Dwarf_pubnames_table::subsection_size): Likewise.
1179         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1180         New fields.
1181         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1182         member functions public.
1183         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1184         Update comment.  Rework logic.  Move repeated parts to...
1185         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1186         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1187         pubtypes_table_, and stmt_list_offset.
1188         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1189         Gdb_index::find_pubtype_offset,
1190         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1191         (Gdb_index::pubnames_read): Update prototype and rework logic.
1192         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1193         Forward declare.
1194         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1195         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1196         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1197         Gdb_index::map_pubtable_to_dies):
1198         Declare functions.
1199         (Gdb_index::pubnames_read): Update declaration.
1200         (Gdb_index::Pubname_offset_map): New type.
1201         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1202         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1203         Gdb_index::stmt_list_offset): Declare.
1204         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1205         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1206         Gdb_index::pubtypes_offset_): Remove.
1207
1208 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1209
1210         * options.h (General_options): Add -Trodata-segment option.
1211         * parameters.cc (Parameters::check_rodata_segment): New function.
1212         (Parameters::set_target_once): Call it.
1213         * parameters.h (Parameters): Declare it (private member function).
1214         * layout.cc (load_seg_unusable_for_headers): New function, broken
1215         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1216         then validate rodata segment rather than text segment.
1217         (relaxation_loop_body): Call that.
1218         (is_text_segment): New function.  Don't admit a non-executable
1219         segment if TARGET->isolate_execinstr().
1220         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1221
1222 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1223
1224         PR gold/15070
1225         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1226         * nacl.h (Sniff_file::View::View): Request aligned view.
1227
1228 2013-07-11  Cary Coutant  <ccoutant@google.com>
1229
1230         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1231         correct BRLT entry size.
1232
1233 2013-07-03  Alan Modra  <amodra@gmail.com>
1234
1235         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1236         comment.
1237
1238 2013-07-01  Cary Coutant  <ccoutant@google.com>
1239
1240         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1241         reloc_type_.
1242         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1243         (Dwarf_ranges_table::lookup_reloc): New function.
1244         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1245         reloc_type_.
1246         (Dwarf_ranges_table::lookup_reloc): New function.
1247         (Dwarf_ranges_table::reloc_type_): New data member.
1248
1249 2013-06-27  Jing Yu  <jingyu@google.com>
1250
1251         PR gold/15662
1252         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1253         function.
1254         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1255         (Target_powerpc::do_relax): Call the above.
1256
1257 2013-06-27  Cary Coutant  <ccoutant@google.com>
1258
1259         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1260         on garbage collected .opd section.
1261
1262 2013-06-27  Alan Modra  <amodra@gmail.com>
1263
1264         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1265         is non-zero.
1266         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1267         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1268
1269 2013-06-14  Cary Coutant  <ccoutant@google.com>
1270
1271         * resolve.cc (Symbol::override_base): Don't override st_type
1272         from plugin placeholder symbols.
1273         (Symbol_table::resolve): Likewise.
1274         (Symbol_table::should_override): Don't complain about TLS mismatch
1275         if the TO symbol is a plugin placeholder.
1276         * testsuite/Makefile.am (plugin_test_tls): New test.
1277         * testsuite/Makefile.in: Regenerate.
1278         * testsuite/plugin_test_tls.sh: New test script.
1279         * testsuite/two_file_test_2_tls.cc: New test source.
1280         * testsuite/two_file_test_tls.cc: New test source.
1281
1282 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1283
1284         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1285         the maximum segment alignment is larger than the page size.
1286         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1287         correctly aligns the symbols with large alignemnt.
1288         * testsuite/Makefile.in: Regenerate.
1289         * testsuite/large_symbol_alignment.cc: New file.
1290
1291 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1292             Sriraman Tallam  <tmsriram@google.com>
1293
1294         * options.h (sort_section): New option.
1295         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1296         Rename from Input_section_sort_section_name_special_ordering_compare.
1297         (Input_section_sort_section_name_compare): New struct.
1298         * output.cc (Output_section::Input_section_sort_section_name_compare::
1299         operator()): New function.
1300         (Output_section::sort_attached_input_sections): Use new sort function
1301         for .text if --sort-section=name is specified.
1302         * layout.cc (Layout::make_output_section):
1303         Add sorting by name when --sort-section=name is specified.
1304         * testsuite/Makefile.am (text_section_grouping): Test option
1305         --sort-section=name.
1306         * testsuite/Makefile.in: Regenerate.
1307         * testsuite/section_sorting_name.cc: New file.
1308         * testsuite/section_sorting_name.sh: New file.
1309
1310 2013-05-21  Cary Coutant  <ccoutant@google.com>
1311
1312         * symtab.h (Symbol::is_cxx_vtable): New function.
1313         * target-reloc.h (relocate_section): Check for vtable symbol.
1314         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1315         * testsuite/Makefile.in: Regenerate.
1316         * testsuite/missing_key_func.cc: New test source.
1317         * testsuite/missing_key_func.sh: New test script.
1318
1319 2013-05-21  Cary Coutant  <ccoutant@google.com>
1320
1321         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1322         type of enclosing symbol.
1323         (Relocate_info::location): Check symbol type when describing symbol.
1324         * object.h (Symbol_location_info): Remove unused line_number;
1325         add enclosing_symbol_type.
1326         * testsuite/debug_msg.sh: Adjust expected output.
1327
1328 2013-05-13  Cary Coutant  <ccoutant@google.com>
1329
1330         * configure.ac: Export DEFAULT_TARGET.
1331         * configure: Regenerate.
1332         * Makefile.in: Regenerate.
1333         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1334         * testsuite/Makefile.in: Regenerate.
1335         * testsuite/debug_msg.sh: Delete duplicate tests.
1336         Don't check undef_int error message match for powerpc where the
1337         source file and line number aren't available.
1338
1339 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1340
1341         * options.h (General_options): Add --rosegment-gap option.
1342         * options.cc (finalize): --rosegment-gap implies --rosegment.
1343         * layout.cc (set_segment_offsets): Let user option override
1344         target->rosegment_gap().
1345
1346 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1347
1348         * options.h (General_options): Remove leading space from help
1349         messages for -nostdlib and --rosegment.
1350
1351 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1352
1353         PR ld/15365
1354         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1355
1356 2013-05-03  Alan Modra  <amodra@gmail.com>
1357
1358         * merge.cc (Output_merge_string::do_add_input_section): Correct
1359         scan for number of strings.  Rename vars to avoid shadowing.
1360         Include missing terminator in input_size_.
1361
1362 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1363
1364         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1365         Restore empty string handling.
1366
1367 2013-05-01  Cary Coutant  <ccoutant@google.com>
1368
1369         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1370         uninitialized warning.
1371
1372 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1373
1374         * output.cc (Output_section::add_merge_input_section): Allow
1375         to merge sections if the alignment is more than character size.
1376         * merge.h (Output_merge_string::Output_merge_string): Remove
1377         assert.
1378         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1379         only not-null strings. Check the alignment of strings.
1380         * stringpool.h
1381         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1382         alignment as the argument.
1383         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1384         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1385         Align non-zero length strings according to the addralign_.
1386         (Stringpool_template<Stringpool_char>::set_string_offsets):
1387         Updating offsets according to the given alignment.
1388         * testsuite/Makefile.am (text_section_grouping): Test if string
1389         literals are getting merged.
1390         * testsuite/Makefile.in: Regenerate.
1391         * testsuite/merge_string_literals_1.c: New file.
1392         * testsuite/merge_string_literals_2.c: Ditto.
1393         * testsuite/merge_string_literals.sh: Ditto.
1394
1395 2013-04-26  Ian Lance Taylor  <iant@google.com>
1396
1397         * target-reloc.h (relocate_section): If the reloc offset is out of
1398         range, pass VIEW as NULL to relocate.relocate.
1399         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1400         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1401         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1402         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1403         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1404         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1405
1406 2013-04-26  Geoff Pike  <gpike@chromium.org>
1407
1408         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1409         * layout.cc (Hash_task): New class.
1410         (Layout::queue_build_id_tasks): New function.
1411         (Layout::write_build_id): Handle single-thread portion of build ID
1412         computation.  (In some cases, all of it is single-threaded.)  Replace
1413         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1414         functionality in fewer lines of code.
1415         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1416         * options.h (General_options): make "--build-id" default to tree
1417         rather than sha1.  Add two new options related to --build-id=tree:
1418         --build-id-chunk-size-for-treehash and
1419         --build-id-min-file-size-for-treehash.
1420         * Makefile.am: add testing of --build-id=tree and related new options
1421         (these tests will be invoked by "make check").
1422         * Makefile.in: Regenerate.
1423
1424 2013-04-25  Alan Modra  <amodra@gmail.com>
1425
1426         * configure.tgt: Add powerpcle and powerpc64le.
1427
1428 2013-04-22  Alan Modra  <amodra@gmail.com>
1429
1430         PR gold/15355
1431         * layout.cc (Layout::segment_precedes): Allow more than one
1432         segment with the same type and flags.
1433
1434 2013-04-15  Cary Coutant  <ccoutant@google.com>
1435
1436         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1437         allocate space in file for BSS sections.
1438
1439 2013-04-15  Cary Coutant  <ccoutant@google.com>
1440
1441         * script-sections.cc (Orphan_output_section): Reset address
1442         to zero after each orphaned section for relocatable links.
1443
1444 2013-04-15  Cary Coutant  <ccoutant@google.com>
1445
1446         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1447         section starting address for relocatable link.
1448         * testsuite/Makefile.am (script_test_11): New test.
1449         * testsuite/Makefile.in: Regenerate.
1450         * testsuite/script_test_11.c: New source file.
1451         * testsuite/script_test_11.t: New linker script.
1452
1453 2013-04-13  Alan Modra  <amodra@gmail.com>
1454
1455         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1456         owner when sections are not adjacent and exceed group size.
1457         (Target_powerpc::group_sections): Handle corner case.
1458         (Target_powerpc::Branch_info::make_stub): Handle case where
1459         stub table doesn't exist due to branches in non-exec sections.
1460         (Target_powerpc::Relocate::relocate): Likewise.
1461
1462 2013-04-11  Alan Modra  <amodra@gmail.com>
1463
1464         PR gold/15354
1465         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1466         .branch_lt to match bfd ld.  Adjust comments throughout file.
1467
1468 2013-04-04  Ian Lance Taylor  <iant@google.com>
1469
1470         GCC PR c++/56840
1471         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1472         sections before checking whether they are included in the link.
1473
1474 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1475
1476         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1477         object before calling the plugin claim_file handler.  Pass the elf
1478         object of the archive to the plugin. Delete the elf object if the
1479         plugin claims the file.
1480
1481 2013-03-21  Alan Modra  <amodra@gmail.com>
1482
1483         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1484         segment when omagic.
1485
1486 2013-03-21  Alan Modra  <amodra@gmail.com>
1487
1488         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1489         comparison warning.
1490         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1491         uninitialized" warning.
1492
1493 2013-03-20  Alan Modra  <amodra@gmail.com>
1494
1495         * symtab.h (Symbol::clear_version): New function.
1496         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1497         is_needed by weak references.  Clear version for symbols defined
1498         in as-needed objects that are not needed.
1499
1500 2013-03-15  Alan Modra  <amodra@gmail.com>
1501
1502         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1503         static and public.  Add report_err param.  Return false for data refs.
1504         (Target_powerpc::rela_dyn_section): New overloaded function.
1505         (Target_powerpc::plt_, iplt_): Elucidate.
1506         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1507         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1508         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1509         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1510         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1511         push_branch and make_plt_entry for ifunc syms when
1512         reloc_needs_plt_for_ifunc.
1513         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1514         for ifunc unless reloc_needs_plt_for_ifunc.
1515
1516 2013-03-15  Alan Modra  <amodra@gmail.com>
1517
1518         * gc.h (gc_process_relocs): Don't look through function descriptors.
1519         * icf.cc (get_section_contents): Do so here instead.
1520
1521 2013-03-13  Alan Modra  <amodra@gmail.com>
1522
1523         * powerpc.cc (is_branch_reloc): Forward declare.
1524         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1525         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1526         false for 64-bit, true for 32-bit non-branch relocs.
1527         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1528         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1529         nm output.
1530         (icf_safe_test): Generate linker map file as well as nm output.
1531         (icf_safe_so_test): Likewise.
1532         * testsuite/Makefile.in: Regenerate.
1533         * testsuite/icf_test.sh: Parse linker map file to determine
1534         section folding.
1535         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1536         * testsuite/icf_safe_so_test.sh: Likewise.
1537         (X86_32_or_ARM_specific_safe_fold): Merge into..
1538         (arch_specific_safe_fold): ..this.
1539         (X86_64_specific_safe_fold): Delete unused function.
1540
1541 2013-03-12  Alan Modra  <amodra@gmail.com>
1542
1543         * gc.h (gc_process_relocs): Look through function descriptors
1544         to determine shndx, symvalue and addend used by ICF.  Tidy
1545         variable duplication.
1546
1547 2013-03-11  Alan Modra  <amodra@gmail.com>
1548
1549         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1550         * layout.cc (Layout_task_runner::run): ..to here.
1551         * symtab.h (struct Symbol_location): Extract from..
1552         (class Symbol_table): ..here.
1553         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1554         * target.h (class Target): Add function_location and
1555         do_function_location functions.
1556         (class Sized_target): Add do_function_location.
1557         * object.h (class Sized_relobj_file): Move find_shdr..
1558         (class Object): ..to here.
1559         * object.cc: Likewise.  Update to suit.  Instantiate.
1560         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1561         * powerpc.cc (class Powerpc_dynobj): New.
1562         (Target_powerpc::do_function_location): New function.
1563         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1564         (Powerpc_dynobj::do_read_symbols): New function.
1565         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1566
1567 2013-03-08  Ian Lance Taylor  <iant@google.com>
1568
1569         * options.cc (General_options::string_to_object_format): Accept
1570         "default".
1571
1572 2013-03-08  Alan Modra  <amodra@gmail.com>
1573
1574         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1575         pointer to Post_fde.
1576         (struct Post_fde): Move definition to here..
1577         * ehframe.cc (struct Post_fde): ..from here.
1578         (Cie::write): Don't alloc Post_fde.
1579         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1580
1581 2013-03-07  Alan Modra  <amodra@gmail.com>
1582
1583         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1584         relocation referencing .LC0.
1585         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1586
1587 2013-03-07  Alan Modra  <amodra@gmail.com>
1588
1589         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1590         always_inline.  Add assembly for powerpc to avoid GOT.
1591
1592 2013-03-07  Alan Modra  <amodra@gmail.com>
1593
1594         * testsuite/script_test_10.sh: Don't test .bss section
1595         header number.
1596
1597 2013-03-06  Alan Modra  <amodra@gmail.com>
1598
1599         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1600         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1601         all callers.  Handle folded sections.
1602         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1603         to Powerpc_relobj.
1604         (Global_symbol_visitor_opd::operator()): Likewise.
1605
1606 2013-03-04  Alan Modra  <amodra@gmail.com>
1607
1608         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1609         * testsuite/Makefile.in: Regenerate.
1610
1611 2013-03-01  Cary Coutant  <ccoutant@google.com>
1612
1613         Add dwp support for v2 DWARF package file format.
1614         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1615         tu_length parameter.  Adjust all callers.
1616         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1617         * dwp.cc: Include dwarf.h.
1618         (Section_bounds): New struct type.
1619         (Unit_set): New struct type.
1620         (Dwo_file::Dwo_file): Initialize new data member.
1621         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1622         Combine and rename to...
1623         (Dwo_file::read_unit_index): ...this.
1624         (Dwo_file::sized_read_compunit_index)
1625         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1626         (Dwo_file::sized_read_unit_index): ...this.
1627         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1628         parameters; add section_id parameter.
1629         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1630         (Dwo_file::add_unit_set): ...this.
1631         (Dwo_file::shndx_map_): Remove.
1632         (Dwo_file::sect_offsets_): New data member.
1633         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1634         (Dwp_output_file::add_section): Rename to...
1635         (Dwp_output_file::add_contribution): ...this.
1636         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1637         (Dwp_output_file::add_tu_set): Likewise.
1638         (Dwp_output_file::Contribution): New type.
1639         (Dwp_output_file::Section::contributions): New data member.
1640         (Dwp_output_file::Cu_or_tu_set): Remove.
1641         (Dwp_output_file::Section::Section): New ctor.
1642         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1643         (Dwp_output_file::Dwp_index::Section_table): New type.
1644         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1645         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1646         parameter.
1647         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1648         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1649         (Dwp_output_file::Dwp_index::section_table): New member function.
1650         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1651         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1652         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1653         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1654         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1655         (Dwp_output_file::Dwp_index::section_table_): New data member.
1656         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1657         (Dwp_output_file::add_output_section): New member function.
1658         (Dwp_output_file::write_new_section): New member function.
1659         (Dwp_output_file::write_contributions): New member function.
1660         (Dwp_output_file::section_id_map_): New data member.
1661         (class Dwo_id_info_reader): Remove.
1662         (class Unit_reader): New class.
1663         (get_dwarf_section_name): New function.
1664         (Dwo_file::read_executable): Adjust initializations of class data.
1665         (Dwo_file::read): Add support for v2 package file format.
1666         (Dwo_file::read_unit_index): Likewise.
1667         (Dwo_file::sized_read_unit_index): Likewise.
1668         (Dwo_file::copy_section): Likewise.
1669         (Dwo_file::add_unit_set): Likewise.
1670         (Dwp_output_file::add_output_section): Likewise.
1671         (Dwp_output_file::add_contribution): Likewise.
1672         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1673         for empty slot.
1674         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1675         file format.
1676         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1677         slot.
1678         (Dwp_output_file::initialize): Remove unused function.
1679         (Dwp_output_file::finalize): Add support for v2 package file format.
1680         (Dwp_output_file::write_index): Likewise.
1681         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1682         function prototype.
1683
1684 2013-03-01  Cary Coutant  <ccoutant@google.com>
1685
1686         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1687         function into class definition in header file.
1688         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1689         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1690         New function.
1691         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1692
1693 2013-02-28  Alan Modra  <amodra@gmail.com>
1694
1695         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1696         * target.cc (Target::do_plt_fde_location): New function.
1697         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1698         accessor function, and constructor param.
1699         (struct Post_fde, Post_fdes): Declare.
1700         (Cie::write): Add post_fdes param.
1701         * ehframe.cc (Fde::write): Use plt_fde_location.
1702         (struct Post_fde): Define.
1703         (Cie::write): Stash FDEs added post merge mapping.
1704         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1705         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1706         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1707         other FDEs.
1708         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1709         (Target_powerpc::has_glink): New function.
1710         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1711         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1712         glink_eh_frame_fde_32, default_fde): New data.
1713         (Stub_table::eh_frame_added_): New var.
1714         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1715         Make const.
1716         (Stub_table::add_eh_frame): New function.
1717         (Output_data_glink::add_eh_frame): New function.
1718         (Target_powerpc::make_glink_section): Call add_eh_frame.
1719
1720 2013-02-15  Ian Lance Taylor  <iant@google.com>
1721
1722         * options.h (DEFINE_uint64_alias): Define.
1723         (class General_options): Add -Ttext-segment as an alias for
1724         -Ttext.
1725
1726 2013-02-15  Alan Modra  <amodra@gmail.com>
1727
1728         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1729         (Stub_table::do_write): ..here, two places.
1730         (Stub_table::plt_call_size): Use it here too.
1731
1732 2013-02-11  Ian Lance Taylor  <iant@google.com>
1733
1734         * descriptors.cc (Descriptors::close_all): New function.
1735         * descriptors.h (class Descriptors): Declare close_all.
1736         (close_all_descriptors): New inline function.
1737         * plugin.cc: Include "descriptors.h".
1738         (Plugin_manager::cleanup): Call close_all_descriptors.
1739
1740 2013-02-06  Alan Modra  <amodra@gmail.com>
1741
1742         * README: Update coding style link.
1743
1744 2013-01-28  Cary Coutant  <ccoutant@google.com>
1745
1746         * dwp.cc (File_list): New typedef.
1747         (Dwo_name_info_reader): New class.
1748         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1749         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1750         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1751         (Dwo_file::read_executable): New function.
1752         (Dwo_file::read): Move common setup code to ...
1753         (Dwo_file::make_object): ... here.
1754         (dwp_options): Add --exec/-e.
1755         (usage): Likewise.
1756         (main): Likewise.
1757
1758 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1759
1760         * layout.cc (Layout::layout): Check for option text_reorder.
1761         (Layout::make_output_section): Ditto.
1762         * options.h (text_reorder): New option.
1763         * output.cc (Input_section_sort_compare): Remove special ordering
1764         of section names.
1765         (Output_section::
1766          Input_section_sort_section_name_special_ordering_compare::
1767          operator()): New function.
1768         (Output_section::sort_attached_input_sections): Use new sort function
1769         for .text.
1770         * output.h (Input_section_sort_section_name_special_ordering_compare):
1771         New struct.
1772         * testsuite/Makefile.am (text_section_grouping): Test option
1773         --no-text-reorder
1774         * testsuite/Makefile.in: Regenerate.
1775         * testsuite/text_section_grouping.sh: Check order of functions without
1776         default text reordering.
1777
1778 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1779
1780         * options.h (General_options): Change default to true for new_dtags.
1781
1782 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1783
1784         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1785         when enable_new_dtags is false.  Only add DT_RUNPATH when
1786         enable_new_dtags is true.
1787
1788 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1789
1790         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1791         used in declaration and definition consistent.
1792         (Target_powerpc::symval_for_branch): Ditto.
1793
1794 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1795
1796         * testsuite/plugin_final_layout.cc: Fix comment.
1797
1798 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1799
1800         * layout.cc (Layout::layout): Do not do default sorting for
1801         text sections when section ordering is specified.
1802         (make_output_section): Ditto.
1803         * testsuite/plugin_final_layout.cc: Name the function sections
1804         to catch reordering issues.
1805
1806 2013-01-15  Alan Modra  <amodra@gmail.com>
1807
1808         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1809         plt-thread-safe.
1810
1811 2013-01-15  Alan Modra  <amodra@gmail.com>
1812
1813         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1814         * testsuite/Makefile.in: Regenerate.
1815
1816 2013-01-14  Alan Modra  <amodra@gmail.com>
1817
1818         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1819         * testsuite/Makefile.in: Regenerate.
1820
1821 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1822
1823         PR bfd/14430
1824         Fix mingw gold build with plugins enabled
1825         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1826         * configure.ac: Export DLOPEN_LIBS and add headers check.
1827         * plugin.cc: Handle non-dlfcn case.
1828         * Makefile.in: Regenerate.
1829         * config.in: Regenerate.
1830         * configure: Regenerate.
1831         * testsuite/Makefile.in: Regenerate.
1832
1833 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1834
1835         * output.h (sort_attached_input_sections): Change to be public.
1836         * script-sections.cc
1837         (Output_section_definition::set_section_addresses): Sort
1838         attached input sections according to section order before linker
1839         script assigns section addresses.
1840         (Orphan_output_section::set_section_addresses): Sort
1841         attached input sections according to section order before linker
1842         script assigns section addresses.
1843         * Makefile.am (final_layout.sh): Use a simple linker script to
1844         check if section ordering still works.
1845         * Makefile.in: Regenerate.
1846
1847 2013-01-09  Ben Cheng  <bccheng@google.com>
1848
1849         * arm.cc (Target_arm::attributes_accept_div): New function.
1850         (Target_arm::attributes_forbid_div): New function.
1851         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1852         attribute using the same new functions as what bfd/elf32_arm.c
1853         does.
1854
1855 2013-01-07  Cary Coutant  <ccoutant@google.com>
1856
1857         PR gold/14993
1858         * output.cc (Output_section::add_input_section): For incremental
1859         updates, don't track input sections that are allocated from patch
1860         space.
1861
1862 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1863             Ian Lance Taylor  <iant@google.com>
1864
1865         PR gold/14897
1866         * configure.ac (--enable-ld): Removed.
1867         (install_as_default): Set to yes only for --enable-gold=default
1868         or --disable-ld.
1869         * configure: Regenerated.
1870
1871 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1872
1873         * options.h (General_options): Add -fuse-ld= for GCC linker
1874         option compatibility.
1875
1876 2013-01-04  Cary Coutant  <ccoutant@google.com>
1877
1878         * configure.ac: Fix typo restoring CXXFLAGS.
1879         * configure: Regenerate.
1880
1881 2013-01-04  Cary Coutant  <ccoutant@google.com>
1882
1883         * testsuite/Makefile.am (CXXLINK_S): New macro.
1884         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1885         * testsuite/Makefile.in: Regenerate.
1886
1887 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1888
1889         * version.cc (print_version): Update copyright year to 2013.
1890
1891 2012-12-20  Ian Lance Taylor  <iant@google.com>
1892
1893         * layout.cc (Layout::special_ordering_of_input_section): New
1894         function.
1895         (Layout::layout): If input section requires special ordering, must
1896         sort input sections.
1897         (Layout::make_output_section): May sort .text input sections.
1898         (Layout::is_section_name_prefix_grouped): Remove.
1899         * layout.h (class Layout): Declare
1900         special_ordering_of_input_section.  Don't declare
1901         is_section_name_prefix_grouped.
1902         * output.cc (Output_section::add_input_section): Revert last
1903         change.
1904         (Output_section::Input_section_sort::match_file_name): Don't crash
1905         if called on output section data.
1906         (Output_section::Input_section_sort_compare): Sort based on
1907         special ordering.
1908         (Output_section::Input_section_sort_section_order_index_compare):
1909         Revert last patch.
1910         (Output_section::sort_attached_input_sections): Likewise.
1911
1912 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1913
1914         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1915         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1916         * output.cc (Output_section::add_input_section): Check if section
1917         name contains special prefix.  Keep input sections to sort such
1918         sections.
1919         (Output_section::Input_section_sort_section_order_index_compare
1920          ::operator()): Group sections according to prefixes.
1921         (Output_section::sort_attached_input_sections): Add condition to
1922         Input_section_entry constructor call.
1923         * testsuite/Makefile.am (text_section_grouping): New test.
1924         * testsuite/Makefile.in: Regenerate.
1925         * testsuite/text_section_grouping.cc: New file.
1926         * testsuite/text_section_grouping.sh: New file.
1927
1928 2012-12-17  Nick Clifton  <nickc@redhat.com>
1929
1930         * Makefile.am: Add copyright notice.
1931         * NEWS: Likewise.
1932         * README: Likewise.
1933         * configure.ac: Likewise.
1934         * ftruncate.c: Likewise.
1935         * Makefile.in: Regenerate.
1936
1937 2012-12-14  Cary Coutant  <ccoutant@google.com>
1938
1939         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1940         --no-as-needed flag.
1941         (exception_separate_shared_12_test): Likewise.
1942         (incremental_copy_test): Likewise.
1943         * testsuite/Makefile.in: Regenerate.
1944
1945 2012-12-14  Cary Coutant  <ccoutant@google.com>
1946
1947         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1948         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1949
1950 2012-12-12  Alan Modra  <amodra@gmail.com>
1951
1952         * powerpc.cc (class Track_tls): New.
1953         (class Relocate, class Scan): Inherit Track_tls.
1954         (Target_powerpc::Scan::local, global): Track tls optimization
1955         and avoid creating plt entry for __tls_get_addr if all uses
1956         are optimized away.
1957         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1958
1959 2012-12-12  Alan Modra  <amodra@gmail.com>
1960
1961         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1962         Replace no_toc_optimize with toc_optimize.
1963         * output.h (Output_section::input_sections): Provide non-const variant.
1964         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1965         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1966         accessors.
1967         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1968         (class Sort_toc_sections): New.
1969         (Target_powerpc::do_finalize_sections): Sort toc sections.
1970         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1971
1972 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1973
1974         * testsuite/binary_unittest.cc (read_all): New function.
1975         (Sized_binary_test): Use it instead of ::read.
1976         * fileread.cc (do_read): Don't assume pread always reads the whole
1977         amount in a single call.
1978
1979 2012-12-10  Alan Modra  <amodra@gmail.com>
1980
1981         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1982         Set EM_PPC64 or EM_PPC here.
1983         (Target_selector_powerpc::do_recognize): Delete.
1984
1985 2012-12-10  Alan Modra  <amodra@gmail.com>
1986
1987         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1988         stub_table_.
1989         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1990
1991 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1992
1993         * testsuite/binary_unittest.cc (Sized_binary_test):
1994         Use open_descriptor rather than ::open.
1995
1996 2012-12-07  Alan Modra  <amodra@gmail.com>
1997
1998         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1999         typedef and invalid_address constant.
2000         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2001         instantiate constants.
2002
2003 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2004
2005         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2006         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2007         * aclocal.m4: Regenerate.
2008         * configure: Regenerate.
2009         * Makefile.in: Regenerate.
2010         * testsuite/Makefile.in: Regenerate.
2011
2012 2012-12-07  Alan Modra  <amodra@gmail.com>
2013
2014         * options.h (General_options): Add no_toc_optimize.
2015         * powerpc.cc (ok_lo_toc_insn): New function.
2016         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2017
2018 2012-12-06  Alan Modra  <amodra@gmail.com>
2019
2020         * options.h (General_options): Add plt_align, plt_static_chain,
2021         plt_thread_safe.  Update stub_group_size help text.
2022         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2023         for new plt_thread_safe_ var.
2024         (use_plt_offset): Correct comments.
2025         (Target_powerpc::do_relax): Look for thread creation symbols to
2026         determine default plt_thread_safe value.  Clear plt call stubs
2027         as well as branch stubs each iteration.
2028         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2029         insn constants.
2030         (l, hi, ha, write_insn): Move earlier.
2031         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2032         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2033         plt stubs too.
2034         (Stub_table::update_size): Adjust.
2035         (Stub_table::prev_size, set_prev_size): Delete.
2036         (Stub_table::stub_align): Let --plt-align affect result.
2037         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2038         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2039         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2040         (Stub_table::do_write): Support more stub variants.
2041
2042 2012-12-04  Alan Modra  <amodra@gmail.com>
2043
2044         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2045         (Target_powerpc::do_define_standard_symbols): New function.
2046
2047 2012-12-03  Alan Modra  <amodra@gmail.com>
2048
2049         * output.h: Formatting, whitespace.
2050
2051 2012-12-03  Alan Modra  <amodra@gmail.com>
2052
2053         * layout.h (Layout::get_executable_sections): Declare.
2054         * layout.cc (Layout::get_executable_sections): New function.
2055         * arm.cc (Target_arm::group_sections): Use it.
2056         (Arm_output_section::group_sections): Delete now redundant test.
2057         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2058         param to handle relative relocs.
2059         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2060         (Output_data_reloc::add_absolute): Adjust.
2061         (Output_data_reloc::add_relative): New function.
2062         (Output_data::reset_data_size): New function.
2063         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2064         (Output_section::set_addralign): New function.
2065         (Output_section::checkpoint_set_addralign): New function.
2066         (Output_section::clear_section_offsets_need_adjustment): New function.
2067         (Output_section::input_sections): Make public.
2068         * powerpc.cc (class Output_data_brlt_powerpc): New.
2069         (class Stub_table, class Stub_control): New.
2070         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2071         stub_table_, set_stub_table, stub_table): New vectors and accessor
2072         functions.
2073         (Target_powerpc::do_may_relax, do_relax, push_branch,
2074         new_stub_table, stub_tables, brlt_section, group_sections,
2075         add_branch_lookup_table, find_branch_lookup_table,
2076         write_branch_lookup_table, make_brlt_section): New functions.
2077         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2078         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2079         branch_info_): New vars.
2080         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2081         make call stubs here.
2082         (Output_data_glink): Remove all call stub handling from this class.
2083         (Target_powerpc::Scan::local, global): Save interesting branch
2084         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2085         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2086         functions on final link.
2087         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2088         Handle long branch destinations too.
2089         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2090         do_plt_address_for_local): Adjust lookup of plt call stubs.
2091
2092 2012-11-30  Alan Modra  <amodra@gmail.com>
2093
2094         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2095         relocs against protected symbols when building 32-bit shared libs.
2096
2097 2012-11-30  Alan Modra  <amodra@gmail.com>
2098
2099         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2100         param.  Call got_section() to make .got.  Update all callers
2101         and their callers and so on.
2102
2103 2012-11-30  Alan Modra  <amodra@gmail.com>
2104
2105         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2106         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2107         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2108         value if it already exists.
2109
2110 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2111
2112         PR gold/14858
2113         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2114
2115 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2116
2117         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2118         than bfc instruction for data sandboxing.
2119
2120 2012-11-08  Alan Modra  <amodra@gmail.com>
2121
2122         * po/POTFILES.in: Regenerate.
2123
2124 2012-11-05  Alan Modra  <amodra@gmail.com>
2125
2126         * configure.ac: Apply 2012-09-10 change to config.in here.
2127         * configure: Regenerate.
2128
2129 2012-11-05  Alan Modra  <amodra@gmail.com>
2130
2131         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2132         (struct Opd_ent): Use "Address" rather than "Offset".
2133         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2134         (Target_powerpc::got_section): Make public.
2135         (Target_powerpc::scan_relocs): Move code setting symbols..
2136         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2137         Create _SDA_BASE_ only when referenced.
2138
2139 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2140
2141         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2142         from last change.
2143
2144 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2145
2146         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2147         for offset_in_output_section parameter.
2148         (Sized_target::relocate_special_relocatable): Likewise.
2149         * arm.cc (Target_arm::relocate_relocs): Likewise.
2150         (Target_arm::relocate_special_relocatable): Likewise.
2151         * i386.cc (Target_i386::relocate_relocs): Likewise.
2152         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2153         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2154         * target-reloc.h (relocate_relocs): Likewise.
2155         * testsuite/testfile.cc (Target_test): Likewise.
2156         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2157         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2158
2159         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2160         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2161
2162         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2163         parameter, which is unused in the [!F_SETFD] case.
2164
2165         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2166         SYMNDX to off_t before comparing it to this->data_size().
2167         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2168         * incremental.cc (Output_section_incremental_inputs::do_write):
2169         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2170
2171         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2172
2173 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2174
2175         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2176         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2177         in EABI_VER5.
2178
2179 2012-10-29  Cary Coutant  <ccoutant@google.com>
2180
2181         * dwp.cc (usage): Add file and exit status parameters;
2182         add --help and --version options.
2183         (print_version): New function.
2184         (main): Add --help and --version options.
2185
2186 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2187
2188         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2189         final_layout_sequence.txt.
2190         * testsuite/Makefile.in: Regenerated.
2191
2192 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2193
2194         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2195         COMPILE generated by automake.
2196         (LINK1): Likewise.
2197         (CXXCOMPILE1): Likewise.
2198         (CXXLINK1): Likewise.
2199         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2200         (LINK): Likewise.
2201         (CXXCOMPILE): Likewise.
2202         (CXXLINK): Likewise.
2203         * testsuite/Makefile.in: Regenerated.
2204
2205 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2206
2207         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2208         on bad fwrite return.
2209
2210 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2211
2212         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2213         on val.
2214
2215 2012-10-23  Cary Coutant  <ccoutant@google.com>
2216
2217         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2218         * testsuite/Makefile.in: Regenerate.
2219         * testsuite/dwp_test.h: New source file.
2220         * testsuite/dwp_test_1.cc: New source file.
2221         * testsuite/dwp_test_1.s: New source file.
2222         * testsuite/dwp_test_1.sh: New source file.
2223         * testsuite/dwp_test_1b.cc: New source file.
2224         * testsuite/dwp_test_1b.s: New source file.
2225         * testsuite/dwp_test_2.cc: New source file.
2226         * testsuite/dwp_test_2.s: New source file.
2227         * testsuite/dwp_test_2.sh: New source file.
2228         * testsuite/dwp_test_main.cc: New source file.
2229         * testsuite/dwp_test_main.s: New source file.
2230
2231 2012-10-23  Cary Coutant  <ccoutant@google.com>
2232
2233         * dwp.h: New header file.
2234         * dwp.cc: New source file.
2235         * gold.h: Move shared declarations to system.h.
2236         * system.h: New header file.
2237         * Makefile.am: Add dwp.
2238         * Makefile.in: Regenerate.
2239
2240 2012-10-23  Cary Coutant  <ccoutant@google.com>
2241
2242         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2243         Dwarf_info_reader::read_from_pointer.
2244         (Dwarf_pubnames_table::read_header): Likewise.
2245         (Dwarf_pubnames_table::next_name): Likewise.
2246         (Dwarf_die::read_attributes): Likewise.
2247         (Dwarf_die::skip_attributes): Likewise.
2248         (Dwarf_info_reader::read_from_pointer): New function template.
2249         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2250         (Dwarf_pubnames_table): Likewise.
2251         (Dwarf_info_reader::read_from_pointer): New function template.
2252         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2253         Dwarf_pubnames_table ctor.
2254
2255 2012-10-23  Cary Coutant  <ccoutant@google.com>
2256
2257         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2258         abbrev_shndx.
2259         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2260         abbrev_shndx_.
2261         (Dwarf_info_reader::set_abbrev_shndx): New method.
2262         (Dwarf_info_reader::abbrev_shndx_): New data member.
2263
2264 2012-10-23  Cary Coutant  <ccoutant@google.com>
2265
2266         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2267         from object, not parameters.
2268         (Dwarf_info_reader::parse): Likewise.
2269         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2270         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2271         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2272         methods.
2273
2274 2012-10-23  Cary Coutant  <ccoutant@google.com>
2275
2276         * fileread.cc (Input_file::Input_file): New constructor.
2277         * fileread.h (class Input_file): Add new constructor.
2278
2279 2012-10-18  Alan Modra  <amodra@gmail.com>
2280
2281         PR gold/14727
2282         * object.cc (Relobj::is_section_name_included): Also match
2283         .sdata personality section.
2284
2285 2012-10-18  Alan Modra  <amodra@gmail.com>
2286
2287         * target-reloc.h (class Default_comdat_behavior): New, package up..
2288         (get_comdat_behaviour): ..this.
2289         (relocate_section): Add Relocate_comdat_behavior template arg,
2290         adjust code to suit.
2291         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2292         (Target_arm::scan_reloc_section): Likewise.
2293         * i386.cc (Target_i386::relocate_section): Likewise.
2294         * sparc.cc (Target_sparc::relocate_section): Likewise.
2295         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2296         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2297         * powerpc.cc (class Relocate_comdat_behavior): New.
2298         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2299         gold::relocate_section with new template arg.
2300
2301 2012-10-18  Alan Modra  <amodra@gmail.com>
2302
2303         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2304         dynamic relocs for GOT_TPREL got entries, without symbol if
2305         resolving locally.
2306         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2307         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2308         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2309
2310 2012-10-17  Alan Modra  <amodra@gmail.com>
2311
2312         PR gold/14726
2313         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2314
2315 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2316
2317         * layout.cc (Layout::include_section): Keep sections marked
2318         SHF_EXCLUDE when doing relocatable links.
2319
2320 2012-10-16  Alan Modra  <amodra@gmail.com>
2321
2322         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2323         (Target_powerpc::do_finalize_sections): Call it.
2324         (Output_data_save_res): New class and supporting functions.
2325         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2326         normal symbols defined in object files.
2327
2328 2012-10-12  Alan Modra  <amodra@gmail.com>
2329
2330         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2331         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2332         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2333         section if scan_opd_relocs not yet called.
2334         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2335
2336 2012-10-12  Alan Modra  <amodra@gmail.com>
2337
2338         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2339         add_local_ifunc_entry): Revert last change.
2340         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2341
2342 2012-10-05  Alan Modra  <amodra@gmail.com>
2343
2344         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2345         do_plt_address_for_global): New functions.
2346         (Output_data_got_powerpc::do_write): Don't segfault when linking
2347         statically.
2348         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2349         add_local_ifunc_entry): Return true on adding entry..
2350         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2351         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2352         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2353         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2354         set up symbols here.
2355         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2356         syms here.  Do so even when no .iplt.  Don't segfault when linking
2357         statically.
2358         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2359         new variants without reloc param.
2360         (Glink_sym_ent::Glink_sym_ent): Likewise.
2361         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2362         reloc when refs will resolve to plt call stub.
2363         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2364         R_PPC_PLTREL24 to resolve locally.
2365         (Target_powerpc::Scan::global): Correct ifunc handling.
2366         (Target_powerpc::Relocate::relocate): Correct local sym glink
2367         lookup.  Don't destroy "value" when we have a plt call stub,
2368         and when checking plt call validity.
2369         (Target_powerpc::do_dynsym_value): Simplify.
2370
2371 2012-10-05  Alan Modra  <amodra@gmail.com>
2372
2373         * i386.cc (Output_data_plt_i386::address_for_global,
2374         address_for_local): Add plt offset to returned value.  Adjust uses.
2375         * sparc.cc (Output_data_plt_sparc::address_for_global,
2376         address_for_local): Likewise.
2377         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2378         address_for_local): Likewise.
2379         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2380         address_for_local): Likewise.
2381         * target.h (Target::plt_address_for_global, plt_address_for_local):
2382         Update comment.
2383         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2384         (Output_data_got::Got_entry::write): Nor here.
2385         * output.h: Comment fix.
2386
2387 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2388
2389         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2390         global_offset_table_ value for larget got.
2391         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2392
2393 2012-09-29  Alan Modra  <amodra@gmail.com>
2394
2395         * powerpc.cc (Target_powerpc::iplt_): New output section.
2396         (Target_powerpc::iplt_section, make_iplt_section,
2397         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2398         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2399         Target_powerpc::plt_entry_count): Count iplt entries too.
2400         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2401         reloc section in constructor.  New params.
2402         (Target_powerpc::make_plt_section): Create reloc section here instead.
2403         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2404         functions.
2405         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2406         (Output_data_glink::add_entry, find_entry): New functions to
2407         deal with local syms.
2408         (Glink_sym_ent): Add support for local syms.
2409         (Output_data_glink::do_write): Handle ifunc plt entries.
2410         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2411         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2412         (Target_powerpc::Relocate::relocate): Likewise.
2413         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2414
2415 2012-09-25  Alan Modra  <amodra@gmail.com>
2416
2417         * object.h (Sized_relobj_file::adjust_local_symbol,
2418         do_adjust_local_symbol): New functions.
2419         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2420         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2421         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2422         and irregular opd entry spacing.
2423         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2424         (Global_symbol_visitor_opd): New functor.
2425         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2426         on deleted opd entries.
2427
2428 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2429
2430         * tilegx.cc: New file.
2431         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2432         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2433         * configure.tgt: Add entries for tilegx*.
2434         * configure.ac: Likewise.
2435         * Makefile.in: Rebuild.
2436         * configure: Likewise.
2437         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2438         tilegx.
2439
2440 2012-09-13  Alan Modra  <amodra@gmail.com>
2441
2442         * target-reloc.h (scan_relocs): Call scan.local for relocs
2443         against symbols in discarded sections.  Pass is_discarded
2444         param.
2445         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2446         Add is_discarded param.
2447         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2448         is_discarded to flag opd entry as discarded.  Don't emit dyn
2449         relocs on such entries.
2450         (Target_powerpc::Scan::global): Similarly detect and handle
2451         such opd entries.
2452         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2453         opd_ent_.  Update all uses.
2454         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2455         (Target_powerpc::relocate_section): Zero out discarded opd
2456         entry relocs.
2457
2458 2012-09-12  Ian Lance Taylor  <iant@google.com>
2459
2460         PR gold/14570
2461         * output.cc: Rename Output_data_got template parameter from size
2462         to got_size for all functions.  Compile all variants of
2463         Output_data_got.
2464         (Output_data_got::Got_entry::write): Correct use of size for
2465         symbol value.  Use local_is_tls rather than casting to
2466         Sized_relobj_file.
2467         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2468         (class Sized_relobj_file): Add do_local_is_tls.
2469         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2470
2471 2012-09-11  Alan Modra  <amodra@gmail.com>
2472
2473         PR gold/14566
2474         * layout.cc (Layout::set_segment_offsets): When using
2475         common-page-size alignment, ensure we are on a new max-page-size
2476         page.
2477         * output.cc (Output_segment::set_section_addresses): Use
2478         abi_pagesize, not common_pagesize for relro boundary.
2479         (Output_segment::set_offset): Likewise.
2480
2481 2012-09-11  Alan Modra  <amodra@gmail.com>
2482
2483         * output.h (Output_data_got::add_global_tls, add_local_tls,
2484         add_local_tls_pair): New functions.
2485         (Output_data_got::add_local_pair_with_rel): Remove second
2486         reloc param.  Expand comment.
2487         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2488         use_plt_or_tls_offset_, similarly for constructor param.
2489         (Output_data_got::Got_entry::write): Add got_index param.
2490         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2491         add_local_tls_pair): New functions.
2492         (Output_data_got::Got_entry::write): Handle tls symbols
2493         with use_plt_or_tls_offset_ set specially.
2494         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2495         (Output_data_got::do_write): Replace iterator with index, pass
2496         index to entry write function.
2497         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2498         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2499         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2500         call.
2501         * i386.cc (Target_i386::Scan::local): Likewise.
2502         * sparc.cc (Target_sparc::Scan::local): Likewise.
2503         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2504         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2505         do_tls_offset_for_global): New functions.
2506         (Target_powerpc::Scan::local): Correct TLS relocations and got
2507         entry values.
2508         (Target_powerpc::Scan::global): Don't emit unnecessary
2509         dynamic relocations on TLS GOT entries.
2510
2511 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2512
2513         * config.in: Disable sanity check for kfreebsd.
2514
2515 2012-09-10  Sterling Augustine  <saugustine@google.com>
2516
2517         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2518         (Gdb_index::pubtypes_read): New parameter.
2519         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2520         to calls.
2521         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2522         pubtypes_object_.
2523
2524 2012-09-09  Alan Modra  <amodra@gmail.com>
2525
2526         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2527         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2528         * gc.h (gc_process_relocs): Call target gc_add_reference.
2529         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2530         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2531         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2532         unnecessary cast.
2533         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2534         to cater for when we don't need code offset.  Update use.
2535         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2536         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2537         set_opd_valid): New functions.
2538         (Target_powerpc::do_gc_add_reference): New function.
2539         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2540         stashed refs.
2541         (Target_powerpc::do_gc_mark_symbol): New function.
2542
2543 2012-09-06  Cary Coutant  <ccoutant@google.com>
2544
2545         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2546         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2547         (Dwarf_die::skip_attributes): Likewise.
2548         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2549         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2550         (main): Call it.
2551         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2552
2553 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2554
2555         * testsuite/script_test_3.t: Add .got.plt output section
2556         statement.
2557         * testsuite/script_test_4.t: Likewise.
2558
2559 2012-09-05  Alan Modra  <amodra@gmail.com>
2560
2561         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2562         update all uses and lose "enum" when using type.
2563
2564 2012-09-05  Alan Modra  <amodra@gmail.com>
2565
2566         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2567         * configure: Regenerate.
2568         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2569         (plugin_final_layout.stdout): Likewise.
2570         (memory_test): Set page sizes to 0x1000.
2571         * testsuite/Makefile.in: Regenerate.
2572         * testsuite/discard_locals_test.sh: Add FIXME comment.
2573         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2574         * testsuite/pr14265.t: Add .got output section statement.
2575         * testsuite/script_test_2.t: Likewise.
2576         * testsuite/script_test_3.t: Likewise.
2577         * testsuite/script_test_4.t: Likewise.
2578         * testsuite/script_test_5.t: Likewise.
2579         * testsuite/script_test_6.t: Likewise.
2580         * testsuite/script_test_7.t: Likewise.
2581         * testsuite/script_test_9.t: Likewise.
2582
2583 2012-09-05  Alan Modra  <amodra@gmail.com>
2584
2585         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2586         (Powerpc_relocate_functions::Status): New typedef.
2587         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2588         (Target_powerpc::Scan::local): Handle REL64.
2589         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2590         for REL32 and REL64.
2591         (Target_powerpc::symval_for_branch): New function, extracted from..
2592         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2593         checks.  Report overflow errors.
2594
2595 2012-09-05  Alan Modra  <amodra@gmail.com>
2596
2597         * object.h (Sized_relobj_file::emit_relocs): Delete.
2598         (Sized_relobj_file::emit_relocs_reltype): Delete.
2599         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2600         relocate_relocs for --emit-relocs.
2601         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2602         * output.h: Update comment.
2603         (Output_segment::first_section): New function.
2604         (Output_segment::first_section_load_address): Use first_section.
2605         * output.cc (Output_segment::first_section): New function extracted..
2606         (Output_segment::first_section_load_address): ..from here.  Delete.
2607         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2608         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2609         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2610         adjust call to target.h function.
2611         * i386.cc (Target_i386): Likewise.
2612         * sparc.cc (Target_sparc): Likewise.
2613         * x86_64.cc (Target_x86_64): Likewise.
2614         * powerpc.cc (Target_powerpc): Likewise.
2615         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2616         first tls section has section symbol for optimised local dynamic
2617         output relocs.
2618         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2619         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2620         optimised tls code.
2621         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2622         Rename to relocate_relocs.  Update error message.
2623
2624 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2625
2626         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2627         --just-symbols.
2628
2629 2012-08-31  Alan Modra  <amodra@gmail.com>
2630
2631         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2632         (Powerpc_relobj::toc_base_offset): New stub function.
2633         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2634         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2635         (Target_powerpc::Relocate::enum skip_tls): New.
2636         (Target_powerpc::call_tls_get_addr_): New var.
2637         (Target_powerpc::is_branch_reloc): Move to file scope.
2638         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2639         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2640         New functions.
2641         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2642         (powerpc_info): Correct common_pagesize for ppc64.
2643         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2644         (Powerpc_relocate_functions): Add overflow check enums and functions.
2645         Add non-shift version of rela, rela_ua.  Delete all rel public
2646         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2647         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2648         addr16_ha3, addr14 functions.
2649         (Output_data_got_powerpc::add_constant_pair): New function.
2650         (Output_data_got_powerpc::got_base_offset): Likewise.
2651         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2652         (instruction constants): Sort, add some more.
2653         (Output_data_glink::do_write): Add and use Address typedef.  Use
2654         object->toc_base_offset() stub for 64-bit.
2655         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2656         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2657         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2658         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2659         Always treat .opd relocs as against locally defined symbol.
2660         Correct condition for RELATIVE relocs.
2661         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2662         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2663         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2664         calculations.  Handle TLS relocs, and more.  Add overflow
2665         checking and adjust for Powerpc_relocate_functions changes.
2666         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2667         Reinstate --emit-relocs code with FIXME.
2668
2669 2012-08-30  Alan Modra  <amodra@gmail.com>
2670
2671         * layout.cc (Layout::set_segment_offsets): Set p_align to
2672         abi_pagesize, not common_pagesize.
2673         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2674         to determine whether file header can go in segment.
2675
2676 2012-08-30  Alan Modra  <amodra@gmail.com>
2677
2678         * output.h (Output_reloc::Output_reloc <output section>): Add
2679         is_relative param.  Adjust calls.
2680         (Output_reloc::add_output_section_relative): New functions.
2681         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2682         is_relative.
2683         (Output_reloc::symbol_value): Handle SECTION_CODE.
2684
2685 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2686
2687         * gold.cc (queue_middle_tasks): Call layout again when unique
2688         segments for sections is desired.
2689         * layout.cc (Layout::Layout): Initialize new members.
2690         (Layout::get_output_section_flags): New function.
2691         (Layout::choose_output_section): Call get_output_section_flags.
2692         (Layout::layout): Make output section for mapping to a unique segment.
2693         (Layout::insert_section_segment_map): New function.
2694         (Layout::attach_allocated_section_to_segment): Make unique segment for
2695         output sections marked so.
2696         (Layout::segment_precedes): Check for unique segments when sorting.
2697         * layout.h (Layout::Unique_segment_info): New struct.
2698         (Layout::Section_segment_map): New typedef.
2699         (Layout::insert_section_segment_map): New function.
2700         (Layout::get_output_section_flags): New function.
2701         (Layout::is_unique_segment_for_sections_specified): New function.
2702         (Layout::set_unique_segment_for_sections_specified): New function.
2703         (Layout::unique_segment_for_sections_specified_): New member.
2704         (Layout::section_segment_map_): New member.
2705         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2706         Rename is_gc_pass_one to is_pass_one.
2707         Rename is_gc_pass_two to is_pass_two.
2708         Rename is_gc_or_icf to is_two_pass.
2709         Check for which pass based on whether symbols data is present.
2710         Make it two pass when unique segments for sections is desired.
2711         * output.cc (Output_section::Output_section): Initialize new
2712         members.
2713         * output.h (Output_section::is_unique_segment): New function.
2714         (Output_section::set_is_unique_segment): New function.
2715         (Output_section::is_unique_segment_): New member.
2716         (Output_section::extra_segment_flags): New function.
2717         (Output_section::set_extra_segment_flags): New function.
2718         (Output_section::extra_segment_flags_): New member.
2719         (Output_section::segment_alignment): New function.
2720         (Output_section::set_segment_alignment): New function.
2721         (Output_section::segment_alignment_): New member.
2722         (Output_segment::Output_segment): Initialize is_unique_segment_.
2723         (Output_segment::is_unique_segment): New function.
2724         (Output_segment::set_is_unique_segment): New function.
2725         (Output_segment::is_unique_segment_): New member.
2726         * plugin.cc (allow_unique_segment_for_sections): New function.
2727         (unique_segment_for_sections): New function.
2728         (Plugin::load): Add new functions to transfer vector.
2729         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2730         * Makefile.in: Regenerate.
2731         * testsuite/plugin_final_layout.sh: Check if unique segment
2732         functionality works.
2733         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2734         are available.
2735         (allow_unique_segment_for_sections): New global.
2736         (unique_segment_for_sections): New global.
2737         (claim_file_hook): Call allow_unique_segment_for_sections.
2738         (all_symbols_read_hook): Call unique_segment_for_sections.
2739
2740 2012-08-22  Cary Coutant  <ccoutant@google.com>
2741
2742         * layout.cc (Layout::include_section): Don't assert on GROUP
2743         sections with --emit-relocs.
2744
2745 2012-08-21  Cary Coutant  <ccoutant@google.com>
2746
2747         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2748         if --export-dynamic-symbol names an undef symbol.
2749
2750 2012-08-18  Alan Modra  <amodra@gmail.com>
2751
2752         * powerpc.cc: Formatting and white space.
2753         (Powerpc_relobj): Rename got2_section_ to special_.
2754         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2755         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2756         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2757         (Target_powerpc): Add Address typedef and invalid_address.  Use
2758         throughout.
2759         (Target_powerpc::is_branch_reloc): New function.
2760         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2761         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2762         for dst_mask, value and addend.
2763         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2764         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2765         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2766         uint16_t for 24-bit offset.  Use get_output_section_offset and
2767         check return.
2768         (Target_powerpc::Scan::local): Handle more relocs.
2769         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2770         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2771         Plug in toc restoring insn after plt calls.  Translate branches
2772         to function descriptor symbols to corresponding entry point.
2773         (Target_powerpc::relocate_for_relocatable): Check return from
2774         get_output_section_offset.
2775         * symtab.h: Comment typo.
2776
2777 2012-08-14  Ian Lance Taylor  <iant@google.com>
2778
2779         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2780         unsupported_relocal_local to call unsupported_reloc_global.
2781
2782 2012-08-14  Nick Clifton  <nickc@redhat.com>
2783
2784         PR ld/14265
2785         * script-sections.cc (Sections_element::output_section_name): Add
2786         keep return parameter.
2787         (Output_section_element::match_name): Add keep return parameter.
2788         Return the value of the keep_ member.
2789         * script-sections.h (class Output_section): Update
2790         output_section_name prototype.
2791         * layout.cc (Layout::keep_input_section): New public member
2792         function.
2793         (Layout::choose_output_section): Pass keep parameter to
2794         output_section_name.
2795         * layout.h (class Layout): Add keep_input_section.
2796         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2797         sections.
2798         * testsuite/Makefile.am: Add a test.
2799         * testsuite/Makefile.in: Regenerate.
2800         * testsuite/pr14265.c: Source file for the test.
2801         * testsuite/pr14265.t: Linker script for the test.
2802         * testsuite/pr14265.sh: Shell script for the test.
2803
2804 2012-08-14  Alan Modra  <amodra@gmail.com>
2805
2806         * target.h (Target::output_section_name): New function.
2807         (Target::do_output_section_name): New function.
2808         * layout.cc (Layout::choose_output_section): Call the above.
2809         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2810
2811 2012-08-14  Alan Modra  <amodra@gmail.com>
2812
2813         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2814         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2815         for replace_constant call.
2816         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2817         (Output_data_glink::do_print_to_mapfile): New function.
2818         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2819         (Target_powerpc::Relocate::relocate): Likewise.
2820
2821 2012-08-14  Alan Modra  <amodra@gmail.com>
2822
2823         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2824         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2825         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2826         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2827         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2828         here.
2829         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2830         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2831         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2832         here.
2833         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2834         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2835
2836 2012-08-12  Alan Modra  <amodra@gmail.com>
2837
2838         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2839         (glink insn constants): Use uint32_t.
2840         (Output_data_glink::add_entry): Use insert, not [] operator.
2841
2842 2012-08-11  Alan Modra  <amodra@gmail.com>
2843
2844         * object.h (Sized_relobj_file::find_shdr): New function.
2845         (Sized_relobj_file::find_special_sections): New function.
2846         * object.cc (Sized_relobj_file::find_shdr): New function.
2847         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2848         (Sized_relobj_file::find_special_sections): New function, split out..
2849         (Sized_relobj_file::do_read_symbols): ..from here.
2850         * output.h (Output_data_got::replace_constant): New function.
2851         (Output_data_got::num_entries): New function.
2852         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2853         (Output_data_got::got_offset): Protected rather than private.
2854         (Output_data_got::replace_got_entry): New function.
2855         * output.cc (Output_data_got::replace_got_entry): New function.
2856         * powerpc.cc (class Powerpc_relobj): New.
2857         (class Powerpc_relocate_functions): Delete all psymval variants or
2858         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2859         Implement _ha functions using corresponding _hi function.
2860         (Powerpc_relobj::find_special_sections): New function.
2861         (Target_powerpc::do_make_elf_object): New function.
2862         (class Output_data_got_powerpc): New.
2863         (class Output_data_glink): New.
2864         (class Powerpc_scan_relocatable_reloc): New.
2865         Many more changes througout file.
2866
2867 2012-08-09  Nick Clifton  <nickc@redhat.com>
2868
2869         * po/vi.po: Updated Vietnamese translation.
2870
2871 2012-08-07  Ian Lance Taylor  <iant@google.com>
2872
2873         * layout.cc (Layout::add_target_dynamic_tags): If
2874         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2875         plt_rel.
2876
2877 2012-07-30  Nick Clifton  <nickc@redhat.com>
2878
2879         * po/gold.pot: Updated template.
2880         * po/es.po: Updated Spanish translation.
2881
2882 2012-07-18  Cary Coutant  <ccoutant@google.com>
2883
2884         PR gold/14344
2885         * configure.ac: Add check for -gpubnames support.
2886         * configure: Regenerate.
2887         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2888         support; force -gno-pubnames.
2889         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2890         support.
2891         (gdb_index_test_4): New test.
2892         * testsuite/Makefile.in: Regenerate.
2893         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2894         * testsuite/gdb_index_test_2.sh: Likewise.
2895         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2896         * testsuite/gdb_index_test_4.sh: New script.
2897         * testsuite/gdb_index_test_comm.sh: New script with common code;
2898         don't look for space after colon.
2899
2900 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2901
2902         * gold.cc (queue_middle_tasks): Update function order only after
2903         deferred objects due to plugins are processed.
2904
2905 2012-07-11  Ian Lance Taylor  <iant@google.com>
2906
2907         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2908         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2909         (Target_arm::scan_reloc_for_stub): Likewise.
2910         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2911         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2912         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2913         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2914         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2915
2916 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2917             Ian Lance Taylor  <iant@google.com>
2918
2919         PR gold/14309
2920         * configure.ac: Test whether std::tr1::hash<off_t> works.
2921         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2922         needed.
2923         * output.h (class Output_fill): Add virtual destructor.
2924         * configure, config.in: Rebuild.
2925
2926 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2927
2928         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2929
2930 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2931
2932         * plugin.cc (Plugin::load): Handle position independent executables.
2933
2934 2012-06-06  Cary Coutant  <ccoutant@google.com>
2935
2936         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2937         add .debug_macro.
2938         (lines_only_debug_sections): Likewise.
2939         (gdb_fast_lookup_sections): New static array.
2940         (is_gdb_debug_section): Rename formal parameter.
2941         (is_lines_only_debug_section): Likewise.
2942         (is_gdb_fast_lookup_section): New function.
2943         (Layout::include_section): Check for ".zdebug_" prefix; pass
2944         section name suffix to is_gdb_debug_section, et al.; check for
2945         fast-lookup sections when building .gdb_index.
2946         * options.h (--strip-debug-gdb): Update GDB version number.
2947
2948 2012-06-06  Cary Coutant  <ccoutant@google.com>
2949
2950         * configure.ac: Add check for fallocate.
2951         * configure: Regenerate.
2952         * config.in: Regenerate.
2953
2954         * options.h (class General_options): Add --mmap-output-file and
2955         --posix-fallocate options.
2956         * output.cc: (posix_fallocate): Remove; replace with...
2957         (gold_fallocate): New function.
2958         (Output_file::map_no_anonymous): Call gold_fallocate.
2959         (Output_file::map): Check --mmap-output-file option.
2960
2961 2012-06-05  Jing Yu  <jingyu@google.com>
2962
2963         * gold.h (textdomain): Add do {} to empty while(0).
2964         (bindtextdomain): Likewise.
2965
2966 2012-06-04  Cary Coutant  <ccoutant@google.com>
2967
2968         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2969         has_dynsym_index.
2970
2971 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2972
2973         * symtab.cc (Symbol_table::define_special_symbol):
2974         Initialize *poldsym to prevent uninitialized variable errors.
2975
2976 2012-05-23  Cary Coutant  <ccoutant@google.com>
2977
2978         * layout.cc (Layout::section_name_mapping): Add rules to handle
2979         exact match on .data.rel.ro.local or .data.rel.ro.
2980         (Layout::output_section_name): Check for exact matches.
2981
2982 2012-05-23  Cary Coutant  <ccoutant@google.com>
2983
2984         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2985         more carefully.
2986
2987 2012-05-22  Cary Coutant  <ccoutant@google.com>
2988
2989         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2990         object before exporting symbol.
2991
2992 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2993
2994         * testsuite/tls_test.cc: Include "config.h" first.
2995         * testsuite/tls_test_c.c: Likewise.
2996
2997 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2998             Nick Clifton  <nickc@redhat.com>
2999
3000         PR 14072
3001         * configure.in: Add check that sysdep.h has been included before
3002         any system header files.
3003         * configure: Regenerate.
3004         * config.in: Regenerate.
3005
3006 2012-05-14  Cary Coutant  <ccoutant@google.com>
3007
3008         * layout.cc (Layout::make_output_section): Mark .tdata section
3009         as RELRO.
3010         * testsuite/relro_test.cc: Add a TLS variable.
3011
3012 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3013
3014         PR gold/14091
3015         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3016         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3017         R_X86_64_64.
3018
3019 2012-05-08  Cary Coutant  <ccoutant@google.com>
3020
3021         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3022         (lines_only_debug_sections): Likewise.
3023
3024 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3025
3026         * nacl.cc: New file.
3027         * nacl.h: New file.
3028         * Makefile.am (CCFILES, HFILES): Add them.
3029         * Makefile.in: Regenerate.
3030         * i386.cc (Output_data_plt_i386_nacl): New class.
3031         (Output_data_plt_i386_nacl_exec): New class.
3032         (Output_data_plt_i386_nacl_dyn): New class.
3033         (Target_i386_nacl): New class.
3034         (Target_selector_i386_nacl): New class.
3035         (target_selector_i386): Use it instead of Target_selector_i386.
3036         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3037         (Target_x86_64_nacl): New class.
3038         (Target_selector_x86_64_nacl): New class.
3039         (target_selector_x86_64, target_selector_x32): Use it instead of
3040         Target_selector_x86_64.
3041         * arm.cc (Output_data_plt_arm_nacl): New class.
3042         (Target_arm_nacl): New class.
3043         (Target_selector_arm_nacl): New class.
3044         (target_selector_arm, target_selector_armbe): Use it instead of
3045         Target_selector_arm.
3046
3047         * target-select.cc (select_target): Take new Input_file* and off_t
3048         arguments, pass them on to recognize method of selector.
3049         * object.cc (make_elf_sized_object): Update caller.
3050         * parameters.cc (parameters_force_valid_target): Likewise.
3051         * incremental.cc (make_sized_incremental_binary): Likewise.
3052         * target-select.h: Update decl.
3053         (Target_selector::recognize): Take new Input_file* argument,
3054         pass it on to do_recognize.
3055         (Target_selector::do_recognize): Take new Input_file* argument.
3056         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3057         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3058         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3059         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3060
3061         * target.h (Target::Target_info): New members isolate_execinstr
3062         and rosegment_gap.
3063         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3064         * arm.cc (Target_arm::arm_info): Update initializer.
3065         * i386.cc (Target_i386::i386_info): Likewise.
3066         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3067         * sparc.cc (Target_sparc::sparc_info): Likewise.
3068         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3069         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3070         * layout.cc (Layout::attach_allocated_section_to_segment):
3071         Take new const Target* argument.  If target->isolate_execinstr(), act
3072         like --rosegment.
3073         (Layout::find_first_load_seg): Take new const Target* argument;
3074         if target->isolate_execinstr(), reject PF_X segments.
3075         (Layout::relaxation_loop_body): Update caller.
3076         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3077         reset file offset to zero when we hit LOAD_SEG, and then do a second
3078         loop over the segments before LOAD_SEG to reassign offsets after
3079         addresses have been determined.  Handle target->rosegment_gap().
3080         (Layout::attach_section_to_segment): Take new const Target* argument;
3081         pass it to attach_allocated_section_to_segment.
3082         (Layout::make_output_section): Update caller.
3083         (Layout::attach_sections_to_segments): Take new const Target* argument;
3084         pass it to attach_section_to_segment.
3085         * gold.cc (queue_middle_tasks): Update caller.
3086         * layout.h (Layout): Update method decls with new arguments.
3087
3088         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3089         Target_info pointer to use.
3090         (Target_arm::do_make_data_plt): New virtual method.
3091         (Target_arm::make_data_plt): New method that calls it.
3092         (Target_arm::make_plt_entry): Use it.
3093         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3094         for the section alignment.
3095         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3096         method.
3097         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3098         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3099         method.
3100         (Output_data_plt_arm::get_plt_entry_size): Call it.
3101         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3102         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3103         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3104         method.
3105         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3106         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3107         method instead of sizeof(plt_entry).
3108         (Output_data_plt_arm::add_entry): Likewise.
3109         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3110         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3111         than static method.
3112         (Target_arm::plt_entry_size): Likewise.
3113         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3114         Move to ...
3115         (Output_data_plt_arm_standard): ... here, new class.
3116         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3117         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3118         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3119
3120         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3121         Take additional argument for the PLT entry size.
3122         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3123         Use get_plt_entry_size method rather than plt_entry_size variable.
3124         (Output_data_plt_x86_64::reserve_slot): Likewise.
3125         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3126         (Output_data_plt_x86_64::add_entry): Likewise.
3127         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3128         (Output_data_plt_x86_64::address_for_global): Likewise.
3129         (Output_data_plt_x86_64::address_for_local): Likewise.
3130         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3131         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3132         Make method non-static.
3133         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3134         method.
3135         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3136         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3137         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3138         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3139         virtual method.
3140         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3141         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3142         virtual method.
3143         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3144         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3145         virtual method.
3146         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3147         (Output_data_plt_x86_64::plt_entry_size)
3148         (Output_data_plt_x86_64::first_plt_entry)
3149         (Output_data_plt_x86_64::plt_entry)
3150         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3151         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3152         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3153         (Output_data_plt_x86_64_standard): ... here, new class.
3154         (Target_x86_64::Target_x86_64): Take optional argument for the
3155         Target_info pointer to use.
3156         (Target_x86_64::do_make_data_plt): New virtual method.
3157         (Target_x86_64::make_data_plt): New method to call it.
3158         (Target_x86_64::init_got_plt_for_update): Use that.
3159         Call this->plt_->add_eh_frame method here.
3160         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3161         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3162         rather than static method.
3163         (Target_x86_64::plt_entry_size): Likewise.
3164         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3165         rather than plt_entry_size variable.  Move guts of PLT filling to...
3166         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3167         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3168         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3169
3170         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3171         additional argument for the section alignment.
3172         Don't do add_eh_frame_for_plt here.
3173         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3174         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3175         variable.
3176         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3177         method.
3178         (Output_data_plt_i386::get_plt_entry_size): Call it.
3179         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3180         (Output_data_plt_i386::add_eh_frame): New method to call it.
3181         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3182         method.
3183         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3184         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3185         method.
3186         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3187         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3188         method instead of plt_entry_size.
3189         (Output_data_plt_i386::plt_entry_size)
3190         (Output_data_plt_i386::plt_eh_frame_fde_size)
3191         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3192         (Output_data_plt_i386_standard): ... here, new class.
3193         (Output_data_plt_i386_exec): New class.
3194         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3195         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3196         (Output_data_plt_i386::exec_plt_entry): Move to ...
3197         (Output_data_plt_i386_exec::plt_entry): ... here.
3198         (Output_data_plt_i386_dyn): New class.
3199         (Output_data_plt_i386::first_plt_entry): Move to ...
3200         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3201         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3202         (Output_data_plt_i386_dyn::plt_entry): ... here.
3203         (Target_i386::Target_i386): Take optional argument for the Target_info
3204         pointer to use.
3205         (Target_i386::do_make_data_plt): New virtual method.
3206         (Target_i386::make_data_plt): New method to call it.
3207         (Target_i386::make_plt_section): Use that.
3208         Call this->plt_->add_eh_frame method here.
3209         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3210         rather than plt_entry_size variable.
3211         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3212         (Output_data_plt_i386::address_for_local): Likewise.
3213         (Output_data_plt_i386::do_write): Likewise.
3214         Move guts of PLT filling to...
3215         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3216         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3217         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3218         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3219
3220 2012-05-01  Cary Coutant  <ccoutant@google.com>
3221
3222         * dwarf_reader.cc (Dwarf_die::read_attributes)
3223         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3224         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3225         * reduced_debug_output.cc
3226         (Output_reduced_debug_info_section::get_die_end): Remove
3227         DW_FORM_GNU_ref_index.  Add default case.
3228
3229 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3230
3231         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3232         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3233         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3234         DW_AT_high_pc as offset from DW_AT_low_pc.
3235
3236         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3237         * testsuite/Makefile.in: Regenerate.
3238         * testsuite/gdb_index_test_3.c: New test source file.
3239         * testsuite/gdb_index_test_3.sh: New test source file.
3240
3241 2012-04-25  Ian Lance Taylor  <iant@google.com>
3242
3243         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3244         pointer.
3245         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3246         as a class, not a struct.
3247         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3248         (Target_arm::apply_cortex_a8_workaround): Likewise.
3249         * gc.h: Declare Reloc_types as a struct, not a class.
3250         * object.h: Declare Symbols_data as a struct.
3251         * reloc.h: Declare Read_relocs_data as a struct.
3252         * target.h: Declare Relocate_info as a struct.
3253
3254 2012-04-24  David S. Miller  <davem@davemloft.net>
3255
3256         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3257         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3258         and R_SPARC_WPLT30.
3259
3260 2012-04-24  Cary Coutant  <ccoutant@google.com>
3261
3262         * incremental-dump.cc (find_input_containing_global): Replace
3263         magic number with symbolic constant.
3264         (dump_incremental_inputs): Update version number.
3265         * incremental.cc (Output_section_incremental_inputs): Update version
3266         number; import symbolic constants from Incremental_inputs_reader.
3267         (Incremental_inputs::create_data_sections): Align relocations
3268         section correctly for 64-bit targets.
3269         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3270         constants; add padding.
3271         (Output_section_incremental_inputs::write_header): Add assert for
3272         header_size.
3273         (Output_section_incremental_inputs::write_input_files): Add assert
3274         for input_entry_size.
3275         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3276         add assert for object_info_size, input_section_entry_size,
3277         global_sym_entry_size.
3278         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3279         for data structure sizes; use them.
3280         (Incremental_input_entry_reader): Import symbolic constants from
3281         Incremental_inputs_reader; use them.
3282
3283 2012-04-23  David S. Miller  <davem@davemloft.net>
3284
3285         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3286         and elf_flags_set_.
3287         (Target_sparc::Target_sparc): Initialize new fields.
3288         (Target_sparc::do_make_elf_object): New function.
3289         (Target_sparc::do_adjust_elf_header): New function.
3290
3291 2012-04-23  Cary Coutant  <ccoutant@google.com>
3292
3293         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3294         CU range table of gdb index.
3295
3296 2012-04-20  David S. Miller  <davem@davemloft.net>
3297
3298         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3299         instead of false.
3300
3301 2012-04-16  David S. Miller  <davem@davemloft.net>
3302
3303         * sparc.cc (Target_sparc::got_address): New function.
3304         (Sparc_relocate_functions::gdop_hix22): New function.
3305         (Sparc_relocate_functions::gdop_lox10): New function.
3306         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3307         relocs.
3308         (Target_sparc::Scan::local): Likewise if the global symbol is not
3309         preemptible and is not IFUNC.
3310         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3311         transformations for local and non-preemptible non-IFUNC global
3312         symbols.
3313
3314         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3315         writing out 64-bit part of ranges.
3316
3317         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3318         -fpic and -fpie respectively.
3319         * Makefile.in: Regenerate.
3320
3321         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3322         (Target_sparc::Target_sparc): Initialize new field.
3323         (Target_sparc::do_plt_section_for_global): New function.
3324         (Target_sparc::do_plt_section_for_local): New function.
3325         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3326         (Target_sparc::make_plt_section): New function, broken out of
3327         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3328         (Target_sparc::make_plt_entry): Call make_plt_section.
3329         (Target_sparc::make_local_ifunc_plt_entry): New function.
3330         (Target_sparc::rela_ifunc_section): New function.
3331         (Target_sparc::plt_section): Remove const.
3332         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3333         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3334         and ifunc_count_ fields.
3335         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3336         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3337         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3338         (Output_data_plt_sparc::rela_ifunc): New function.
3339         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3340         (Output_data_plt_sparc::has_ifunc_section): New function.
3341         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3342         (Output_data_plt_sparc::address_for_global): New function.
3343         (Output_data_plt_sparc::address_for_local): New function.
3344         (Output_data_plt_sparc::plt_index_to_offset): New function.
3345         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3346         and entry_count.
3347         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3348         entry_count.
3349         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3350         R_SPARC_JMP_IREL to switch.
3351         (Target_sparc::Scan::check_non_pic): Likewise.
3352         (Target_sparc::Scan::local): Handle IFUNC symbols.
3353         (Target_sparc::Scan::local): Likewise.
3354         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3355         and plt_address_for_local.
3356         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3357         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3358
3359         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3360         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3361         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3362         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3363         global relocs too.
3364         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3365         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3366         calls.
3367         * sparc.cc (Target_sparc::Scan::global): Likewise.
3368         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3369
3370 2012-04-16  Cary Coutant  <ccoutant@google.com>
3371
3372         * archive.cc (Library_base::should_include_member): Check for
3373         --export-dynamic-symbol.
3374         * options.h (class General_options): Add --export-dynamic-symbol.
3375         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3376         --export-dynamic-symbol.
3377         (Symbol_table::gc_mark_undef_symbols): Likewise.
3378         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3379
3380 2012-04-12  David S. Miller  <davem@davemloft.net>
3381
3382         * sparc.cc (Reloc::wdisp10): New relocation method.
3383         (Reloc::h34): Likewise.
3384         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3385         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3386         R_SPARC_WDISP10.
3387         (Target_sparc::Scan::local): Likewise.
3388         (Target_sparc::Scan::global): Likewise.
3389         (Target_sparc::Relocate::relocate): Likewise.
3390
3391 2012-04-09  Cary Coutant  <ccoutant@google.com>
3392
3393         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3394         low_pc == 0.
3395
3396 2012-04-06  Ian Lance Taylor  <iant@google.com>
3397
3398         * timer.cc: #include <unistd.h>.
3399
3400 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3401
3402         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3403         * config.in: Regenerate.
3404         * configure: Regenerate.
3405
3406 2012-04-05  Nick Clifton  <nickc@redhat.com>
3407
3408         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3409         (AM_LC_MESSAGES): Add.
3410         * aclocal.m4: Regenerate.
3411         * config.in: Regenerate.
3412         * configure: Regenerate.
3413
3414 2012-03-21  Cary Coutant  <ccoutant@google.com>
3415
3416         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3417         * Makefile.in: Regenerate.
3418         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3419         (Sized_elf_reloc_mapper::symbol_section): New function.
3420         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3421         (make_elf_reloc_mapper): New function.
3422         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3423         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3424         (Dwarf_abbrev_table::do_get_abbrev): New function.
3425         (Dwarf_ranges_table::read_ranges_table): New function.
3426         (Dwarf_ranges_table::read_range_list): New function.
3427         (Dwarf_pubnames_table::read_section): New function.
3428         (Dwarf_pubnames_table::read_header): New function.
3429         (Dwarf_pubnames_table::next_name): New function.
3430         (Dwarf_die::Dwarf_die): New function.
3431         (Dwarf_die::read_attributes): New function.
3432         (Dwarf_die::skip_attributes): New function.
3433         (Dwarf_die::set_name): New function.
3434         (Dwarf_die::set_linkage_name): New function.
3435         (Dwarf_die::attribute): New function.
3436         (Dwarf_die::string_attribute): New function.
3437         (Dwarf_die::int_attribute): New function.
3438         (Dwarf_die::uint_attribute): New function.
3439         (Dwarf_die::ref_attribute): New function.
3440         (Dwarf_die::child_offset): New function.
3441         (Dwarf_die::sibling_offset): New function.
3442         (Dwarf_info_reader::check_buffer): New function.
3443         (Dwarf_info_reader::parse): New function.
3444         (Dwarf_info_reader::do_parse): New function.
3445         (Dwarf_info_reader::do_read_string_table): New function.
3446         (Dwarf_info_reader::lookup_reloc): New function.
3447         (Dwarf_info_reader::get_string): New function.
3448         (Dwarf_info_reader::visit_compilation_unit): New function.
3449         (Dwarf_info_reader::visit_type_unit): New function.
3450         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3451         Sized_elf_reloc_mapper.
3452         (Sized_dwarf_line_info::symbol_section): Remove function.
3453         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3454         (Sized_dwarf_line_info::read_line_mappings): Remove object
3455         parameter, adjust callers.
3456         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3457         * dwarf_reader.h: Include <sys/types.h>.
3458         (class Track_relocs): Remove forward declaration.
3459         (class Elf_reloc_mapper): New class.
3460         (class Sized_elf_reloc_mapper): New class.
3461         (class Dwarf_abbrev_table): New class.
3462         (class Dwarf_range_list): New class.
3463         (class Dwarf_ranges_table): New class.
3464         (class Dwarf_pubnames_table): New class.
3465         (class Dwarf_die): New class.
3466         (class Dwarf_info_reader): New class.
3467         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3468         (Sized_dwarf_line_info::symbol_section): Remove member function.
3469         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3470         base class.
3471         * gdb-index.cc: New source file.
3472         * gdb-index.h: New source file.
3473         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3474         and .debug_types sections, call Layout::add_to_gdb_index.
3475         (Sized_relobj_incr::do_section_name): Implement.
3476         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3477         return type; Implement.
3478         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3479         return type.
3480         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3481         parameter list and return type.
3482         (Sized_incr_dynobj::do_section_contents): Likewise.
3483         * layout.cc: Include gdb-index.h.
3484         (Layout::Layout): Initialize gdb_index_data_.
3485         (Layout::init_fixed_output_section): Check for .gdb_index section.
3486         (Layout::add_to_gdb_index): New function. Instantiate.
3487         * layout.h: Add forward declaration for class Gdb_index.
3488         (Layout::add_to_gdb_index): New member function.
3489         (Layout::gdb_index_data_): New data member.
3490         * main.cc: Include gdb-index.h.
3491         (main): Print statistics for gdb index.
3492         * object.cc (Object::section_contents): Move code into
3493         do_section_contents.
3494         (need_decompressed_section): Check for sections needed when building
3495         gdb index.
3496         (build_compressed_section_map): Likewise.
3497         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3498         gdb index.
3499         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3500         sections; call Layout::add_to_gdb_index.
3501         (Sized_relobj_file::do_decompressed_section_contents): Call
3502         do_section_contents directly.
3503         * object.h (Object::do_section_contents): Adjust parameter list and
3504         return type.
3505         (Object::do_decompressed_section_contents): Call do_section_contents
3506         directly.
3507         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3508         return type.
3509         * options.h (class General_options): Add --gdb-index option.
3510         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3511         list and return type.
3512         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3513         * reloc.h (Track_relocs::checkpoint): New function.
3514         (Track_relocs::reset): New function.
3515
3516         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3517         New test cases.
3518         * testsuite/Makefile.in: Regenerate.
3519         * testsuite/gdb_index_test.cc: New test source file.
3520         * testsuite/gdb_index_test_1.sh: New test source file.
3521         * testsuite/gdb_index_test_2.sh: New test source file.
3522
3523 2012-03-19  Doug Kwan  <dougkwan@google.com>
3524
3525         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3526         (Target_arm::do_finalize_sections): Remove code which defines
3527         __exidx_start and __exidx_end.  Make symbol table parameter
3528         anonymous as it is not used.
3529         * gold.cc (queue_middle_tasks): Call target hook to define any
3530         target-specific symbols.
3531         * target.h (Target::define_standard_symbols): New method.
3532         (Target::do_define_standard_symbols): Same.
3533         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3534         * testsuite/Makefile.in: Regenerate.
3535         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3536         and __exidx_end.
3537         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3538         relocations are generated for __exidx_start and __exidx_end.
3539
3540 2012-03-16  Doug Kwan  <dougkwan@google.com>
3541
3542         * testsuite/Makefile.am: Disable test initpri3b.
3543         * testsuite/Makefile.in: Regenerate.
3544
3545 2012-03-15  Doug Kwan  <dougkwan@google.com>
3546
3547         * arm.cc (Target_arm::got_section): Make .got section read-only
3548         if -z now is given.
3549
3550 2012-03-15  Ian Lance Taylor  <iant@google.com>
3551
3552         PR gold/13850
3553         * layout.cc (Layout::make_output_section): Correctly mark
3554         SHT_INIT_ARRAY, et. al., as relro.
3555
3556 2012-03-14  Doug Kwan  <dougkwan@google.com>
3557
3558         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3559         dynamic relocations for protected symbols in shared objects.
3560
3561 2012-03-13  Ian Lance Taylor  <iant@google.com>
3562
3563         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3564         keep the larger alignment.
3565
3566 2012-03-12  Cary Coutant  <ccoutant@google.com>
3567
3568         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3569         handling of DW_LNE_define_file.
3570
3571 2012-03-12  Cary Coutant  <ccoutant@google.com>
3572
3573         * reduced_debug_output.cc
3574         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3575         codes to switch.
3576
3577 2012-02-29  Cary Coutant  <ccoutant@google.com>
3578
3579         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3580
3581 2012-02-29  Cary Coutant  <ccoutant@google.com>
3582
3583         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3584         Call Object::decompressed_section_contents.
3585         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3586         New dtor.
3587         (Sized_dwarf_line_info::buffer_start_): New data member.
3588         * merge.cc (Output_merge_data::do_add_input_section): Call
3589         Object::decompressed_section_contents.
3590         (Output_merge_string::do_add_input_section): Likewise.
3591         * object.cc (need_decompressed_section): New function.
3592         (build_compressed_section_map): Decompress sections needed later.
3593         (Sized_relobj_file::do_decompressed_section_contents): New function.
3594         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3595         * object.h (Object::decompressed_section_contents): New function.
3596         (Object::discard_decompressed_sections): New function.
3597         (Object::do_decompressed_section_contents): New function.
3598         (Object::do_discard_decompressed_sections): New function.
3599         (Compressed_section_info): New type.
3600         (Compressed_section_map): Include decompressed section contents.
3601         (Sized_relobj_file::do_decompressed_section_contents): New function.
3602         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3603
3604 2012-02-16  Cary Coutant  <ccoutant@google.com>
3605
3606         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3607         * testsuite/Makefile.in: Regenerate.
3608
3609 2012-02-14  Cary Coutant  <ccoutant@google.com>
3610
3611         * options.cc (General_options::finalize): Disallow -pie and -static.
3612
3613 2012-02-03  Doug Kwan  <dougkwan@google.com>
3614
3615         * arm.cc (Arm_relocate_functions::abs8,
3616         Arm_relocate_functions::abs16): Use
3617         Bits::has_signed_unsigned_overflow32.
3618         (Arm_relocate_functions::thm_abs8): Correct range of
3619         overflow check.
3620         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3621         in assertions.
3622
3623 2012-02-02  Doug Kwan  <dougkwan@google.com>
3624
3625         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3626         position independent outputs, not just shared objects.
3627
3628 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3629
3630         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3631         * configure: Regenerated.
3632
3633 2012-01-27  Ian Lance Taylor  <iant@google.com>
3634
3635         * reloc.h (Bits): New class with static functions, copied from
3636         namespace utils in arm.cc.
3637         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3638         instead.
3639
3640 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3641
3642         * incremental.cc (write_info_blocks): Correct relocation offset.
3643
3644 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3645
3646         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3647         (Relocate::tls_gd_to_le): Likewise.
3648
3649 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3650
3651         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3652
3653 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3654
3655         * configure.ac: Check if -mcmodel=medium works.
3656         * configure: Regenerated.
3657
3658 2012-01-24  Cary Coutant  <ccoutant@google.com>
3659
3660         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3661         definition and ...
3662         (read_unsigned_LEB_128_x): ... this new function.
3663         (read_signed_LEB_128): Replaced with inline definition and ...
3664         (read_signed_LEB_128_x): ... this new function.
3665         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3666         (read_unsigned_LEB_128): Add inline definition.
3667         (read_signed_LEB_128_x): New function.
3668         (read_signed_LEB_128): Add inline definition.
3669         * testsuite/Makefile.am (leb128_unittest): New unit test.
3670         * testsuite/Makefile.in: Regenerate.
3671         * testsuite/leb128_unittest.cc: New unit test.
3672
3673 2012-01-23  Ian Lance Taylor  <iant@google.com>
3674
3675         PR gold/13617
3676         * i386.cc (Target_i386::do_code_fill): When using a jmp
3677         instruction, pad with nop instructions.
3678         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3679
3680 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3681
3682         * x86_64.cc (gc_process_relocs): Add typename on types used in
3683         template.
3684         (scan_relocs): Likewise.
3685         (relocate_section): Likewise.
3686         (apply_relocation): Likewise.
3687
3688 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3689
3690         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3691         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3692         under x32.
3693
3694 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3695
3696         * x86_64.cc: Initial support for x32.
3697
3698 2012-01-03  Cary Coutant  <ccoutant@google.com>
3699
3700         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3701         Use abstract base class for GOT.
3702         * gold/output.h (class Output_data_got_base): New abstract base class.
3703         (class Output_data_got): Derive from new base class, adjust ctors.
3704         (Output_data_got::reserve_slot): Make virtual; rename to
3705         do_reserve_slot; Adjust callers.
3706         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3707         pointer to abstract base class.
3708         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3709
3710 2011-12-18  Ian Lance Taylor  <iant@google.com>
3711
3712         * object.h (Relobj::local_symbol_value): New function.
3713         (Relobj::local_plt_offset): New function.
3714         (Relobj::local_has_got_offset): New function.
3715         (Relobj::local_got_offset): New function.
3716         (Relobj::set_local_got_offset): New function.
3717         (Relobj::do_local_symbol_value): New pure virtual function.
3718         (Relobj::do_local_plt_offset): Likewise.
3719         (Relobj::do_local_has_got_offset): Likewise.
3720         (Relobj::do_local_got_offset): Likewise.
3721         (Relobj::do_set_local_got_offset): Likewise.
3722         (Sized_relobj::do_local_has_got_offset): Rename from
3723         local_has_got_offset.
3724         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3725         (Sized_relobj::do_set_local_got_offset): Rename from
3726         set_local_got_offset.
3727         (Sized_relobj_file::do_local_plt_offset): Rename from
3728         local_plt_offset.
3729         (Sized_relobj_file::do_local_symbol_value): New function.
3730         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3731         local_plt_offset.
3732         * output.cc (Output_data_got::Got_entry::write): Change object to
3733         Relobj.  Use local_symbol_value.
3734         (Output_data_got::add_global_with_rel): Change rel_dyn to
3735         Output_data_reloc_generic*.  Use add_global_generic.
3736         (Output_data_got::add_global_with_rela): Remove.  Change all
3737         callers to use add_global_with_rel.
3738         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3739         Output_data_reloc_generic*.  Use add_global_generic.
3740         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3741         callers to use add_global_pair_with_rel.
3742         (Output_data_got::add_local): Change object to Relobj*.
3743         (Output_data_got::add_local_plt): Likewise.
3744         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3745         change rel_dyn to Output_data_reloc_generic*.  Use
3746         add_local_generic.
3747         (Output_data_got::add_local_with_rela): Remove.  Change all
3748         callers to use all_local_with_rel.
3749         (Output_data_got::add_local_pair_with_rel): Change object to
3750         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3751         add_output_section_generic.
3752         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3753         callers to use add_local_pair_with_rel.
3754         (Output_data_got::reserve_local): Change object to Relobj*.
3755         * output.h: (class Output_data_reloc_generic): Add pure virtual
3756         declarations for add_global_generic, add_local_generic,
3757         add_output_section_generic.
3758         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3759         functions for Output_data_reloc_generic.  Update declarations for
3760         changes listed in output.cc.
3761         (class Output_data_got): Change template parameter to got_size.
3762         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3763         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3764         function.
3765         (Sized_relobj_incr::do_local_plt_offset): New function.
3766         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3767         add_global_generic.
3768
3769 2011-12-17  Cary Coutant  <ccoutant@google.com>
3770
3771         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3772         * resolve.cc (Symbol_table::resolve): Likewise.
3773         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3774         arrays.
3775         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3776
3777 2011-12-16  Ian Lance Taylor  <iant@google.com>
3778
3779         * output.h (Output_data_reloc_generic::add): Only call
3780         add_dynamic_reloc if this is a dynamic reloc section.
3781
3782 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3783
3784         PR gold/13505
3785         * target-reloc.h (apply_relocation): Replace <64, false> with
3786         <size, big_endian>.
3787
3788 2011-11-25  Nick Clifton  <nickc@redhat.com>
3789
3790         * po/it.po: New Italian translation.
3791
3792 2011-11-17  Sterling Augustine  <saugustine@google.com>
3793
3794         * script.cc (script_include_directive): Implement.
3795         (read_script_file): New local variables name and search_path. Update
3796         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3797         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3798         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3799
3800 2011-11-11  Sterling Augustine  <saugustine@google.com>
3801
3802         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3803         (file_or_sections_cmd): Likewise.
3804
3805 2011-11-11  Doug Kwan  <dougkwan@google.com>
3806
3807         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3808         if --just-symbols is given.
3809
3810 2011-11-10  Doug Kwan  <dougkwan@google.com>
3811
3812         PR gold/13362
3813         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3814         when processing data relocs.
3815         * reloc.h (Relocate_functions::rel_unaligned): New method.
3816         (Relocate_functions::pcrel_unaligned): Ditto.
3817         (Relocate_functions::rel32_unaligned): Ditto.
3818         (Relocate_functions::pcrel32_unaligned): Ditto.
3819
3820 2011-11-09  Doug Kwan  <dougkwan@google.com>
3821
3822         PR gold/13362
3823         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3824         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3825         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3826         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3827         (Relocate_functions::rel_unaligned): New.
3828         (Relocate_functions::rel32_unaligned): New.
3829         * target-reloc.h (relocate_for_relocatable): Add code to handle
3830         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3831         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3832         arm_unaligned_reloc_r): New targets.
3833         * testsuite/Makefile.in: Regenerate.
3834         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3835         linking.
3836
3837 2011-11-02  Ian Lance Taylor  <iant@google.com>
3838
3839         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3840         NATIVE_LINKER.
3841         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3842         * options.cc (General_options::finalize): Use library search path
3843         from configure script if specified.  If not native and no sysroot,
3844         only search TOOLLIBDIR.
3845         * options.h (Search_directory::Search_directory): Change name to
3846         const std::string&.
3847         (General_options::add_to_library_path_with_sysroot): Change arg to
3848         const std::string&.
3849         * configure, Makefile.in, config.in: Rebuild.
3850
3851 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3852
3853         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3854         we are working around the ARM1176 Erratum.
3855         * options.h (General_options::fix_arm1176): Add option.
3856         * testsuite/Makefile.am: Add testcases, and keep current ones
3857         working.
3858         * testsuite/Makefile.in: Regenerate.
3859         * testsuite/arm_fix_1176.s: New file.
3860         * testsuite/arm_fix_1176.sh: Likewise.
3861
3862 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3863
3864         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3865         may_use_blx_.
3866         (Target_arm::may_use_blx): Remove method.
3867         (Target_arm::set_may_use_blx): Likewise.
3868         (Target_arm::may_use_v4t_interworking): New method.
3869         (Target_arm::may_use_v5t_interworking): Likewise.
3870         (Target_arm::may_use_blx_): Remove member variable.
3871         (Arm_relocate_functions::arm_branch_common): Check for v5T
3872         interworking.
3873         (Arm_relocate_functions::thumb_branch_common): Likewise.
3874         (Reloc_stub::stub_type_for_reloc): Likewise.
3875         (Target_arm::do_finalize_sections): Correct interworking checks.
3876         * testsuite/Makefile.am: Add new tests.
3877         * testsuite/Makefile.in: Regenerate.
3878         * testsuite/arm_farcall_arm_arm.s: New test.
3879         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3880         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3881         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3882         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3883         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3884         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3885         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3886
3887 2011-10-31  Cary Coutant  <ccoutant@google.com>
3888
3889         PR gold/13023
3890         * expression.cc (Expression::eval_with_dot): Add
3891         is_section_dot_assignment parameter.
3892         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3893         absolute and assigning to dot within a section.
3894         * script-sections.cc
3895         (Output_section_element_assignment::set_section_addresses): Pass
3896         dot_section to set_if_absolute.
3897         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3898         as is_section_dot_assignment flag to eval_with_dot.
3899         (Output_section_element_dot_assignment::set_section_addresses):
3900         Likewise.
3901         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3902         parameter.  Also set value if relative to dot_section; set the
3903         symbol's output_section.
3904         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3905         parameter.  Adjust all callers.
3906         (Expression::eval_maybe_dot): Likewise.
3907         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3908         Adjust all callers.
3909         * testsuite/script_test_2.t: Test assignment of an absolute value
3910         to dot within an output section element.
3911
3912 2011-10-31  Cary Coutant  <ccoutant@google.com>
3913
3914         * options.h (class General_options): Add --[no-]gnu-unique options.
3915         * symtab.cc (Symbol_table::sized_write_globals): Convert
3916         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3917
3918 2011-10-31  Cary Coutant  <ccoutant@google.com>
3919
3920         PR gold/13359
3921         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3922         unnecessary assertion.
3923         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3924
3925 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3926
3927         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3928         gc_mark_symbol.
3929         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3930         gc_mark_symbol.
3931         Change to just keep the section associated with symbol.
3932         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3933         they are externally visible and --export-dynamic is turned on.
3934         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3935
3936 2011-10-19  Ian Lance Taylor  <iant@google.com>
3937
3938         PR gold/13163
3939         * script-sections.cc
3940         (Output_section_element_dot_assignment::needs_output_section): New
3941         function.
3942
3943 2011-10-19  Ian Lance Taylor  <iant@google.com>
3944
3945         PR gold/13204
3946         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3947         --section-start option was seen.
3948         * options.h (General_options::any_section_start): New function.
3949
3950 2011-10-18  David S. Miller  <davem@davemloft.net>
3951
3952         PR binutils/13301
3953         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3954         member to track relocation locations that have moved during TLS
3955         reloc optimizations.
3956         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3957         (Target_sparc::Relocate::relocate): Adjust view down by 4
3958         bytes if it matches reloc_adjust_addr_.
3959         (Target_sparc::Relocate::relocate_tls): Always move the
3960         __tls_get_addr call delay slot instruction forward 4 bytes when
3961         performing relaxation.
3962
3963 2011-10-18  Cary Coutant  <ccoutant@google.com>
3964
3965         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3966         (Output_file::map_no_anonymous): Check for non-zero
3967         return code from posix_fallocate.
3968
3969 2011-10-17  Cary Coutant  <ccoutant@google.com>
3970
3971         PR gold/13245
3972         * plugin.cc (is_visible_from_outside): Check for symbols
3973         referenced from dynamic objects.
3974         * resolve.cc (Symbol_table::resolve): Don't count references
3975         from dynamic objects as references from real ELF files.
3976         * testsuite/plugin_test_2.sh: Adjust expected result.
3977
3978 2011-10-17  Cary Coutant  <ccoutant@google.com>
3979
3980         * gold.cc: Include timer.h.
3981         (queue_middle_tasks): Stamp time.
3982         (queue_final_tasks): Likewise.
3983         * main.cc (main): Store timer in parameters.  Print timers
3984         for each pass.
3985         * parameters.cc (Parameters::Parameters): Initialize timer_.
3986         (Parameters::set_timer): New function.
3987         (set_parameters_timer): New function.
3988         * parameters.h (Parameters::set_timer): New function.
3989         (Parameters::timer): New function.
3990         (Parameters::timer_): New data member.
3991         (set_parameters_timer): New function.
3992         * timer.cc (Timer::stamp): New function.
3993         (Timer::get_pass_time): New function.
3994         * timer.h (Timer::stamp): New function.
3995         (Timer::get_pass_time): New function.
3996         (Timer::pass_times_): New data member.
3997
3998 2011-10-17  Cary Coutant  <ccoutant@google.com>
3999
4000         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4001         task for members of lib groups.
4002
4003 2011-10-17  Cary Coutant  <ccoutant@google.com>
4004
4005         PR gold/13288
4006         * fileread.cc (File_read::find_view): Add assert.
4007         (File_read::make_view): Move bounds check (replace with assert)...
4008         (File_read::find_or_make_view): ... to here.
4009
4010 2011-10-12  Cary Coutant  <ccoutant@google.com>
4011
4012         * output.cc (Output_file::open_base_file): Handle case where
4013         ::read returns less than requested size.
4014
4015 2011-10-10  Cary Coutant  <ccoutant@google.com>
4016
4017         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4018         Initialize defined_count_.
4019         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4020         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4021         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4022         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4023         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4024         * incremental.h (Sized_relobj_incr::defined_count_): New data
4025         member.
4026         (Sized_incr_dynobj::defined_count_): New data member.
4027         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4028         Return zeroes instead of internal error.
4029
4030 2011-10-10  Cary Coutant  <ccoutant@google.com>
4031
4032         PR gold/13249
4033         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4034         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4035         * output.h (class Output_reloc): Add use_plt_offset flag.
4036         (Output_reloc::type_): Adjust size of bit field.
4037         (Output_reloc::use_plt_offset_): New bit field.
4038         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4039         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4040         flag.  Adjust all callers.
4041         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4042         creating RELATIVE relocations.
4043
4044 2011-10-10  Nick Clifton  <nickc@redhat.com>
4045
4046         * po/es.po: Updated Spanish translation.
4047         * po/fi.po: Updated Finnish translation.
4048
4049 2011-10-03   Diego Novillo  <dnovillo@google.com>
4050
4051         * options.cc (parse_uint): Fix dereference of RETVAL.
4052
4053 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4054
4055         * layout.h (section_order_map_): New member.
4056         (get_section_order_map): New member function.
4057         * output.cc (Output_section::add_input_section): Check for patterns
4058         only when --section-ordering-file is specified.
4059         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4060         output_sections have been formed.
4061         * layout.cc (Layout_Layout): Initialize section_order_map_.
4062         * plugin.cc (update_section_order): Store order in order_map. Do not
4063         update the order.
4064         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4065         * testsuite/Makefile.in: Regenerate.
4066         * testsuite/plugin_section_order.c: New file.
4067         * testsuite/plugin_final_layout.cc: New file.
4068         * testsuite/plugin_final_layout.sh: New file.
4069
4070 2011-09-29  Cary Coutant  <ccoutant@google.com>
4071
4072         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4073         Check for NULL.
4074         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4075         symbols during incremental update.
4076         (Symbol_table::add_from_dynobj): Likewise.
4077
4078 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4079             Ian Lance Taylor  <iant@google.com>
4080
4081         * symtab.cc (Symbol_table::define_special_symbol): Always
4082         canonicalize version string.
4083
4084 2011-09-26  Cary Coutant  <ccoutant@google.com>
4085
4086         * gold.cc (queue_initial_tasks): Move option checks ...
4087         * options.cc (General_options::finalize): ... to here. Disable
4088         some options; make others fatal.
4089
4090 2011-09-26  Cary Coutant  <ccoutant@google.com>
4091
4092         gcc PR lto/47247
4093         * plugin.cc (get_symbols_v2): New function.
4094         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4095         (is_referenced_from_outside): New function.
4096         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4097         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4098         (get_symbols): Pass version parameter.
4099         (get_symbols_v2): New function.
4100         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4101         parameter.
4102         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4103         (onload): Add LDPT_GET_SYMBOLS_V2.
4104         (all_symbols_read_hook): Use get_symbols_v2; check for
4105         LDPR_PREVAILING_DEF_IRONLY_EXP.
4106         * testsuite/plugin_test_3.sh: Update expected results.
4107
4108 2011-09-23  Simon Baldwin  <simonb@google.com>
4109
4110         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4111         configuration options.
4112         * configure: Regenerate.
4113         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4114         * Makefile.in: Regenerate.
4115         * testsuite/Makefile.in: Regenerate.
4116
4117 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4118
4119         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4120
4121 2011-09-19  Cary Coutant  <ccoutant@google.com>
4122
4123         * incremental.cc (can_incremental_update): Fix typo in comment.
4124         * incremental.h (can_incremental_update): Likewise.
4125
4126 2011-09-18  Cary Coutant  <ccoutant@google.com>
4127
4128         * incremental.cc (can_incremental_update): New function.
4129         * incremental.h (can_incremental_update): New function.
4130         * layout.cc (Layout::init_fixed_output_section): Call it.
4131         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4132         * object.cc (Sized_relobj_file::do_layout): Call
4133         can_incremental_update.
4134
4135 2011-09-13  Cary Coutant  <ccoutant@google.com>
4136
4137         * configure.ac: Check for glibc support for gnu_indirect_function
4138         support with static linking, setting automake conditional
4139         IFUNC_STATIC.
4140         * Makefile.in: Regenerate.
4141         * configure: Regenerate.
4142
4143         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4144         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4145         for IFUNC_STATIC.
4146         * testsuite/Makefile.in: Regenerate.
4147
4148 2011-09-13  Cary Coutant  <ccoutant@google.com>
4149
4150         * incremental.cc (Sized_relobj_incr::do_layout): Call
4151         report_comdat_group for kept comdat sections.
4152         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4153         * testsuite/Makefile.in: Regenerate.
4154         * testsuite/incr_comdat_test_1.cc: New source file.
4155         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4156         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4157         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4158
4159 2011-09-13  Ian Lance Taylor  <iant@google.com>
4160
4161         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4162         variable external_symbols_offset.
4163
4164 2011-09-12  Ian Lance Taylor  <iant@google.com>
4165
4166         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4167         triggered if object has no symbols.
4168
4169 2011-09-09  David S. Miller  <davem@davemloft.net>
4170
4171         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4172         (Output_fill_debug_line::do_write): Likewise.
4173
4174 2011-08-29  Cary Coutant  <ccoutant@google.com>
4175
4176         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4177         casts to match formatting specs.
4178         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4179
4180 2011-08-26  Cary Coutant  <ccoutant@google.com>
4181
4182         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4183         remaining hole size when allocating.
4184         (Layout::make_output_section): Set fill methods for debug sections.
4185         * layout.h (Free_list::Free_list_node): Move from private to
4186         public.
4187         (Free_list::set_min_hole_size): New function.
4188         (Free_list::begin, Free_list::end): New functions.
4189         (Free_list::min_hole_): New data member.
4190         * output.cc: Include dwarf.h.
4191         (Output_fill_debug_info::do_minimum_hole_size): New function.
4192         (Output_fill_debug_info::do_write): New function.
4193         (Output_fill_debug_line::do_minimum_hole_size): New function.
4194         (Output_fill_debug_line::do_write): New function.
4195         (Output_section::Output_section): Initialize new data member.
4196         (Output_section::set_final_data_size): Ensure patch space is larger
4197         than minimum hole size.
4198         (Output_section::do_write): Fill holes in debug sections.
4199         * output.h (Output_fill): New class.
4200         (Output_fill_debug_info): New class.
4201         (Output_fill_debug_line): New class.
4202         (Output_section::set_free_space_fill): New function.
4203         (Output_section::free_space_fill_): New data member.
4204         * testsuite/Makefile.am (incremental_test_3): Add
4205         --incremental-patch option.
4206         (incremental_test_4): Likewise.
4207         (incremental_test_5): Likewise.
4208         (incremental_test_6): Likewise.
4209         (incremental_copy_test): Likewise.
4210         (incremental_common_test_1): Likewise.
4211         * testsuite/Makefile.in: Regenerate.
4212
4213 2011-08-26  Nick Clifton  <nickc@redhat.com>
4214
4215         * po/es.po: Updated Spanish translation.
4216
4217 2011-08-01  Cary Coutant  <ccoutant@google.com>
4218
4219         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4220         * gold/testsuite/Makefile.in: Regenerate.
4221         * gold/testsuite/justsyms_exec.c: New source file.
4222         * gold/testsuite/justsyms_lib.c: New source file.
4223
4224 2011-08-01  Cary Coutant  <ccoutant@google.com>
4225
4226         * layout.cc (Layout::set_segment_offsets): Don't realign text
4227         segment if -Ttext was specified.
4228         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4229         file type.
4230         * object.h (Sized_relobj_file::e_type): New function.
4231         (Sized_relobj_file::e_type_): New data member.
4232         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4233         base address for ET_EXEC files.
4234         * target.cc (Target::do_make_elf_object_implementation): Allow
4235         ET_EXEC files with --just-symbols option.
4236
4237 2011-07-28  Cary Coutant  <ccoutant@google.com>
4238
4239         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4240         Add thread_number parameter.
4241         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4242         * workqueue-threads.cc
4243         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4244         current thread if its thread number is greater than desired thread
4245         count.
4246         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4247         Add thread_number parameter.
4248         (Workqueue::should_cancel_thread): Likewise.
4249         (Workqueue::find_runnable_or_wait): Pass thread_number to
4250         should_cancel_thread.
4251         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4252         parameter.
4253
4254 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4255
4256         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4257         only after checking if it cannot be forced local.
4258         * symtab.h (is_externally_visible): Check if the symbol is not forced
4259         local.
4260
4261 2011-07-15  Ian Lance Taylor  <iant@google.com>
4262
4263         * options.h (class General_options): Add --print-output-format.
4264         Move -EL next to -EB, for  better --help output.
4265         * target-select.cc: Include <cstdio>, "options.h", and
4266         "parameters.h".
4267         (Target_selector::do_target_bfd_name): New function.
4268         (print_output_format): New function.
4269         * target-select.h (class Target_selector): Update declarations.
4270         (Target_selector::target_bfd_name): New function.
4271         (print_output_format): Declare.
4272         * main.cc: Include "target-select.h".
4273         (main): Handle --print-output-format.
4274         * gold.cc: Include "target-select.h".
4275         (queue_initial_tasks): Handle --print-output-format when there are
4276         no input files.
4277         * parameters.cc (parameters_force_valid_target): Give a better
4278         error message if -EB/-EL does not match target.
4279         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4280         function.
4281
4282 2011-07-15  Ian Lance Taylor  <iant@google.com>
4283
4284         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4285         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4286         (Output_data_plt_i386::do_write): Write address of .dynamic
4287         section to first entry in .got.plt section.
4288         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4289         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4290         Initialize layout_.
4291         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4292         section to first entry in .got.plt section.
4293         * layout.h (Layout::dynamic_section): New function.
4294
4295 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4296
4297         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4298         to claim_file call.
4299         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4300         input_section_position_, and input_section_glob_.
4301         (read_layout_from_file): Call function section_ordering_specified.
4302         * layout.h (is_section_ordering_specified): New function.
4303         (section_ordering_specified): New function.
4304         (section_ordering_specified_): New boolean member.
4305         * main.cc(main): Call load_plugins after layout object is defined.
4306         * output.cc (Output_section::add_input_section): Use
4307         function section_ordering_specified to check if section ordering is
4308         needed.
4309         * output.cc (Output_section::add_relaxed_input_section): Use
4310         function section_ordering_specified to check if section ordering is
4311         needed.
4312         (Output_section::update_section_layout): New function.
4313         (Output_section::sort_attached_input_sections): Check if input section
4314         must be reordered.
4315         * output.h (Output_section::update_section_layout): New function.
4316         * plugin.cc (get_section_count): New function.
4317         (get_section_type): New function.
4318         (get_section_name): New function.
4319         (get_section_contents): New function.
4320         (update_section_order): New function.
4321         (allow_section_ordering): New function.
4322         (Plugin::load): Add the new interfaces to the transfer vector.
4323         (Plugin_manager::load_plugins): New parameter.
4324         (Plugin_manager::all_symbols_read): New parameter.
4325         (Plugin_manager::claim_file): New parameter. Save the elf object for
4326         unclaimed objects.
4327         (Plugin_manager::get_elf_object): New function.
4328         (Plugin_manager::get_view): Change to directly use the bool to check
4329         if get_view is called from claim_file_hook.
4330         * plugin.h (input_objects): New function
4331         (Plugin__manager::load_plugins): New parameter.
4332         (Plugin_manager::claim_file): New parameter.
4333         (Plugin_manager::get_elf_object): New function.
4334         (Plugin_manager::in_claim_file_handler): New function.
4335         (Plugin_manager::in_claim_file_handler_): New member.
4336         (layout): New function.
4337         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4338         handler with an extra parameter. Make the elf object before calling
4339         claim_file handler.
4340         * testsuite/plugin_test.c (get_section_count): New function pointer.
4341         (get_section_type): New function pointer.
4342         (get_section_name): New function pointer.
4343         (get_section_contents): New function pointer.
4344         (update_section_order): New function pointer.
4345         (allow_section_ordering): New function pointer.
4346         (onload): Check if the new interfaces exist.
4347
4348 2011-07-13  Ian Lance Taylor  <iant@google.com>
4349
4350         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4351         relro section.
4352         * x86_64.cc (Target_x86_64::got_section): Likewise.
4353         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4354         (relro_now_test_SOURCES): New variable.
4355         (relro_now_test_DEPENDENCIES): New variable.
4356         (relro_now_test_LDFLAGS): New variable.
4357         (relro_now_test_LDADD): New variable.
4358         (relro_now_test.so): New target.
4359         * testsuite/Makefile.in: Rebuild.
4360
4361 2011-07-12  Ian Lance Taylor  <iant@google.com>
4362
4363         PR gold/12980
4364         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4365         GLOB_DAT relocation rather than a RELATIVE relocation for a
4366         protected symbol when creating a shared library.
4367         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4368         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4369         * testsuite/protected_main_1.cc (main): Test that protected
4370         function has same address.
4371
4372 2011-07-11  Ian Lance Taylor  <iant@google.com>
4373
4374         PR gold/12979
4375         * options.h (class General_options): Add -Bgroup.
4376         * options.cc (General_options::finalize): If -Bgroup is set,
4377         default to --unresolved-symbols=report-all.
4378         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4379         * target-reloc.h (issue_undefined_symbol_error): Handle
4380         --unresolved-symbols=report-all.
4381
4382 2011-07-08  Ian Lance Taylor  <iant@google.com>
4383
4384         PR gold/11985
4385         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4386         if linker script discards key sections.
4387         (Layout::create_dynamic_symtab): Likewise.
4388         (Layout::assign_local_dynsym_offsets): Likewise.
4389         (Layout::sized_create_version_sections): Likewise.
4390         (Layout::create_interp): Likewise.
4391         (Layout::finish_dynamic_section): Likewise.
4392         (Layout::set_dynamic_symbol_size): Likewise.
4393
4394 2011-07-08  Ian Lance Taylor  <iant@google.com>
4395
4396         PR gold/12386
4397         * options.h (class General_options): Add --unresolved-symbols.
4398         * target-reloc.h (issue_undefined_symbol_error): Check
4399         --unresolved-symbols.  Add comments.
4400
4401 2011-07-08  Ian Lance Taylor  <iant@google.com>
4402
4403         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4404         expression more complex.
4405
4406 2011-07-08  Ian Lance Taylor  <iant@google.com>
4407
4408         PR gold/11317
4409         * target-reloc.h (issue_undefined_symbol_error): New inline
4410         function, broken out of relocate_section.
4411         (relocate_section): Call issue_undefined_symbol_error.
4412         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4413         there is no TLS segment if we are about to issue an undefined
4414         symbol error.
4415         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4416
4417 2011-07-08  Ian Lance Taylor  <iant@google.com>
4418
4419         PR gold/12279
4420         * resolve.cc (Symbol_table::should_override): Add fromtype
4421         parameter.  Change all callers.  Give error when linking together
4422         TLS and non-TLS symbol.
4423         (Symbol_table::should_override_with_special): Add fromtype
4424         parameter.  Change all callers.
4425         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4426         there is no TLS segment if we have reported some errors.
4427         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4428
4429 2011-07-08  Ian Lance Taylor  <iant@google.com>
4430
4431         PR gold/12372
4432         * target.h (Target::plt_address_for_global): New function.
4433         (Target::plt_address_for_local): New function.
4434         (Target::plt_section_for_global): Remove.
4435         (Target::plt_section_for_local): Remove.
4436         (Target::do_plt_address_for_global): New virtual function.
4437         (Target::do_plt_address_for_local): New virtual function.
4438         (Target::do_plt_section_for_global): Remove.
4439         (Target::do_plt_section_for_local): Remove.
4440         (Target::register_global_plt_entry): Add Symbol_table and Layout
4441         parameters.
4442         * output.cc (Output_data_got::Got_entry::write): Use
4443         plt_address_for_global and plt_address_for_local.
4444         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4445         address of output section.
4446         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4447         got_irelative_, and irelative_count_ fields.  Update
4448         declarations.
4449         (Output_data_plt_i386::has_irelative_section): New function.
4450         (Output_data_plt_i386::entry_count): Add irelative_count_.
4451         (Output_data_plt_i386::set_final_data_size): Likewise.
4452         (class Target_i386): Add got_irelative_ and rel_irelative_
4453         fields.  Update declarations.
4454         (Target_i386::Target_i386): Initialize new fields.
4455         (Target_i386::do_plt_address_for_global): New function replacing
4456         do_plt_section_for_global.
4457         (Target_i386::do_plt_address_for_local): New function replacing
4458         do_plt_section_for_local.
4459         (Target_i386::got_section): Create got_irelative_.
4460         (Target_i386::rel_irelative_section): New function.
4461         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4462         fields.  Don't define __rel_iplt_{start,end}.
4463         (Output_data_plt_i386::add_entry): Add symtab and layout
4464         parameters.  Change all callers.  Use different PLT and GOT for
4465         IFUNC symbols.
4466         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4467         layout parameters.  Change all callers.  Use different PLT and
4468         GOT.
4469         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4470         (Output_data_plt_i386::rel_irelative): New function.
4471         (Output_data_plt_i386::address_for_global): New function.
4472         (Output_data_plt_i386::address_for_local): New function.
4473         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4474         IRELATIVE GOT when changing IFUNC GOT entries.
4475         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4476         reloc.
4477         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4478         if we didn't create an IRELATIVE GOT.
4479         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4480         plt_address_for_local.
4481         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4482         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4483         got_irelative_, and irelative_count_ fields.  Update
4484         declarations.
4485         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4486         Initialize new fields.  Remove symtab parameter.  Change all
4487         callers.
4488         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4489         irelative_count_.
4490         (Output_data_plt_x86_64::has_irelative_section): New function.
4491         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4492         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4493         fields.  Update declarations.
4494         (Target_x86_64::Target_x86_64): Initialize new fields.
4495         (Target_x86_64::do_plt_address_for_global): New function replacing
4496         do_plt_section_for_global.
4497         (Target_x86_64::do_plt_address_for_local): New function replacing
4498         do_plt_section_for_local.
4499         (Target_x86_64::got_section): Create got_irelative_.
4500         (Target_x86_64::rela_irelative_section): New function.
4501         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4502         all callers.  Don't create __rel_iplt_{start,end}.
4503         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4504         parameters.  Change all callers.  Use different PLT and GOT for
4505         IFUNC symbols.
4506         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4507         layout parameters.  Change all callers.  Use different PLT and
4508         GOT.
4509         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4510         parameters.  Change all callers.  Use different PLT and GOT for
4511         IFUNC symbols.
4512         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4513         (Output_data_plt_x86_64::rela_irelative): New function.
4514         (Output_data_plt_x86_64::address_for_global): New function.
4515         (Output_data_plt_x86_64::address_for_local): New function.
4516         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4517         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4518         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4519         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4520         parameters.
4521         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4522         reloc.
4523         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4524         symbols if we didn't create an IRELATIVE GOT.
4525         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4526         plt_address_for_local.
4527         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4528         * testsuite/ifuncvar1.c: New test file.
4529         * testsuite/ifuncvar2.c: New test file.
4530         * testsuite/ifuncvar3.c: New test file.
4531         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4532         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4533         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4534         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4535         * testsuite/Makefile.in: Rebuild.
4536
4537 2011-07-07  Cary Coutant  <ccoutant@google.com>
4538
4539         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4540         (two_file_test_1_ndebug.o): Likewise.
4541         (two_file_test_1b_ndebug.o): Likewise.
4542         (two_file_test_2_ndebug.o): Likewise.
4543         (two_file_test_main_ndebug.o): Likewise.
4544         (incremental_test_2): Link with no-debug versions.
4545
4546 2011-07-06  Cary Coutant  <ccoutant@google.com>
4547
4548         * gold/incremental.cc
4549         (Output_section_incremental_inputs::write_info_blocks): Check for
4550         hidden and internal symbols.
4551
4552 2011-07-06  Cary Coutant  <ccoutant@google.com>
4553
4554         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4555         Check disposition for startup file.
4556         (Incremental_inputs::report_command_line): Ignore
4557         --incremental-startup-unchanged option.
4558         * options.cc (General_options::parse_incremental_startup_unchanged):
4559         New function.
4560         (General_options::General_options): Initialize new data member.
4561         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4562         (General_options): Add --incremental-startup-unchanged option.
4563         (General_options::incremental_startup_disposition): New function.
4564         (General_options::incremental_startup_disposition_): New data member.
4565
4566 2011-07-06  Cary Coutant  <ccoutant@google.com>
4567
4568         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4569         input file index to Script_info ctor.
4570         (Sized_incremental_binary::do_file_has_changed): Find the
4571         command-line argument for files named in scripts.
4572         * incremental.h (Script_info::Script_info): New ctor
4573         with input file index.
4574         (Script_info::input_file_index): New function.
4575         (Script_info::input_file_index_): New data member.
4576         (Incremental_binary::get_library): Add const.
4577         (Incremental_binary::get_script_info): Add const.
4578         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4579         * testsuite/Makefile.am (incremental_test_5): New test case.
4580         (incremental_test_6): New test case.
4581         * testsuite/Makefile.in: Regenerate.
4582
4583 2011-07-06  Cary Coutant  <ccoutant@google.com>
4584
4585         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4586         debug output when command lines differ.
4587
4588 2011-07-06  Cary Coutant  <ccoutant@google.com>
4589
4590         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4591         --incremental-patch option.
4592         * layout.cc (Free_list::allocate): Extend allocation beyond original
4593         end if enabled.
4594         (Layout::make_output_section): Mark sections that should get
4595         patch space.
4596         * options.cc (parse_percent): New function.
4597         * options.h (parse_percent): New function.
4598         (DEFINE_percent): New macro.
4599         (General_options): Add --incremental-patch option.
4600         * output.cc (Output_section::Output_section): Initialize new data
4601         members.
4602         (Output_section::add_input_section): Print section name when out
4603         of patch space.
4604         (Output_section::add_output_section_data): Likewise.
4605         (Output_section::set_final_data_size): Add patch space when
4606         doing --incremental-full.
4607         (Output_section::do_reset_address_and_file_offset): Remove patch
4608         space.
4609         (Output_segment::set_section_list_addresses): Print debug output
4610         only if --incremental-update.
4611         * output.h (Output_section::set_is_patch_space_allowed): New function.
4612         (Output_section::is_patch_space_allowed_): New data member.
4613         (Output_section::patch_space_): New data member.
4614         * parameters.cc (Parameters::incremental_full): New function.
4615         * parameters.h (Parameters::incremental_full): New function
4616         * testsuite/Makefile.am (incremental_test_2): Add test for
4617         --incremental-patch option.
4618         * testsuite/Makefile.in: Regenerate.
4619         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4620         (t18): Remove function body.
4621
4622 2011-07-05  Doug Kwan  <dougkwan@google.com>
4623
4624         PR gold/12771
4625         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4626         Arm_Address type for relocation result.
4627         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4628         overflow check.
4629         (Arm_relocate_functions::abs32): Use unaligned access.
4630         (Arm_relocate_functions::rel32): Ditto.
4631         (Arm_relocate_functions::prel31): Ditto.
4632         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4633         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4634         static data relocations.
4635         * testsuite/Makefile.in: Regnerate.
4636         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4637
4638 2011-07-05  Ian Lance Taylor  <iant@google.com>
4639
4640         PR gold/12392
4641         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4642         symbols if necessary.
4643         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4644
4645 2011-07-05  Ian Lance Taylor  <iant@google.com>
4646
4647         PR gold/12952
4648         * resolve.cc (Symbol::override_base_with_special): Simply override
4649         version with special symbol version, ignoring previous version.
4650
4651 2011-07-05  Ian Lance Taylor  <iant@google.com>
4652
4653         * object.cc (Sized_relobj_file::include_section_group): Add
4654         information to comment about signature location.
4655
4656 2011-07-02  Ian Lance Taylor  <iant@google.com>
4657
4658         PR gold/12957
4659         * options.h (class General_options): Add -f and -F.
4660         * options.cc (General_options::finalize): Fatal error if -f/-F
4661         are used without -shared.
4662         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4663
4664 2011-07-02  Ian Lance Taylor  <iant@google.com>
4665
4666         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4667
4668 2011-07-01  Ian Lance Taylor  <iant@google.com>
4669
4670         PR gold/12525
4671         PR gold/12952
4672         * resolve.cc (Symbol::override_base_with_special): Don't override
4673         the version if the overriding symbol has a different name.
4674         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4675         all callers.  If we give an error about an undefined version,
4676         define the base version if necessary.
4677         * dynobj.h (class Versions): Update declaration.
4678         * testsuite/weak_alias_test_5.cc: New file.
4679         * testsuite/weak_alias_test.script: New file.
4680         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4681         and versioned_alias have the right value, and call t2.
4682         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4683         weak_alias_test_5.so.
4684         (weak_alias_test_LDADD): Likewise.
4685         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4686         * testsuite/Makefile.in: Rebuild.
4687
4688 2011-07-01  Ian Lance Taylor  <iant@google.com>
4689
4690         PR gold/12525
4691         * options.h (class General_options): Support -z notext.
4692         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4693         -Wl,-z,notext.
4694         (two_file_shared_nonpic.so): Likewise.
4695         (two_file_shared_mixed.so): Likewise.
4696         (two_file_shared_mixed_1.so): Likewise.
4697         (weak_undef_lib_nonpic.so): Likewise.
4698         (alt/weak_undef_lib_nonpic.so): Likewise.
4699         (tls_test_shared_nonpic.so): Likewise.
4700         * testsuite/Makefile.in: Rebuild.
4701
4702 2011-07-01  Ian Lance Taylor  <iant@google.com>
4703
4704         PR gold/12525
4705         * configure.ac: Test whether static linking works, setting
4706         the automake conditional HAVE_STATIC.
4707         * testsuite/Makefile.am: Disable tests using -static if
4708         HAVE_STATIC is not true.
4709         * configure, testsuite/Makefile.in: Rebuild.
4710
4711 2011-07-01  Ian Lance Taylor  <iant@google.com>
4712
4713         PR gold/12525
4714         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4715         Assert if we see DW_EH_PE_indirect.
4716         * target.h (Target::ehframe_datarel_base): New function.
4717         (Target::do_ehframe_datarel_base): New target function.
4718         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4719         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4720         function.
4721
4722 2011-07-01  Ian Lance Taylor  <iant@google.com>
4723
4724         PR gold/12571
4725         * options.h (class General_options): Add
4726         --ld-generated-unwind-info.
4727         * ehframe.cc (Fde::write): Add address parameter.  Change all
4728         callers.  If associated with PLT, fill in address and size.
4729         (Cie::set_output_offset): Only add merge mapping if there is an
4730         object.
4731         (Cie::write): Add address parameter.  Change all callers.
4732         (Eh_frame::add_ehframe_for_plt): New function.
4733         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4734         input_offset_ fields into union u_, with new plt field.
4735         (Fde::Fde): Adjust for new union field.
4736         (Fde::Fde) [Output_data version]: New constructor.
4737         (Fde::add_mapping): Only add merge mapping if there is an object.
4738         (class Cie): Update declarations.
4739         (class Eh_frame): Declare add_ehframe_for_plt.
4740         * layout.cc (Layout::layout_eh_frame): Break out code into
4741         make_eh_frame_section, and call it.
4742         (Layout::make_eh_frame_section): New function.
4743         (Layout::add_eh_frame_for_plt): New function.
4744         * layout.h (class Layout): Update declarations.
4745         * merge.cc (Merge_map::add_mapping): Add assertion.
4746         * i386.cc: Include "dwarf.h".
4747         (class Output_data_plt_i386): Make first_plt_entry,
4748         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4749         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4750         and plt_eh_frame_fde.
4751         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4752         boundary.  Call add_eh_frame_for_plt if appropriate.
4753         * x86_64.cc: Include "dwarf.h".
4754         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4755         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4756         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4757         and plt_eh_frame_fde.
4758         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4759         appropriate.
4760
4761 2011-06-29  Ian Lance Taylor  <iant@google.com>
4762
4763         PR gold/12629
4764         * object.cc (Sized_relobj_file::layout_section): Change shdr
4765         parameter to be const.
4766         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4767         out of do_layout.
4768         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4769         appropriate.  Call layout_eh_frame_section.
4770         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4771         sections.
4772         * object.h (class Sized_relobj_file): Update declarations.
4773
4774 2011-06-29  Ian Lance Taylor  <iant@google.com>
4775
4776         PR gold/12652
4777         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4778         modifier.
4779         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4780
4781 2011-06-29  Ian Lance Taylor  <iant@google.com>
4782
4783         PR gold/12675
4784         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4785         SHT_X86_64_UNWIND.
4786         * layout.cc (Layout::layout_eh_frame): Likewise.
4787
4788 2011-06-29  Ian Lance Taylor  <iant@google.com>
4789
4790         PR gold/12695
4791         * layout.cc (Layout::symtab_section_shndx): New function.
4792         * layout.h (class Layout): Declare symtab_section_shndx.
4793         * output.cc (Output_section::write_header): Call it.
4794
4795 2011-06-29  Ian Lance Taylor  <iant@google.com>
4796
4797         PR gold/12818
4798         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4799         symbols which are not used in a relocation.
4800
4801 2011-06-28  Ian Lance Taylor  <iant@google.com>
4802
4803         PR gold/12898
4804         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4805         script create indistinguishable segments.
4806         (Layout::set_segment_offsets): Use stable_sort when sorting
4807         segments.  Pass this to Compare_segments constructor.
4808         * layout.h (class Layout): Make segment_precedes non-static.
4809         (class Compare_segments): Change from struct to class.  Add
4810         layout_ field.  Add constructor.
4811         * script-sections.cc
4812         (Script_sections::attach_sections_using_phdrs_clause): Rename
4813         local orphan to is_orphan.  Don't report failure to put empty
4814         section in segment.  On attachment failure, report name of
4815         section, and attach to first PT_LOAD segment.
4816
4817 2011-06-28  Ian Lance Taylor  <iant@google.com>
4818
4819         PR gold/12934
4820         * target-select.cc (Target_selector::Target_selector): Add
4821         emulation parameter.  Change all callers.
4822         (select_target_by_bfd_name): Rename from select_target_by_name.
4823         Change all callers.
4824         (select_target_by_emulation): New function.
4825         (supported_emulation_names): New function.
4826         * target-select.h (class Target_selector): Add emulation_ field.
4827         Update declarations.
4828         (Target_selector::recognize_by_bfd_name): Rename from
4829         recognize_by_name.  Change all callers.
4830         (Target_selector::supported_bfd_names): Rename from
4831         supported_names.  Change all callers.
4832         (Target_selector::recognize_by_emulation): New function.
4833         (Target_selector::supported_emulations): New function.
4834         (Target_selector::emulation): New function.
4835         (Target_selector::do_recognize_by_bfd_name): Rename from
4836         do_recognize_by_name.  Change all callers.
4837         (Target_selector::do_supported_bfd_names): Rename from
4838         do_supported_names.  Change all callers.
4839         (Target_selector::do_recognize_by_emulation): New function.
4840         (Target_selector::do_supported_emulations): New function.
4841         (select_target_by_bfd_name): Change name in declaration.
4842         (select_target_by_emulation): Declare.
4843         (supported_emulation_names): Declare.
4844         * parameters.cc (parameters_force_valid_target): Try to find
4845         target based on emulation from -m option.
4846         * options.h (class General_options): Change doc string for -m.
4847         * options.cc (help): Print emulations.
4848         (General_options::parse_V): Likewise.
4849         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4850         Add emulation parameter.  Change all callers.
4851
4852 2011-06-28  Ian Lance Taylor  <iant@google.com>
4853
4854         * target.h (class Target): Add osabi_ field.
4855         (Target::osabi): New function.
4856         (Target::set_osabi): New function.
4857         (Target::Target): Initialize osabi_.
4858         (Target::do_adjust_elf_header): Make pure virtual.
4859         (Sized_target::do_adjust_elf_header): Declare.
4860         * target.cc (Sized_target::do_adjust_elf_header): New function.
4861         (class Sized_target): Instantiate all versions.
4862         * freebsd.h (class Target_freebsd): Remove.
4863         (Target_selector_freebsd::do_recognize): Call set_osabi on
4864         Target.
4865         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4866         (Target_selector_freebsd::set_osabi): Remove.
4867         * i386.cc (class Target_i386): Inherit from Sized_target rather
4868         than Target_freebsd.
4869         * x86_64.cc (class Target_x86_64): Likewise.
4870
4871 2011-06-28  Ian Lance Taylor  <iant@google.com>
4872
4873         * target.h (Target::can_check_for_function_pointers): Rewrite.
4874         Make non-virtual.
4875         (Target::can_icf_inline_merge_sections): Likewise.
4876         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4877         (Target::Target_info): Add can_icf_inline_merge_sections field.
4878         (Target::do_can_check_for_function_pointers): New virtual
4879         function.
4880         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4881         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4882         from can_check_for_function_pointers, move in file.
4883         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4884         section_may_have_icf_unsafe_poineters, move in file.
4885         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4886         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4887         Rename from can_check_for_function_pointers, move in file.
4888         (Target_i386::can_icf_inline_merge_sections): Remove.
4889         (Target_i386::i386_info): Initialize
4890         can_icf_inline_merge_sections.
4891         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4892         Initialize can_icf_inline_merge_sections.
4893         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4894         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4895         Rename from can_check_for_function_pointers, move in file.
4896         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4897         (Target_x86_64::x86_64_info): Initialize
4898         can_icf_inline_merge_sections.
4899         * testsuite/testfile.cc (Target_test::test_target_info):
4900         Likewise.
4901         * icf.cc (get_section_contents): Correct formatting.
4902
4903 2011-06-27  Ian Lance Taylor  <iant@google.com>
4904
4905         * symtab.cc (Symbol::versioned_name): New function.
4906         (Symbol_table::add_to_final_symtab): Use versioned_name when
4907         appropriate.
4908         (Symbol_table::sized_write_symbol): Likewise.
4909         * symtab.h (class Symbol): Declare versioned_name.
4910         * stringpool.h (class Stringpool_template): Add variant of add
4911         which takes a std::basic_string.
4912         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4913         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4914         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4915         (ver_test_12.o): New target.
4916         * testsuite/Makefile.in: Rebuild.
4917
4918 2011-06-27  Doug Kwan  <dougkwan@google.com>
4919
4920         * arm.cc (Arm_relocate_functions::thm_jump8,
4921         Arm_relocate_functions::thm_jump11): Use a wider signed
4922         type to compute offset.
4923         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4924         arm_thm_jump8.
4925         * testsuite/Makefile.in: Regenerate.
4926         * testsuite/arm_branch_in_range.sh: Check test results of
4927         arm_thm_jump11 and arm_thm_jump8.
4928         * testsuite/arm_thm_jump11.s: New test source file.
4929         * testsuite/arm_thm_jump11.t: New linker script.
4930         * testsuite/arm_thm_jump8.s: New test source file.
4931         * testsuite/arm_thm_jump8.t: New linker script.
4932
4933 2011-06-24  Ian Lance Taylor  <iant@google.com>
4934
4935         * layout.cc: Include "object.h".
4936         (ctors_sections_in_init_array): New static variable.
4937         (Layout::is_ctors_in_init_array): New function.
4938         (Layout::layout): Add entry to ctors_sections_in_init_array if
4939         appropriate.
4940         * layout.h (class Layout): Declare is_ctors_in_init_array.
4941         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4942         is_ctors_reverse_view is set.
4943         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4944         all callers.  Set is_ctors_reverse_view field of View_size.
4945         (Sized_relobj_file::reverse_words): New function.
4946         * object.h (Sized_relobj_file::View_size): Add
4947         is_ctors_reverse_view field.
4948         (class Sized_relobj_file): Update declarations.
4949         * testsuite/initpri3.c: New test.
4950         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4951         initpri3b.
4952         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4953         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4954         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4955         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4956         * testsuite/Makefile.in: Rebuild.
4957
4958 2011-06-24  Cary Coutant  <ccoutant@google.com>
4959
4960         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4961         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4962         (debug_msg_cdebug.err): New targets.
4963         * testsuite/Makefile.in: Regenerate.
4964         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4965         Fix checks for link with shared library.
4966
4967 2011-06-24  Doug Kwan  <dougkwan@google.com>
4968
4969         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4970         skip empty text sections.
4971         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4972
4973 2011-06-22  Ian Lance Taylor  <iant@google.com>
4974
4975         PR gold/12910
4976         * options.h (class General_options): Add --ctors-in-init-array.
4977         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4978         friends as SHT_PROGBITS for merging sections.
4979         (Layout::layout): Remove special handling of .init_array and
4980         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4981         and .dtors if ctors_in_init_array.
4982         (Layout::make_output_section): Force correct section types for
4983         .init_array and friends.  Don't sort if doing relocatable link,
4984         Don't sort .ctors and .dtors if ctors_in_init_array.
4985         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4986         (Layout::output_section_name): Add relobj parameter.  Change all
4987         callers.  Handle .ctors. and .dtors. in code rather than table.
4988         Handle .ctors and .dtors if ctors_in_init_array.
4989         (Layout::match_file_name): New function, moved from output.cc.
4990         * layout.h (class Layout): Update declarations.
4991         * output.cc: Include "layout.h".
4992         (Input_section_sort_entry::get_priority): New function.
4993         (Input_section_sort_entry::match_file_name): Just call
4994         Layout::match_file_name.
4995         (Output_section::Input_section_sort_init_fini_compare::operator()):
4996         Handle .ctors and .dtors.  Sort by explicit priority rather than
4997         by name.
4998         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4999         * testsuite/initpri2.c: New test.
5000         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5001         (check_PROGRAMS): Add initpri2.
5002         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5003         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5004         * configure, testsuite/Makefile.in: Rebuild.
5005
5006 2011-06-19  Ian Lance Taylor  <iant@google.com>
5007
5008         PR gold/12880
5009         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5010         .interp section to a PT_INTERP segment even if we have seen a
5011         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5012         clause in a linker script.
5013         (Layout::finalize): Don't create a .interp section if we've
5014         already create a PT_INTERP segment.
5015         (Layout::create_interp): Always call choose_output_section (revert
5016         patch of 2011-06-17).  Don't create PT_INTERP segment.
5017         * script-sections.cc
5018         (Script_sections::create_note_and_tls_segments): Add a .interp
5019         section to a PT_INTERP segment even if we have seen a
5020         --dynamic-linker option.
5021
5022 2011-06-18  Ian Lance Taylor  <iant@google.com>
5023
5024         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5025         merely because a non-PT_LOAD segment has a dynamic reloc.
5026
5027 2011-06-18  Ian Lance Taylor  <iant@google.com>
5028
5029         * layout.cc (Layout::finish_dynamic_section): Don't create
5030         DT_FLAGS entry if not needed.
5031
5032 2011-06-18  Ian Lance Taylor  <iant@google.com>
5033
5034         PR gold/12745
5035         * layout.cc (Layout::layout_eh_frame): Correct handling of
5036         writable .eh_frame section.
5037
5038 2011-06-17  Ian Lance Taylor  <iant@google.com>
5039
5040         PR gold/12893
5041         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5042         symbol is redefined with the exact same object and value.
5043
5044 2011-06-17  Ian Lance Taylor  <iant@google.com>
5045
5046         PR gold/12880
5047         * layout.h (class Layout): Add interp_segment_ field.
5048         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5049         (Layout::attach_allocated_section_to_segment): If making shared
5050         library, put .interp section in PT_INTERP segment.
5051         (Layout::finalize): Also call create_interp if -dynamic-linker
5052         option was used.
5053         (Layout::create_interp): Assert that there is no PT_INTERP
5054         segment.  If not using a SECTIONS clause, use make_output_section.
5055         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5056         * script-sections.cc
5057         (Script_sections::create_note_and_tls_segments): If making shared
5058         library, put .interp section in PT_INTERP segment.
5059
5060 2011-06-17  Ian Lance Taylor  <iant@google.com>
5061
5062         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5063         when making a shared library.
5064
5065 2011-06-17  Ian Lance Taylor  <iant@google.com>
5066
5067         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5068         parameter.  Change all callers.  Don't issue warning about PC32
5069         against locally defined symbol.
5070
5071 2011-06-16  Ian Lance Taylor  <iant@google.com>
5072
5073         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5074         occurs in same object.
5075
5076 2011-06-14  Alan Modra  <amodra@gmail.com>
5077
5078         * po/POTFILES.in: Regenerate.
5079
5080 2011-06-09  Ian Lance Taylor  <iant@google.com>
5081
5082         * script-sections.cc
5083         (Orphan_output_section::set_section_addresses): For a relocatable
5084         link set address to 0.
5085
5086 2011-06-09  Cary Coutant  <ccoutant@google.com>
5087
5088         PR gold/12804
5089         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5090         used with --compress-debug-sections.
5091         * gold/object.cc (Sized_relobj_file::do_layout): Report
5092         uncompressed size of compressed input sections.
5093
5094 2011-06-08  Cary Coutant  <ccoutant@google.com>
5095
5096         PR gold/12804
5097         * testsuite/two_file_test_2_v1.cc: Change initialization of
5098         v2 to keep it in .data.
5099
5100 2011-06-07  Cary Coutant  <ccoutant@google.com>
5101
5102         * common.cc (Symbol_table::do_allocate_commons_list): Call
5103         gold_fallback.
5104         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5105         (Errors::fallback): New function.
5106         (gold_fallback): New function.
5107         * errors.h (Errors::fallback): New function.
5108         * gold.cc (gold_exit): Change status parameter to enum; adjust
5109         all callers.
5110         (queue_initial_tasks): Call gold_fallback.
5111         * gold.h: Include cstdlib.
5112         (Exit_status): New enum type.
5113         (gold_exit): Change status parameter to enum.
5114         (gold_fallback): New function.
5115         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5116         (Layout::create_symtab_sections): Likewise.
5117         (Layout::create_shdrs): Likewise.
5118         * main.cc (main): Adjust call to gold_exit.
5119         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5120         (Output_data_got::add_got_entry_pair): Likewise.
5121         (Output_section::add_input_section): Likewise.
5122         (Output_section::add_output_section_data): Likewise.
5123         (Output_segment::set_section_list_addresses): Likewise.
5124         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5125
5126 2011-06-07  Cary Coutant  <ccoutant@google.com>
5127
5128         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5129         for incremental links.
5130         * output.cc (Output_segment::set_section_list_addresses): Remove
5131         FIXME and test for TLS or BSS.
5132
5133 2011-06-07  Cary Coutant  <ccoutant@google.com>
5134
5135         * testsuite/Makefile.am: Add incremental_copy_test,
5136         incremental_common_test_1.
5137         * testsuite/Makefile.in: Regenerate.
5138         * testsuite/common_test_1_v1.c: New source file.
5139         * testsuite/common_test_1_v2.c: New source file.
5140         * testsuite/copy_test_v1.cc: New source file.
5141
5142 2011-06-07  Cary Coutant  <ccoutant@google.com>
5143
5144         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5145         update, allocate common from bss section's free list.
5146         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5147         linker-defined symbols.
5148         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5149         Skip GOT and PLT entries that are no longer referenced.
5150         (Output_section_incremental_inputs::write_info_blocks): Mark
5151         linker-defined symbols.
5152         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5153         * output.cc (Output_section::allocate): New function.
5154         * output.h (Output_section::allocate): New function.
5155         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5156         linker-defined symbols.
5157         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5158         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5159         (Symbol::init_base_output_data): Likewise.
5160         (Symbol::init_base_output_segment): Likewise.
5161         (Symbol::init_base_constant): Likewise.
5162         (Sized_symbol::init_output_data): Likewise.
5163         (Sized_symbol::init_output_segment): Likewise.
5164         (Sized_symbol::init_constant): Likewise.
5165         (Symbol_table::do_define_in_output_data): Likewise.
5166         (Symbol_table::do_define_in_output_segment): Likewise.
5167         (Symbol_table::do_define_as_constant): Likewise.
5168         * symtab.h (Symbol::is_predefined): New function.
5169         (Symbol::init_base_output_data): Add is_predefined parameter.
5170         (Symbol::init_base_output_segment): Likewise.
5171         (Symbol::init_base_constant): Likewise.
5172         (Symbol::is_predefined_): New data member.
5173         (Sized_symbol::init_output_data): Add is_predefined parameter.
5174         (Sized_symbol::init_output_segment): Likewise.
5175         (Sized_symbol::init_constant): Likewise.
5176         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5177
5178 2011-06-07  Cary Coutant  <ccoutant@google.com>
5179
5180         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5181         instead of emit_copy_reloc.
5182         (Copy_relocs::emit_copy_reloc): Refactor.
5183         (Copy_relocs::make_copy_reloc): New function.
5184         (Copy_relocs::add_copy_reloc): Remove.
5185         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5186         section.
5187         (Copy_relocs::make_copy_reloc): New function.
5188         (Copy_relocs::add_copy_reloc): Remove.
5189         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5190         unchanged input files.
5191         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5192         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5193         Reserve BSS space for COPY relocations.
5194         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5195         (Output_section_incremental_inputs::write_info_blocks): Record
5196         whether a symbol is copied from a shared object.
5197         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5198         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5199         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5200         (Incremental_input_entry_reader::get_output_symbol_index): Add
5201         is_copy parameter.
5202         (Incremental_binary::emit_copy_relocs): New function.
5203         (Incremental_binary::do_emit_copy_relocs): New function.
5204         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5205         new data member.
5206         (Sized_incremental_binary::add_copy_reloc): New function.
5207         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5208         (Sized_incremental_binary::Copy_reloc): New struct.
5209         (Sized_incremental_binary::Copy_relocs): New typedef.
5210         (Sized_incremental_binary::copy_relocs_): New data member.
5211         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5212         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5213         * target.h (Sized_target::emit_copy_reloc): New function.
5214         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5215
5216 2011-06-02  Cary Coutant  <ccoutant@google.com>
5217
5218         PR gold/12163
5219         * gold/archive.cc (Archive::Archive): Initialize new data member.
5220         (Archive::include_all_members): Return if archive has already been
5221         included.
5222         * gold/archive.h (Archive::include_all_members_): New data member.
5223
5224 2011-06-02  Nick Clifton  <nickc@redhat.com>
5225
5226         * dynobj.h: Fix spelling mistake in comment.
5227         * output.cc: Likewise.
5228
5229 2011-05-31  Doug Kwan  <dougkwan@google.com>
5230             Asier Llano
5231
5232         PR gold/12826
5233         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5234         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5235         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5236         redundant arm_exidx_test.so.
5237         * testsuite/Makefile.in: Regenerate.
5238         (check_SCRIPTS): Add pr12826.sh
5239         (check_DATA): Add pr12826.stdout
5240         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5241         * testsuite/pr12826.sh: New file.
5242         * testsuite/pr12826_1.s: Ditto.
5243         * testsuite/pr12826_1.s: Ditto.
5244
5245 2011-05-30  Ian Lance Taylor  <iant@google.com>
5246
5247         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5248         sections.
5249
5250 2011-05-29  Ian Lance Taylor  <iant@google.com>
5251
5252         PR gold/12804
5253         * testsuite/Makefile.am: Use different file name for two_file_test
5254         temporary file for each incremental test.
5255         * testsuite/Makefile.in: Rebuild.
5256
5257 2011-05-29  Ian Lance Taylor  <iant@google.com>
5258
5259         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5260         binary input file is empty.
5261
5262 2011-05-27  Ian Lance Taylor  <iant@google.com>
5263
5264         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5265         (ver_test_9.so): Likewise.
5266         * testsuite/Makefile.in: Rebuild.
5267
5268 2011-05-26 Cary Coutant  <ccoutant@google.com>
5269
5270         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5271         * incremental.cc (Incremental_inputs::report_input_section): Fix
5272         comment, indentation.
5273         (Incremental_inputs::report_comdat_group): New function.
5274         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5275         of data for incremental input file entry.
5276         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5277         group count, COMDAT group signatures.
5278         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5279         an unchanged input file.
5280         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5281         Initialize new data member.
5282         (Incremental_object_entry::add_comdat_group): New function.
5283         (Incremental_object_entry::get_comdat_group_count): New function.
5284         (Incremental_object_entry::get_comdat_signature_key): New function.
5285         (Incremental_object_entry::groups_): New data member.
5286         (Incremental_inputs::report_comdat_group): New function.
5287         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5288         data for incremental input file entry.
5289         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5290         (Incremental_input_entry_reader::get_input_section): Adjust size of
5291         data for incremental input file entry.
5292         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5293         (Incremental_input_entry_reader::get_comdat_group_signature): New
5294         function.
5295         * object.cc (Sized_relobj::include_section_group): Report kept
5296         COMDAT groups for incremental links.
5297
5298 2011-05-24  David Meyer  <pdox@google.com>
5299
5300         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5301         with name parameter.  Add found_name parameter.
5302         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5303         * dirsearch.h (class Dirsearch): Update declaration.
5304
5305 2011-05-24  Ian Lance Taylor  <iant@google.com>
5306
5307         * archive.cc (Library_base::should_include_member): Pull in object
5308         from archive if it defines the entry symbol.
5309         * parameters.cc (Parameters::entry): New function.
5310         * parameters.h (class Parameters): Declare entry.
5311         * output.h (class Output_file_header): Remove entry_ field.
5312         * output.cc (Output_file_header::Output_file_header): Remove entry
5313         parameter.  Change all callers.
5314         (Output_file_header::entry): Use parameters->entry.
5315         * gold.cc (queue_middle_tasks): Likewise.
5316         * plugin.cc (Plugin_hook::run): Likewise.
5317
5318 2011-05-24 Cary Coutant  <ccoutant@google.com>
5319
5320         * gold.cc (queue_initial_tasks): Pass incremental base filename
5321         to Output_file::open_base_file; don't print error message.
5322         * incremental-dump.cc (main): Adjust call to
5323         Output_file::open_for_modification.
5324         * incremental-dump.cc (main): Likewise.
5325         * incremental.cc (Incremental_inputs::report_command_line):
5326         Ignore --incremental-base option when comparing command lines.
5327         Ignore parameter when given as separate argument.
5328         * options.h (class General_options): Add --incremental-base.
5329         * output.cc (Output_file::Output_file):
5330         (Output_file::open_base_file): Add base_name and writable parameters;
5331         read base file into new file; print error message here.
5332         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5333         callers.
5334         * output.h (Output_file::open_for_modification): Rename to...
5335         (Output_file::open_base_file): ...this; add base_name and
5336         writable parameters; adjust all callers.
5337         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5338         callers.
5339         * testsuite/Makefile.am (incremental_test_4): Test
5340         --incremental-base.
5341         * testsuite/Makefile.in: Regenerate.
5342
5343 2011-05-24 Cary Coutant  <ccoutant@google.com>
5344
5345         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5346         incremental_test_4.
5347         * testsuite/Makefile.in: Regenerate.
5348         * testsuite/two_file_test_1_v1.cc: New test source file.
5349         * testsuite/two_file_test_1b_v1.cc: New test source file.
5350         * testsuite/two_file_test_2_v1.cc: New test source file.
5351
5352 2011-05-24 Cary Coutant  <ccoutant@google.com>
5353
5354         * dynobj.h (Dynobj::do_dynobj): New function.
5355         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5356         flag and soname for shared objects.
5357         * incremental.cc (Incremental_inputs::report_object): Make
5358         either Incremental_object_entry or Incremental_dynobj_entry; add
5359         soname to string table.
5360         (Incremental_inputs::report_input_section): Add assertion.
5361         (Output_section_incremental_inputs::set_final_data_size): Adjust
5362         type of input file entry for shared libraries; adjust size of
5363         shared library info entry.
5364         (Output_section_incremental_inputs::write_input_files): Write
5365         as_needed flag for shared libraries.
5366         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5367         of input file entry for shared libraries; write soname.
5368         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5369         soname from incremental info.
5370         * incremental.h (enum Incremental_input_flags): Add
5371         INCREMENTAL_INPUT_AS_NEEDED.
5372         (Incremental_input_entry::Incremental_input_entry): Initialize new
5373         data member.
5374         (Incremental_input_entry::set_as_needed): New function.
5375         (Incremental_input_entry::as_needed): New function.
5376         (Incremental_input_entry::do_dynobj_entry): New function.
5377         (Incremental_input_entry::as_needed_): New data member.
5378         (Incremental_object_entry::Incremental_object_entry): Don't check
5379         for shared library.
5380         (Incremental_object_entry::do_type): Likewise.
5381         (class Incremental_dynobj_entry): New class.
5382         (Incremental_input_entry_reader::as_needed): New function.
5383         (Incremental_input_entry_reader::get_soname): New function.
5384         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5385         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5386         size of shared library info entry.
5387         * layout.cc (Layout::finish_dynamic_section): Don't test for
5388         incremental link when adding DT_NEEDED entries.
5389         * object.h (Object::Object): Initialize new data member.
5390         (Object::dynobj): New function.
5391         (Object::set_as_needed): New function.
5392         (Object::as_needed): New function.
5393         (Object::do_dynobj): New function.
5394         (Object::as_needed_): New data member.
5395
5396 2011-05-24 Cary Coutant  <ccoutant@google.com>
5397
5398         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5399         info; adjust display of GOT entries.
5400         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5401         vector of input objects; remove file_status_.
5402         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5403         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5404         got_plt reader; call target hooks to reserve GOT entries.
5405         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5406         of input file info header and GOT info entry.
5407         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5408         relocation info.
5409         (Got_plt_view_info::got_descriptor): Remove.
5410         (Got_plt_view_info::sym_index): New data member.
5411         (Got_plt_view_info::input_index): New data member.
5412         (Local_got_offset_visitor::visit): Write input file index.
5413         (Global_got_offset_visitor::visit): Write 0 for input file index.
5414         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5415         with sym_index and input_index.
5416         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5417         incremental info GOT entry; replace got_descriptor with input_index.
5418         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5419         map from input file index to object.
5420         (Sized_relobj_incr::do_layout): Replace direct data member reference
5421         with accessor function.
5422         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5423         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5424         Adjust size of input file info header.
5425         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5426         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5427         (Incremental_input_entry_reader::get_input_section): Adjust size of
5428         input file info header.
5429         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5430         of incremental info GOT entry.
5431         (Incremental_got_plt_reader::get_got_desc): Remove.
5432         (Incremental_got_plt_reader::get_got_symndx): New function.
5433         (Incremental_got_plt_reader::get_got_input_index): New function.
5434         (Sized_incremental_binary::Sized_incremental_binary): Remove
5435         file_status_; add input_objects_.
5436         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5437         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5438         (Sized_incremental_binary::file_is_unchanged): Remove.
5439         (Sized_incremental_binary::set_input_object): New function.
5440         (Sized_incremental_binary::input_object): New function.
5441         (Sized_incremental_binary::file_status_): Remove.
5442         (Sized_incremental_binary::input_objects_): New data member.
5443         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5444         references.
5445         (Sized_relobj_incr::invalid_address): Move to base class.
5446         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5447         class.
5448         (Sized_relobj_incr::do_output_section_offset): Likewise.
5449         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5450         (Sized_relobj_incr::section_offsets_): Likewise.
5451         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5452         function.
5453         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5454         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5455         with accessor function.
5456         (Sized_relobj_file::do_layout): Likewise.
5457         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5458         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5459         (Sized_relobj_file::compute_final_local_value): Replace refs to
5460         section_offsets_ with accessor function.
5461         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5462         * object.h (Relobj::Relobj): Initialize new data members.
5463         (Relobj::add_dyn_reloc): New function.
5464         (Relobj::first_dyn_reloc): New function.
5465         (Relobj::dyn_reloc_count): New function.
5466         (Relobj::first_dyn_reloc_): New data member.
5467         (Relobj::dyn_reloc_count_): New data member.
5468         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5469         references.
5470         (Sized_relobj::Address): New typedef.
5471         (Sized_relobj::invalid_address): Move here from child class.
5472         (Sized_relobj::Sized_relobj): Initialize new data members.
5473         (Sized_relobj::sized_relobj): New function.
5474         (Sized_relobj::is_output_section_offset_invalid): Move here from
5475         child class.
5476         (Sized_relobj::get_output_section_offset): Likewise.
5477         (Sized_relobj::local_has_got_offset): Likewise.
5478         (Sized_relobj::local_got_offset): Likewise.
5479         (Sized_relobj::set_local_got_offset): Likewise.
5480         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5481         (Sized_relobj::clear_got_offsets): New function.
5482         (Sized_relobj::section_offsets): Move here from child class.
5483         (Sized_relobj::do_output_section_offset): Likewise.
5484         (Sized_relobj::do_set_section_offset): Likewise.
5485         (Sized_relobj::Local_got_offsets): Likewise.
5486         (Sized_relobj::local_got_offsets_): Likewise.
5487         (Sized_relobj::section_offsets_): Likewise.
5488         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5489         references.
5490         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5491         class.
5492         (Sized_relobj_file::sized_relobj): New function
5493         (Sized_relobj_file::local_has_got_offset): Move to base class.
5494         (Sized_relobj_file::local_got_offset): Likewise.
5495         (Sized_relobj_file::set_local_got_offset): Likewise.
5496         (Sized_relobj_file::get_output_section_offset): Likewise.
5497         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5498         (Sized_relobj_file::do_output_section_offset): Likewise.
5499         (Sized_relobj_file::do_set_section_offset): Likewise.
5500         (Sized_relobj_file::Local_got_offsets): Likewise.
5501         (Sized_relobj_file::local_got_offsets_): Likewise.
5502         (Sized_relobj_file::section_offsets_): Likewise.
5503         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5504         (all constructors).
5505         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5506         (Output_reloc::get_symbol_index): Likewise.
5507         (Output_reloc::local_section_offset): Likewise.
5508         (Output_reloc::get_address): Likewise.
5509         (Output_reloc::symbol_value): Likewise.
5510         (Output_data_got::reserve_slot): Move to class definition.
5511         (Output_data_got::reserve_local): New function.
5512         (Output_data_got::reserve_slot_for_global): Remove.
5513         (Output_data_got::reserve_global): New function.
5514         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5515         (all constructors, two instantiations).
5516         (Output_reloc::get_relobj): New function (two instantiations).
5517         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5518         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5519         (Output_data_reloc::add_global): Adjust type of relobj.
5520         (Output_data_reloc::add_global_relative): Likewise.
5521         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5522         (Output_data_reloc::add_local): Likewise.
5523         (Output_data_reloc::add_local_relative): Likewise.
5524         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5525         (Output_data_reloc::add_local_section): Likewise.
5526         (Output_data_reloc::add_output_section): Likewise.
5527         (Output_data_reloc::add_absolute): Likewise.
5528         (Output_data_reloc::add_target_specific): Likewise.
5529         (Output_data_got::reserve_slot): Move definition here.
5530         (Output_data_got::reserve_local): New function.
5531         (Output_data_got::reserve_global): New function.
5532         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5533         section_offsets_ with accessor function.
5534         (Sized_relobj_file::write_sections): Likewise.
5535         (Sized_relobj_file::do_relocate_sections): Likewise.
5536         * target.h (Sized_target::reserve_local_got_entry): New function.
5537         (Sized_target::reserve_global_got_entry): New function.
5538         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5539         (Target_x86_64::reserve_global_got_entry): New function.
5540         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5541
5542 2011-05-23 Cary Coutant  <ccoutant@google.com>
5543
5544         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5545         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5546         bit when checking got_type.
5547         * incremental.cc (Sized_incremental_binary::setup_readers):
5548         Store symbol table and string table locations; initialize bit vector
5549         of file status flags.
5550         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5551         unchanged files.
5552         (Sized_incremental_binary::do_process_got_plt): New function.
5553         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5554         (Output_section_incremental_inputs::set_final_data_size): Record
5555         file index for each input file.
5556         (Output_section_incremental_inputs::write_got_plt): Store file index
5557         instead of input entry offset for each GOT entry.
5558         * incremental.h
5559         (Incremental_input_entry::Incremental_input_entry): Initialize new
5560         data member.
5561         (Incremental_input_entry::set_offset): Store file index.
5562         (Incremental_input_entry::get_file_index): New function.
5563         (Incremental_input_entry::file_index_): New data member.
5564         (Incremental_binary::process_got_plt): New function.
5565         (Incremental_binary::do_process_got_plt): New function.
5566         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5567         data members.
5568         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5569         (Sized_incremental_binary::set_file_is_unchanged): New function.
5570         (Sized_incremental_binary::file_is_unchanged): New function.
5571         (Sized_incremental_binary::do_process_got_plt): New function.
5572         (Sized_incremental_binary::file_status_): New data member.
5573         (Sized_incremental_binary::main_symtab_loc_): New data member.
5574         (Sized_incremental_binary::main_strtab_loc_): New data member.
5575         * output.cc (Output_data_got::Got_entry::write): Add case
5576         RESERVED_CODE.
5577         (Output_data_got::add_global): Call add_got_entry.
5578         (Output_data_got::add_global_plt): Likewise.
5579         (Output_data_got::add_global_with_rel): Likewise.
5580         (Output_data_got::add_global_with_rela): Likewise.
5581         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5582         (Output_data_got::add_global_pair_with_rela): Likewise.
5583         (Output_data_got::add_local): Call add_got_entry.
5584         (Output_data_got::add_local_plt): Likewise.
5585         (Output_data_got::add_local_with_rel): Likewise.
5586         (Output_data_got::add_local_with_rela): Likewise.
5587         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5588         (Output_data_got::add_local_pair_with_rela): Likewise.
5589         (Output_data_got::reserve_slot): New function.
5590         (Output_data_got::reserve_slot_for_global): New function.
5591         (Output_data_got::add_got_entry): New function.
5592         (Output_data_got::add_got_entry_pair): New function.
5593         (Output_section::add_output_section_data): Edit FIXME.
5594         * output.h
5595         (Output_section_data_build::Output_section_data_build): New
5596         constructor with size parameter.
5597         (Output_data_space::Output_data_space): Likewise.
5598         (Output_data_got::Output_data_got): Initialize new data member; new
5599         constructor with size parameter.
5600         (Output_data_got::add_constant): Call add_got_entry.
5601         (Output_data_got::reserve_slot): New function.
5602         (Output_data_got::reserve_slot_for_global): New function.
5603         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5604         (Output_data_got::add_got_entry): New function.
5605         (Output_data_got::add_got_entry_pair): New function.
5606         (Output_data_got::free_list_): New data member.
5607         * target.h (Sized_target::init_got_plt_for_update): New function.
5608         (Sized_target::register_global_plt_entry): New function.
5609         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5610         Initialize new data member; call init; add constructor with PLT count.
5611         (Output_data_plt_x86_64::init): New function.
5612         (Output_data_plt_x86_64::add_relocation): New function.
5613         (Output_data_plt_x86_64::reserve_slot): New function.
5614         (Output_data_plt_x86_64::free_list_): New data member.
5615         (Target_x86_64::init_got_plt_for_update): New function.
5616         (Target_x86_64::register_global_plt_entry): New function.
5617         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5618         incremental updates.
5619         (Output_data_plt_x86_64::add_relocation): New function.
5620         * testsuite/object_unittest.cc (Object_test): Set default options.
5621
5622 2011-05-16  Ian Lance Taylor  <iant@google.com>
5623
5624         * options.h (class General_options): Make -i a synonym for -r.
5625
5626 2011-05-16  Ian Lance Taylor  <iant@google.com>
5627
5628         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5629
5630 2011-05-10 Cary Coutant  <ccoutant@google.com>
5631
5632         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5633         strip_all (-s).
5634
5635 2011-05-06  Ian Lance Taylor  <iant@google.com>
5636
5637         * layout.cc (Layout::layout): If the output section flags change,
5638         update the ordering.
5639
5640 2011-04-25 Cary Coutant  <ccoutant@google.com>
5641
5642         * incremental-dump.cc (dump_incremental_inputs): Print local
5643         symbol info for each input file.
5644         * incremental.cc
5645         (Output_section_incremental_inputs::set_final_data_size): Add local
5646         symbol info to input file entries in incremental info.
5647         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5648         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5649         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5650         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5651         implementation.
5652         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5653         (Sized_incr_relobj::do_relocate): Write the local symbols.
5654         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5655         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5656         Adjust size of input file header.
5657         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5658         (Incremental_inputs_reader::get_local_symbol_count): New function.
5659         (Incremental_inputs_reader::get_input_section): Adjust size of input
5660         file header.
5661         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5662         (Sized_incr_relobj::This): New typedef.
5663         (Sized_incr_relobj::sym_size): New const data member.
5664         (Sized_incr_relobj::Local_symbol): New struct.
5665         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5666         (Sized_incr_relobj::do_local_symbol_offset): New function.
5667         (Sized_incr_relobj::local_symbol_count_): New data member.
5668         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5669         (Sized_incr_relobj::local_symbol_index_): New data member.
5670         (Sized_incr_relobj::local_symbol_offset_): New data member.
5671         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5672         (Sized_incr_relobj::local_symbols_): New data member.
5673         * object.h (Relobj::output_local_symbol_count): New function.
5674         (Relobj::local_symbol_offset): New function.
5675         (Relobj::do_output_local_symbol_count): New function.
5676         (Relobj::do_local_symbol_offset): New function.
5677         (Sized_relobj::do_output_local_symbol_count): New function.
5678         (Sized_relobj::do_local_symbol_offset): New function.
5679
5680 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5681
5682         * descriptors.cc (set_close_on_exec): New function.
5683         (Descriptors::open): Use set_close_on_exec.
5684         * output.cc (S_ISLNK): Define if not defined.
5685
5686 2011-04-22 Cary Coutant  <ccoutant@google.com>
5687
5688         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5689         global symbol map.
5690         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5691         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5692         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5693         relocations.
5694         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5695         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5696         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5697         * incremental.h
5698         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5699         function.
5700         (Incremental_binary::apply_incremental_relocs): New function.
5701         (Incremental_binary::do_apply_incremental_relocs): New function.
5702         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5703         data member.
5704         (Sized_incremental_binary::add_global_symbol): New function.
5705         (Sized_incremental_binary::global_symbol): New function.
5706         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5707         (Sized_incremental_binary::symbol_map_): New data member.
5708         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5709         * target.h (Sized_target::apply_relocation): New function.
5710         * target-reloc.h (apply_relocation): New function.
5711         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5712
5713 2011-04-22  Doug Kwan  <dougkwan@google.com>
5714
5715         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5716         flag of a SHT_ARM_EXIDX section.
5717         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5718         * testsuite/Makefile.in: Regenerate.
5719         * testsuite/arm_exidx_test.s: New file.
5720         * testsuite/arm_exidx_test.sh: Same.
5721
5722 2011-04-20 Cary Coutant  <ccoutant@google.com>
5723
5724         PR gold/12689
5725         * archive.h (Incremental_archive_entry::Archive_member):
5726         Initialize arg_serial_ (second constructor).
5727
5728 2011-04-17  Ian Lance Taylor  <iant@google.com>
5729
5730         * object.cc (Relocate_info::location): Simplify location string.
5731         * errors.cc (Errors::error_at_location): Don't print program
5732         name.
5733         (Errors::warning_at_location): Likewise.
5734         (Errors::undefined_symbol): Likewise.
5735         * testsuite/debug_msg.sh: Update accordingly.
5736
5737 2011-04-14 Cary Coutant  <ccoutant@google.com>
5738
5739         * gold/layout.cc (Layout::symtab_section_offset): New function.
5740         * gold/layout.h (Layout::symtab_section_offset): New function.
5741         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5742
5743 2011-04-12  Ian Lance Taylor  <iant@google.com>
5744
5745         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5746         with MREMAP_MAYMOVE.
5747         * output.h (class Output_file): Add map_is_allocated_ field.
5748         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5749         not available, provide stubs.  If mremap is not available, #define
5750         it to gold_mremap.
5751         (MREMAP_MAYMOVE): Define if not defined.
5752         (Output_file::Output_file): Initialize map_is_allocated_.
5753         (Output_file::resize): Check map_is_allocated_.
5754         (Output_file::map_anonymous): If mmap fails, use malloc.
5755         (Output_file::unmap): Don't do anything for an anonymous map.
5756         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5757         is not available, provide stubs.
5758         (File_read::View::~View): Use free rather than delete[].
5759         (File_read::make_view): Use malloc rather than new[].  If mmap
5760         fails, use malloc.
5761         (File_read::find_or_make_view): Use malloc rather than new[].
5762         * gold.h: Remove HAVE_REMAP code.
5763         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5764         exists.  Rename mremap to gold_mremap.  If mmap is not available
5765         don't do anything.
5766         * configure, config.in: Rebuild.
5767
5768 2011-04-11  Ian Lance Taylor  <iant@google.com>
5769
5770         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5771         initialize local variable v.
5772
5773 2011-04-11  Cary Coutant  <ccoutant@google.com>
5774
5775         * archive.cc (Archive::include_member): Adjust call to
5776         report_object.
5777         (Add_archive_symbols::run): Track argument serial numbers.
5778         (Lib_group::include_member): Likewise.
5779         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5780         * archive.h (Incremental_archive_entry::Archive_member):
5781         Initialize arg_serial_.
5782         (Archive_member::arg_serial_): New data member.
5783         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5784         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5785         incremental link.
5786         (Sized_dynobj::do_for_all_local_got_entries): New function.
5787         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5788         function.
5789         * fileread.cc (get_mtime): New function.
5790         * fileread.h (get_mtime): New function.
5791         * gold.cc (queue_initial_tasks): Check for incremental update.
5792         (process_incremental_input): New function.
5793         (queue_middle_tasks): Don't force valid target for incremental
5794         update.
5795         * incremental-dump.cc (find_input_containing_global): Adjust
5796         size of symbol info entry.
5797         (dump_incremental_inputs): Dump argument serial number and
5798         in_system_directory flag; bias shndx by 1; print symbol names
5799         when dumping per-file symbol lists; use new symbol info readers.
5800         * incremental.cc
5801         (Output_section_incremental_inputs:update_data_size): New function.
5802         (Sized_incremental_binary::setup_readers): Setup input readers
5803         for each input file; build maps for files added from libraries
5804         and scripts.
5805         (Sized_incremental_binary::check_input_args): New function.
5806         (Sized_incremental_binary::do_check_inputs): Build map of argument
5807         serial numbers to input arguments.
5808         (Sized_incremental_binary::do_file_has_changed): Rename
5809         do_file_is_unchanged to this; compare file modification times.
5810         (Sized_incremental_binary::do_init_layout): New function.
5811         (Sized_incremental_binary::do_reserve_layout): New function.
5812         (Sized_incremental_binary::do_get_input_reader): Remove.
5813         (Sized_incremental_binary::get_symtab_view): New function.
5814         (Incremental_checker::can_incrementally_link_output_file): Remove.
5815         (Incremental_inputs::report_command_line): Exclude --debug options.
5816         (Incremental_inputs::report_archive_begin): Add parameter; track
5817         argument serial numbers; don't put input file entry for archive
5818         before archive members.
5819         (Incremental_inputs::report_archive_end): Put input file entry
5820         for archive after archive members.
5821         (Incremental_inputs::report_object): Add parameter; track argument
5822         serial numbers and in_system_directory flag.
5823         (Incremental_inputs::report_script): Add parameter; track argument
5824         serial numbers.
5825         (Output_section_incremental_inputs::set_final_data_size): Adjust
5826         size of symbol info entry; check for forwarding symbols.
5827         (Output_section_incremental_inputs::write_input_files): Write
5828         in_system_directory flag and argument serial number.
5829         (Output_section_incremental_inputs::write_info_blocks): Map section
5830         indices between incremental info and original input file; store
5831         input section index for each symbol.
5832         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5833         change operator() to visit().
5834         (class Global_got_offset_visitor): Likewise.
5835         (class Global_symbol_visitor_got_plt):
5836         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5837         classes.
5838         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5839         (Sized_incr_relobj::do_read_symbols): New function.
5840         (Sized_incr_relobj::do_layout): New function.
5841         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5842         (Sized_incr_relobj::do_add_symbols): New function.
5843         (Sized_incr_relobj::do_should_include_member): New function.
5844         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5845         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5846         (Sized_incr_relobj::do_section_size): New function.
5847         (Sized_incr_relobj::do_section_name): New function.
5848         (Sized_incr_relobj::do_section_contents): New function.
5849         (Sized_incr_relobj::do_section_flags): New function.
5850         (Sized_incr_relobj::do_section_entsize): New function.
5851         (Sized_incr_relobj::do_section_address): New function.
5852         (Sized_incr_relobj::do_section_type): New function.
5853         (Sized_incr_relobj::do_section_link): New function.
5854         (Sized_incr_relobj::do_section_info): New function.
5855         (Sized_incr_relobj::do_section_addralign): New function.
5856         (Sized_incr_relobj::do_initialize_xindex): New function.
5857         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5858         (Sized_incr_relobj::do_read_relocs): New function.
5859         (Sized_incr_relobj::do_gc_process_relocs): New function.
5860         (Sized_incr_relobj::do_scan_relocs): New function.
5861         (Sized_incr_relobj::do_count_local_symbols): New function.
5862         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5863         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5864         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5865         (Sized_incr_relobj::do_relocate): New function.
5866         (Sized_incr_relobj::do_set_section_offset): New function.
5867         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5868         (Sized_incr_dynobj::do_read_symbols): New function.
5869         (Sized_incr_dynobj::do_layout): New function.
5870         (Sized_incr_dynobj::do_add_symbols): New function.
5871         (Sized_incr_dynobj::do_should_include_member): New function.
5872         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5873         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5874         (Sized_incr_dynobj::do_section_size): New function.
5875         (Sized_incr_dynobj::do_section_name): New function.
5876         (Sized_incr_dynobj::do_section_contents): New function.
5877         (Sized_incr_dynobj::do_section_flags): New function.
5878         (Sized_incr_dynobj::do_section_entsize): New function.
5879         (Sized_incr_dynobj::do_section_address): New function.
5880         (Sized_incr_dynobj::do_section_type): New function.
5881         (Sized_incr_dynobj::do_section_link): New function.
5882         (Sized_incr_dynobj::do_section_info): New function.
5883         (Sized_incr_dynobj::do_section_addralign): New function.
5884         (Sized_incr_dynobj::do_initialize_xindex): New function.
5885         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5886         (make_sized_incremental_object): New function.
5887         (Incremental_library::copy_unused_symbols): New function.
5888         (Incremental_library::do_for_all_unused_symbols): New function.
5889         * incremental.h (enum Incremental_input_flags): New type.
5890         (class Incremental_checker): Remove.
5891         (Incremental_input_entry::Incremental_input_entry): Add argument
5892         serial number.
5893         (Incremental_input_entry::arg_serial): New function.
5894         (Incremental_input_entry::set_is_in_system_directory): New function.
5895         (Incremental_input_entry::is_in_system_directory): New function.
5896         (Incremental_input_entry::arg_serial_): New data member.
5897         (Incremental_input_entry::is_in_system_directory_): New data member.
5898         (class Script_info): Move here from script.h.
5899         (Script_info::Script_info): Add filename parameter.
5900         (Script_info::filename): New function.
5901         (Script_info::filename_): New data member.
5902         (Incremental_script_entry::Incremental_script_entry): Add argument
5903         serial number.
5904         (Incremental_object_entry::Incremental_object_entry): Likewise.
5905         (Incremental_object_entry::add_input_section): Build list of input
5906         sections with map to original shndx.
5907         (Incremental_object_entry::get_input_section_index): New function.
5908         (Incremental_object_entry::shndx_): New data member.
5909         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5910         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5911         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5912         serial number.
5913         (Incremental_inputs::report_archive_begin): Likewise.
5914         (Incremental_inputs::report_object): Likewise.
5915         (Incremental_inputs::report_script): Likewise.
5916         (class Incremental_global_symbol_reader): New class.
5917         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5918         and store flags and input file type.
5919         (Incremental_input_entry_reader::arg_serial): New function.
5920         (Incremental_input_entry_reader::type): Extract type from flags.
5921         (Incremental_input_entry_reader::is_in_system_directory): New function.
5922         (Incremental_input_entry_reader::get_input_section_count): Call
5923         accessor function for type.
5924         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5925         function for type; adjust size of global symbol entry.
5926         (Incremental_input_entry_reader::get_global_symbol_count): Call
5927         accessor function for type.
5928         (Incremental_input_entry_reader::get_object_count): Likewise.
5929         (Incremental_input_entry_reader::get_object_offset): Likewise.
5930         (Incremental_input_entry_reader::get_member_count): Likewise.
5931         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5932         (Incremental_input_entry_reader::get_member_offset): Likewise.
5933         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5934         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5935         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5936         (Incremental_input_entry_reader::get_global_symbol_reader): New
5937         function.
5938         (Incremental_input_entry_reader::get_output_symbol_index): New
5939         function.
5940         (Incremental_input_entry_reader::type_): Remove.
5941         (Incremental_input_entry_reader::flags_): New data member.
5942         (Incremental_inputs_reader::input_file_offset): New function.
5943         (Incremental_inputs_reader::input_file_index): New function.
5944         (Incremental_inputs_reader::input_file): Call input_file_offset.
5945         (Incremental_inputs_reader::input_file_at_offset): New function.
5946         (Incremental_relocs_reader::get_r_type): Reformat.
5947         (Incremental_relocs_reader::get_r_shndx): Reformat.
5948         (Incremental_relocs_reader::get_r_offset): Reformat.
5949         (Incremental_relocs_reader::data): New function.
5950         (Incremental_binary::Incremental_binary): Initialize new data members.
5951         (Incremental_binary::check_inputs): Add cmdline parameter.
5952         (Incremental_binary::file_is_unchanged): Remove.
5953         (Input_reader::arg_serial): New function.
5954         (Input_reader::get_unused_symbol_count): New function.
5955         (Input_reader::get_unused_symbol): New function.
5956         (Input_reader::do_arg_serial): New function.
5957         (Input_reader::do_get_unused_symbol_count): New function.
5958         (Input_reader::do_get_unused_symbol): New function.
5959         (Incremental_binary::input_file_count): New function.
5960         (Incremental_binary::get_input_reader): Change signature to use
5961         index instead of filename.
5962         (Incremental_binary::file_has_changed): New function.
5963         (Incremental_binary::get_input_argument): New function.
5964         (Incremental_binary::get_library): New function.
5965         (Incremental_binary::get_script_info): New function.
5966         (Incremental_binary::init_layout): New function.
5967         (Incremental_binary::reserve_layout): New function.
5968         (Incremental_binary::output_file): New function.
5969         (Incremental_binary::do_check_inputs): New function.
5970         (Incremental_binary::do_file_is_unchanged): Remove.
5971         (Incremental_binary::do_file_has_changed): New function.
5972         (Incremental_binary::do_init_layout): New function.
5973         (Incremental_binary::do_reserve_layout): New function.
5974         (Incremental_binary::do_input_file_count): New function.
5975         (Incremental_binary::do_get_input_reader): Change signature.
5976         (Incremental_binary::input_args_map_): New data member.
5977         (Incremental_binary::library_map_): New data member.
5978         (Incremental_binary::script_map_): New data member.
5979         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5980         new data members.
5981         (Sized_incremental_binary::output_section): New function.
5982         (Sized_incremental_binary::inputs_reader): Add const.
5983         (Sized_incremental_binary::symtab_reader): Add const.
5984         (Sized_incremental_binary::relocs_reader): Add const.
5985         (Sized_incremental_binary::got_plt_reader): Add const.
5986         (Sized_incremental_binary::get_symtab_view): New function.
5987         (Sized_incremental_binary::Inputs_reader): New typedef.
5988         (Sized_incremental_binary::Input_entry_reader): New typedef.
5989         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5990         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5991         (Sized_incremental_binary::do_file_has_changed): New function.
5992         (Sized_incremental_binary::do_init_layout): New function.
5993         (Sized_incremental_binary::do_reserve_layout): New function.
5994         (Sized_input_reader::Inputs_reader): Remove.
5995         (Sized_input_reader::Input_entry_reader): Remove.
5996         (Sized_input_reader::do_arg_serial): New function.
5997         (Sized_input_reader::do_get_unused_symbol_count): New function.
5998         (Sized_input_reader::do_get_unused_symbol): New function.
5999         (Sized_incremental_binary::do_input_file_count): New function.
6000         (Sized_incremental_binary::do_get_input_reader): Change signature;
6001         use index instead of filename.
6002         (Sized_incremental_binary::section_map_): New data member.
6003         (Sized_incremental_binary::input_entry_readers_): New data member.
6004         (class Sized_incr_relobj): New class.
6005         (class Sized_incr_dynobj): New class.
6006         (make_sized_incremental_object): New function.
6007         (class Incremental_library): New class.
6008         * layout.cc (Free_list::num_lists): New static data member.
6009         (Free_list::num_nodes): New static data member.
6010         (Free_list::num_removes): New static data member.
6011         (Free_list::num_remove_visits): New static data member.
6012         (Free_list::num_allocates): New static data member.
6013         (Free_list::num_allocate_visits): New static data member.
6014         (Free_list::init): New function.
6015         (Free_list::remove): New function.
6016         (Free_list::allocate): New function.
6017         (Free_list::dump): New function.
6018         (Free_list::print_stats): New function.
6019         (Layout_task_runner::run): Resize output file for incremental updates.
6020         (Layout::Layout): Initialize new data members.
6021         (Layout::set_incremental_base): New function.
6022         (Layout::init_fixed_output_section): New function.
6023         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6024         incremental updates.
6025         (Layout::create_gold_note): Do not create gold note section for
6026         incremental updates.
6027         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6028         for incremental updates.
6029         (Layout::set_section_offsets): For incremental updates, allocate space
6030         from free list.
6031         (Layout::create_symtab_sections): Layout with offsets relative to
6032         start of section; for incremental updates, allocate space from free
6033         list.
6034         (Layout::create_shdrs): For incremental updates, allocate space from
6035         free list.
6036         (Layout::finish_dynamic_section): For incremental updates, do not
6037         check --as-needed (fixed in subsequent patch).
6038         * layout.h (class Free_list): New class.
6039         (Layout::set_incremental_base): New function.
6040         (Layout::incremental_base): New function.
6041         (Layout::init_fixed_output_section): New function.
6042         (Layout::allocate): New function.
6043         (Layout::incremental_base_): New data member.
6044         (Layout::free_list_): New data member.
6045         * main.cc (main): Print Free_list statistics.
6046         * object.cc (Relobj::finalize_incremental_relocs): Add
6047         clear_counts parameter; clear counts only when clear_counts is set.
6048         (Sized_relobj::Sized_relobj): Initialize new base class.
6049         (Sized_relobj::do_layout): Don't report special sections.
6050         (Sized_relobj::do_for_all_local_got_entries): New function.
6051         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6052         symtab_off to all symbol table offsets.
6053         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6054         * object.h (class Got_offset_list): Move to top of file.
6055         (Object::Object): Allow case where input_file == NULL.
6056         (Object::~Object): Likewise.
6057         (Object::input_file): Assert that input_file != NULL.
6058         (Object::lock): Allow case where input_file == NULL.
6059         (Object::unlock): Likewise.
6060         (Object::is_locked): Likewise.
6061         (Object::token): Likewise.
6062         (Object::release): Likewise.
6063         (Object::is_incremental): New function.
6064         (Object::get_mtime): New function.
6065         (Object::for_all_local_got_entries): New function.
6066         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6067         (Object::set_is_in_system_directory): New function.
6068         (Object::is_in_system_directory): New function.
6069         (Object::do_is_incremental): New function.
6070         (Object::do_get_mtime): New function.
6071         (Object::do_for_all_local_got_entries): New function.
6072         (Object::is_in_system_directory_): New data member.
6073         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6074         (class Sized_relobj_base): New class.
6075         (class Sized_relobj): Derive from Sized_relobj_base.
6076         (class Sized_relobj::Symbols): Redeclare from base class.
6077         (class Sized_relobj::local_got_offset_list): Remove.
6078         (class Sized_relobj::Output_sections): Redeclare from base class.
6079         (class Sized_relobj::do_for_all_local_got_entries): New function.
6080         (class Sized_relobj::write_local_symbols): Add offset parameter.
6081         (class Sized_relobj::local_symbol_offset_): Update comment.
6082         (class Sized_relobj::local_dynsym_offset_): Update comment.
6083         * options.cc (Input_arguments::add_file): Remove const.
6084         * options.h (Input_file_argument::Input_file_argument):
6085         Initialize arg_serial_ (all constructors).
6086         (Input_file_argument::set_arg_serial): New function.
6087         (Input_file_argument::arg_serial): New function.
6088         (Input_file_argument::arg_serial_): New data member.
6089         (Input_arguments::Input_arguments): Initialize file_count_.
6090         (Input_arguments::add_file): Remove const.
6091         (Input_arguments::number_of_input_files): New function.
6092         (Input_arguments::file_count_): New data member.
6093         (Command_line::number_of_input_files): Call
6094         Input_arguments::number_of_input_files.
6095         * output.cc (Output_segment_headers::Output_segment_headers):
6096         Set current size.
6097         (Output_section::Input_section::current_data_size): New function.
6098         (Output_section::Output_section): Initialize new data members.
6099         (Output_section::add_input_section): Don't do merge sections for
6100         an incremental link; allocate space from free list for an
6101         incremental update.
6102         (Output_section::add_output_section_data): Allocate space from
6103         free list for an incremental update.
6104         (Output_section::update_data_size): New function.
6105         (Output_section::set_fixed_layout): New function.
6106         (Output_section::reserve): New function.
6107         (Output_segment::set_section_addresses): Remove const.
6108         (Output_segment::set_section_list_addresses): Remove const; allocate
6109         space from free list for an incremental update.
6110         (Output_segment::set_offset): Adjust size of RELRO segment for an
6111         incremental update.
6112         * output.h (Output_data::current_data_size): Move here from
6113         child classes.
6114         (Output_data::pre_finalize_data_size): New function.
6115         (Output_data::update_data_size): New function.
6116         (Output_section_headers::update_data_size): new function.
6117         (Output_section_data_build::current_data_size): Move to Output_data.
6118         (Output_data_strtab::update_data_size): New function.
6119         (Output_section::current_data_size): Move to Output_data.
6120         (Output_section::set_fixed_layout): New function.
6121         (Output_section::has_fixed_layout): New function.
6122         (Output_section::reserve): New function.
6123         (Output_section::update_data_size): New function.
6124         (Output_section::has_fixed_layout_): New data member.
6125         (Output_section::free_list_): New data member.
6126         (Output_segment::set_section_addresses): Remove const.
6127         (Output_segment::set_section_list_addresses): Remove const.
6128         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6129         New function.
6130         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6131         New function.
6132         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6133         parameter when calling Add_symbols constructor; store argument
6134         serial number for members of a lib group.
6135         (Add_symbols::locks): Allow case where token == NULL.
6136         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6137         (Read_member::~Read_member): New function.
6138         (Read_member::is_runnable): New function.
6139         (Read_member::locks): New function.
6140         (Read_member::run): New function.
6141         (Check_script::~Check_script): New function.
6142         (Check_script::is_runnable): New function.
6143         (Check_script::locks): New function.
6144         (Check_script::run): New function.
6145         (Check_library::~Check_library): New function.
6146         (Check_library::is_runnable): New function.
6147         (Check_library::locks): New function.
6148         (Check_library::run): New function.
6149         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6150         (Add_symbols::library_): New data member.
6151         (class Read_member): New class.
6152         (class Check_script): New class.
6153         (class Check_library): New class.
6154         * reloc.cc (Read_relocs::is_runnable): Allow case where
6155         token == NULL.
6156         (Read_relocs::locks): Likewise.
6157         (Scan_relocs::locks): Likewise.
6158         (Relocate_task::locks): Likewise.
6159         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6160         to clear counters.
6161         (Sized_relobj::incremental_relocs_scan): Fix comment.
6162         (Sized_relobj::do_relocate): Pass output file offset to
6163         write_local_symbols.
6164         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6165         from class declaration.
6166         * script.cc (read_input_script): Allocate Script_info; pass
6167         argument serial number to report_script.
6168         * script.h (class Script_info): Move to incremental.h.
6169         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6170         * symtab.h (Symbol_table::add_from_incrobj): New function.
6171         (Symbol_table::set_file_offset): New function.
6172
6173 2011-04-05  Cary Coutant  <ccoutant@google.com>
6174
6175         * incremental-dump.cc (dump_incremental_inputs): Change signature
6176         to take a Sized_incremental_binary; change caller.  Use readers
6177         in Sized_incremental_binary.
6178         * incremental.cc
6179         (Sized_incremental_binary::find_incremental_inputs_sections):
6180         Rename do_find_incremental_inputs_sections to this.
6181         (Sized_incremental_binary::setup_readers): New function.
6182         (Sized_incremental_binary::do_check_inputs): Check
6183         has_incremental_info_ flag; move setup code to setup_readers;
6184         use input readers.
6185         (Sized_incremental_binary::do_file_is_unchanged): New function.
6186         (Sized_incremental_binary::do_get_input_reader): New function.
6187         * incremental.h (class Incremental_binary): Move to end of file.
6188         (Incremental_binary::file_is_unchanged): New function.
6189         (Incremental_binary::do_file_is_unchanged): New function.
6190         (Incremental_binary::Input_reader): New class.
6191         (Incremental_binary::get_input_reader): New function.
6192         (class Sized_incremental_binary): Move to end of file.
6193         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6194         input section reader classes.
6195         (Sized_incremental_binary::has_incremental_info): New function.
6196         (Sized_incremental_binary::inputs_reader): New function.
6197         (Sized_incremental_binary::symtab_reader): New function.
6198         (Sized_incremental_binary::relocs_reader): New function.
6199         (Sized_incremental_binary::got_plt_reader): New function.
6200         (Sized_incremental_binary::do_file_is_unchanged): New function.
6201         (Sized_incremental_binary::Sized_input_reader): New class.
6202         (Sized_incremental_binary::get_input_reader): New function.
6203         (Sized_incremental_binary::find_incremental_inputs_sections):
6204         Rename do_find_incremental_inputs_sections to this.
6205         (Sized_incremental_binary::setup_readers): New function.
6206         (Sized_incremental_binary::has_incremental_info_): New data member.
6207         (Sized_incremental_binary::inputs_reader_): New data member.
6208         (Sized_incremental_binary::symtab_reader_): New data member.
6209         (Sized_incremental_binary::relocs_reader_): New data member.
6210         (Sized_incremental_binary::got_plt_reader_): New data member.
6211         (Sized_incremental_binary::current_input_file_): New data member.
6212
6213 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6214
6215         PR gold/12640
6216         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6217         violation.
6218
6219 2011-03-30  Cary Coutant  <ccoutant@google.com>
6220
6221         * archive.cc (Archive::include_member): Adjust call to report_object.
6222         (Add_archive_symbols::run): Add script_info to call to
6223         report_archive_begin.
6224         (Lib_group::include_member): Adjust call to report_object.
6225         (Add_lib_group_symbols::run): Adjust call to report_object.
6226         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6227         blocks.  Add object count for script input files.
6228         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6229         script_info parameter; change all callers.
6230         (Incremental_inputs::report_object): Add script_info parameter;
6231         change all callers.
6232         (Incremental_inputs::report_script): Store backpointer to
6233         incremental info entry.
6234         (Output_section_incremental_inputs::set_final_data_size): Record
6235         additional information for scripts.
6236         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6237         * incremental.h (Incremental_script_entry::add_object): New function.
6238         (Incremental_script_entry::get_object_count): New function.
6239         (Incremental_script_entry::get_object): New function.
6240         (Incremental_script_entry::objects_): New data member; adjust
6241         constructor.
6242         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6243         (Incremental_inputs::report_object): Add script_info parameter.
6244         (Incremental_inputs_reader::get_object_count): New function.
6245         (Incremental_inputs_reader::get_object_offset): New function.
6246         * options.cc (Input_arguments::add_file): Return reference to
6247         new input argument.
6248         * options.h (Input_argument::set_script_info): New function.
6249         (Input_argument::script_info): New function.
6250         (Input_argument::script_info_): New data member; adjust all
6251         constructors.
6252         (Input_file_group::add_file): Return reference to new input argument.
6253         (Input_file_lib::add_file): Likewise.
6254         (Input_arguments::add_file): Likewise.
6255         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6256         * script.cc (Parser_closure::Parser_closure): Add script_info
6257         parameter; adjust all callers.
6258         (Parser_closure::script_info): New function.
6259         (Parser_closure::script_info_): New data member.
6260         (read_input_script): Report scripts earlier to incremental info.
6261         (script_add_file): Set script_info in Input_argument.
6262         (script_add_library): Likewise.
6263         * script.h (Script_options::Script_info): Rewrite class.
6264
6265 2011-03-29  Cary Coutant  <ccoutant@google.com>
6266
6267         * archive.cc (Library_base::should_include_member): Move
6268         method here from class Archive.
6269         (Archive::Archive): Initialize base class.
6270         (Archive::should_include_member): Move to base class.
6271         (Archive::do_for_all_unused_symbols): New function.
6272         (Add_archive_symbols::run): Remove redundant access to
6273         incremental_inputs.
6274         (Lib_group::Lib_group): Initialize base class.
6275         (Lib_group::do_filename): New function.
6276         (Lib_group::include_member): Pass pointer to Lib_group to
6277         report_object.
6278         (Lib_group::do_for_all_unused_symbols): New function.
6279         (Add_lib_group_symbols::run): Report archive information for
6280         incremental links.
6281         * archive.h (class Library_base): New base class.
6282         (class Archive): Derive from Library_base.
6283         (Archive::filename): Move to base class.
6284         (Archive::set_incremental_info): Likewise.
6285         (Archive::incremental_info): Likewise.
6286         (Archive::Should_include): Likewise.
6287         (Archive::should_include_member): Likewise.
6288         (Archive::Armap_entry): Remove.
6289         (Archive::Unused_symbol_iterator): Remove.
6290         (Archive::unused_symbols_begin): Remove.
6291         (Archive::unused_symbols_end): Remove.
6292         (Archive::do_filename): New function.
6293         (Archive::do_get_mtime): New function.
6294         (Archive::do_for_all_unused_symbols): New function.
6295         (Archive::task_): Move to base class.
6296         (Archive::incremental_info_): Likewise.
6297         (class Lib_group): Derive from Library_base.
6298         (Lib_group::do_filename): New function.
6299         (Lib_group::do_get_mtime): New function.
6300         (Lib_group::do_for_all_unused_symbols): New function.
6301         (Lib_group::task_): Move to base class.
6302         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6303         function.
6304         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6305         function.
6306         * incremental.cc (Incremental_inputs::report_archive_begin):
6307         Use Library_base; call library's get_mtime; add incremental inputs
6308         entry before members.
6309         (class Unused_symbol_visitor): New class.
6310         (Incremental_inputs::report_archive_end): Use Library_base; use
6311         visitor class to record unused symbols; don't add incremental inputs
6312         entry after members.
6313         (Incremental_inputs::report_object): Use Library_base.
6314         * incremental.h
6315         (Incremental_archive_entry::Incremental_archive_entry): Remove
6316         unused Archive parameter.
6317         (Incremental_inputs::report_archive_begin): Use Library_base.
6318         (Incremental_inputs::report_archive_end): Likewise.
6319         (Incremental_inputs::report_object): Likewise.
6320         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6321         function.
6322         * object.h (Object::for_all_global_symbols): New function.
6323         (Object::do_for_all_global_symbols): New function.
6324         (Sized_relobj::do_for_all_global_symbols): New function.
6325         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6326         function.
6327         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6328         function.
6329
6330 2011-03-27  Ian Lance Taylor  <iant@google.com>
6331
6332         * archive.cc (Archive::interpret_header): Return -1 if something
6333         goes wrong.  Change callers accordingly.
6334
6335 2011-03-25  Cary Coutant  <ccoutant@google.com>
6336
6337         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6338         * testsuite/Makefile.in: Regenerate.
6339
6340 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6341
6342         * plugin.cc (get_view): New.
6343         (Plugin::load): Pass get_view to the plugin.
6344         (Plugin_manager::get_view): New.
6345
6346 2011-03-21  Ian Lance Taylor  <iant@google.com>
6347
6348         * testsuite/final_layout.sh: Rewrite to not use dc.
6349         * testsuite/relro_test.sh: Fail if dc is not present.
6350
6351 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6352
6353         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6354         Change == to -eq.
6355         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6356         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6357         Change == to -eq.
6358         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6359         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6360
6361 2011-03-14  Ian Lance Taylor  <iant@google.com>
6362
6363         * script-sections.cc (Sort_output_sections::script_compare):
6364         Rename from is_before, change return type.
6365         (Sort_output_sections::operator()): Adjust accordingly.
6366
6367 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6368
6369         PR gold/12572
6370         * testsuite/odr_violation2.cc: Add comment to make all error line
6371         numbers double digits.
6372         * testsuite/debug_msg.sh: Adjust expected errors.
6373
6374 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6375
6376         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6377         but mark earlier ones as non-canonical
6378         (offset_to_iterator): Update search target and example
6379         (do_addr2line): Return extra lines in a vector*
6380         (format_file_lineno): Extract from do_addr2line
6381         (one_addr2line): Add vector* out-param
6382         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6383         when a lineno entry appeared last for its instruction
6384         (Dwarf_line_info): Add vector* out-param
6385         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6386         * symtab.cc (Odr_violation_compare): Include the lineno in the
6387         comparison again.
6388         (linenos_from_loc): New. Combine the canonical line for an
6389         address with its other lines.
6390         (True_if_intersect): New. Helper functor to make
6391         std::set_intersection a query.
6392         (detect_odr_violations): Compare sets of lines instead of just
6393         one line for each function. This became less deterministic, but
6394         has fewer false positives.
6395         * symtab.h: Declarations.
6396         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6397         mix an optimized and non-optimized object in the same binary
6398         (odr_violation2.so): Same.
6399         * testsuite/Makefile.in: Regenerate from Makefile.am.
6400         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6401         * testsuite/debug_msg.sh: Update line numbers and add
6402         assertions.
6403         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6404         non-optimized context.
6405         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6406         isn't inlined, and use OdrDerived in an optimized context.
6407         * testsuite/odr_header1.h: Defines OdrDerived, where
6408         optimization will change the
6409         first-instruction-in-the-destructor's file and line number.
6410         * testsuite/odr_header2.h: Defines OdrBase.
6411
6412 2011-03-09  Ian Lance Taylor  <iant@google.com>
6413
6414         * fileread.cc (File_read::clear_views): Don't delete the whole
6415         file view.
6416
6417 2011-03-08  Ian Lance Taylor  <iant@google.com>
6418
6419         PR gold/12525
6420         * fileread.cc: #include <climits>.
6421         (GOLD_IOV_MAX): Define.
6422         (File_read::read_multiple): Limit number of entries by iov_max.
6423         * fileread.h (class File_read): Always set max_readv_entries to
6424         128.
6425
6426 2011-03-07  Ian Lance Taylor  <iant@google.com>
6427
6428         PR gold/12525
6429         * options.h (class General_options): Add -dy and -dn.
6430
6431 2011-03-02  Cary Coutant  <ccoutant@google.com>
6432
6433         * testsuite/script_test_9.t: Add TLS segment.
6434
6435 2011-03-02  Simon Baldwin  <simonb@google.com>
6436
6437         * configure.ac: Add check for gnu_indirect_function support in
6438         the toolchain building binutils.
6439         * configure: Rebuild.
6440
6441 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6442
6443         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6444         plugin only symbols.
6445         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6446         in plugin files as not needed in the symbol table.
6447
6448 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6449
6450         * output.cc (Output_section::add_input_section): Delay fill
6451         generation for section ordering.
6452
6453 2011-02-09  Ian Lance Taylor  <iant@google.com>
6454
6455         PR gold/12316
6456         * object.h (class Sized_relobj): Remove clear_local_symbols.
6457         * reloc.cc (Sized_relobj::do_relocate): Don't call
6458         clear_local_symbols.
6459
6460 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6461
6462         * plugin.cc (is_visible_from_outside): Return true for symbols
6463         in the -u option.
6464
6465 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6466
6467         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6468         filename.
6469
6470 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6471
6472         * icf.h (is_section_foldable_candidate): Change type of parameter
6473         to std::string.
6474         * icf.cc (Icf::find_identical_sections): Change type of local variable
6475         section_name to be std::string.
6476         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6477
6478 2011-01-25  Ian Lance Taylor  <iant@google.com>
6479
6480         * script.cc (script_add_extern): Rewrite to use
6481         add_symbol_reference.
6482
6483 2011-01-25  Doug Kwan  <dougkwan@google.com>
6484
6485         * icf.cc (get_section_contents): Always lock section's object.
6486
6487 2011-01-24  Ian Lance Taylor  <iant@google.com>
6488
6489         * options.h (class General_options): Accept
6490         --no-detect-odr-violations.
6491
6492 2011-01-24  Ian Lance Taylor  <iant@google.com>
6493
6494         * version.cc (version_string): Bump to 1.11.
6495
6496 2011-01-24  Ian Lance Taylor  <iant@google.com>
6497
6498         * plugin.cc (class Plugin_rescan): Define new class.
6499         (Plugin_manager::claim_file): Set any_claimed_.
6500         (Plugin_manager::save_archive): New function.
6501         (Plugin_manager::save_input_group): New function.
6502         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6503         necessary.
6504         (Plugin_manager::new_undefined_symbol): New function.
6505         (Plugin_manager::rescan): New function.
6506         (Plugin_manager::rescannable_defines): New function.
6507         (Plugin_manager::add_input_file): Set any_added_.
6508         * plugin.h (class Plugin_manager): define new fields rescannable_,
6509         undefined_symbols_, any_claimed_, and any_added_.  Declare
6510         Plugin_rescan as friend.  Declare new functions.
6511         (Plugin_manager::Rescannable): Define type.
6512         (Plugin_manager::Rescannable_list): Define type.
6513         (Plugin_manager::Undefined_symbol_list): Define type.
6514         (Plugin_manager::Plugin_manager): Initialize new fields.
6515         * archive.cc (Archive::defines_symbol): New function.
6516         (Add_archive_symbols::run): Pass archive to plugins if any.
6517         * archive.h (class Archive): Declare defines_symbol.
6518         * readsyms.cc (Input_group::~Input_group): New function.
6519         (Finish_group::run): Pass input_group to plugins if any.
6520         * readsyms.h (class Input_group): Declare destructor.
6521         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6522         any.
6523
6524 2011-01-10  Ian Lance Taylor  <iant@google.com>
6525
6526         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6527         section as relro.
6528         (Layout::set_segment_offsets): Reset increase_relro before calling
6529         set_section_addresses a second time.
6530
6531 2011-01-04  Cary Coutant  <ccoutant@google.com>
6532
6533         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6534         sections before NOBITS sections.
6535
6536 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6537
6538         * version.cc (print_version): Update copyright to 2011.
6539
6540 2010-12-23  Cary Coutant  <ccoutant@google.com>
6541
6542         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6543         of OS to this->add.  Add OD parameter to second form of the function.
6544
6545 2010-12-20  Ian Lance Taylor  <iant@google.com>
6546
6547         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6548         second of two consecutive entries with same offset.
6549
6550 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6551
6552         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6553         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6554         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6555         to avoid unneeded links against $(LDADD).
6556         * testsuite/Makefile.in: Regenerate.
6557
6558 2010-12-15  Ian Lance Taylor  <iant@google.com>
6559
6560         PR gold/12324
6561         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6562         for R_X86_64_32 and R_X86_64_PC32.
6563         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6564         ver_matching_def_pic.o.
6565         (ver_matching_def_pic.o): New target.
6566
6567 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6568
6569         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6570         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6571         Move definition before File_read::View member definitions.
6572         (File_read::View::~View): Initialize and hold lock before
6573         updating current_mapped_bytes.
6574
6575 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6576
6577         * dwarf_reader.cc: Remove outdated comment.
6578         * gold-threads.cc: Fix typo in error message.
6579         * archive.cc: Fix typos in comments.
6580         * archive.h: Likewise.
6581         * arm-reloc-property.cc: Likewise.
6582         * arm-reloc-property.h: Likewise.
6583         * arm-reloc.def: Likewise.
6584         * arm.cc: Likewise.
6585         * attributes.h: Likewise.
6586         * cref.cc: Likewise.
6587         * ehframe.cc: Likewise.
6588         * fileread.h: Likewise.
6589         * gold.h: Likewise.
6590         * i386.cc: Likewise.
6591         * icf.cc: Likewise.
6592         * incremental.h: Likewise.
6593         * int_encoding.cc: Likewise.
6594         * layout.h: Likewise.
6595         * main.cc: Likewise.
6596         * merge.h: Likewise.
6597         * object.cc: Likewise.
6598         * object.h: Likewise.
6599         * options.cc: Likewise.
6600         * readsyms.cc: Likewise.
6601         * reduced_debug_output.cc: Likewise.
6602         * reloc.cc: Likewise.
6603         * script-sections.cc: Likewise.
6604         * sparc.cc: Likewise.
6605         * symtab.h: Likewise.
6606         * target-reloc.h: Likewise.
6607         * target.cc: Likewise.
6608         * target.h: Likewise.
6609         * timer.cc: Likewise.
6610         * timer.h: Likewise.
6611         * x86_64.cc: Likewise.
6612
6613 2010-12-09  Cary Coutant  <ccoutant@google.com>
6614
6615         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6616         stack.
6617         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6618         parameter; change all callers.
6619         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6620         * options.h (warn_execstack): New option.
6621
6622 2010-12-07  Doug Kwan  <dougkwan@google.com>
6623
6624         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6625         like function call relocations.
6626
6627 2010-12-07  Ian Lance Taylor  <iant@google.com>
6628
6629         * archive.cc (Archive::get_elf_object_for_member): Permit
6630         punconfigured to be NULL.
6631         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6632         (Archive::include_member): Pass NULL to get_elf_object_for_member
6633         if we searched for the archive and this is the first included
6634         object.
6635
6636 2010-12-01  Ian Lance Taylor  <iant@google.com>
6637
6638         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6639         track_relocs_type_ field.
6640         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6641         Set track_relocs_type_.
6642         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6643         contents when using RELA relocs.
6644         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6645         reloc_map_.
6646         * reloc.cc (Track_relocs::next_addend): New function.
6647         * reloc.h (class Track_relocs): Declare next_addend.
6648
6649 2010-12-01  Ian Lance Taylor  <iant@google.com>
6650
6651         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6652         virtual destructor.
6653
6654 2010-12-01  Ian Lance Taylor  <iant@google.com>
6655
6656         * README: Update compilers known to work and fail.
6657
6658 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6659
6660         * configure.in: For --enable-gold, handle value `default' instead of
6661         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6662         not the default.
6663         * configure: Regenerate.
6664
6665 2010-11-18  Doug Kwan  <dougkwan@google.com>
6666
6667         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6668         and right_alignment to be zero.  Store result alignment only if it is
6669         greater than existing alignment.
6670
6671 2010-11-16  Cary Coutant  <ccoutant@google.com>
6672
6673         PR gold/12220
6674         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6675         Check for ".zdebug_line".
6676
6677 2010-11-16  Doug Kwan  <dougkwan@google.com>
6678             Cary Coutant  <ccoutant@google.com>
6679
6680         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6681         by reference; adjust all callers.
6682         * output.cc (Output_segment::set_section_addresses): Adjust references
6683         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6684         list is empty.
6685         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6686         end at page boundary.
6687
6688 2010-11-16  Cary Coutant  <ccoutant@google.com>
6689
6690         PR gold/12220
6691         * layout.cc (Layout::choose_output_section): Transform names of
6692         compressed sections even when using a script with a SECTIONS clause.
6693         (Layout::output_section_name): Remove code to transform
6694         compressed debug section names.
6695         * output.cc (Output_section::add_input_section): Use uncompressed
6696         section size when tracking input sections.
6697
6698 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6699
6700         * symtab.h (Symbol::NON_PIC_REF): Remove.
6701         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6702         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6703         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6704         (Symbol::use_plt_offset): Take a flags argument and pass it
6705         directly to needs_dynamic_reloc.  Restrict check for undefined
6706         weak symbols to function calls.
6707         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6708         (Target_arm::Scan::global): Use it.
6709         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6710         (Target_arm::Relocate::relocate): Likewise.
6711         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6712         parameter with an r_type parameter.  Use get_reference_flags
6713         to get the flags.
6714         (Target_arm::Relocate::relocate): Update accordingly.
6715         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6716         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6717         (Target_i386::Scan::global): Likewise.
6718         (Target_i386::Relocate::relocate): Likewise.
6719         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6720         parameter with an r_type parameter.  Use get_reference_flags
6721         to get the flags.
6722         (Target_i386::Relocate::relocate): Update accordingly.
6723         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6724         (Target_powerpc::Scan::global): Use it.
6725         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6726         (Target_powerpc::Relocate::relocate): Likewise.
6727         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6728         (Target_sparc::Scan::global): Use it.
6729         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6730         (Target_sparc::Relocate::relocate): Likewise.
6731         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6732         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6733         (Target_x86_64::Scan::global): Likewise.
6734         (Target_x86_64::Relocate::relocate): Likewise.
6735
6736 2010-11-08  Doug Kwan  <dougkwan@google.com>
6737             Cary Coutant  <ccoutant@google.com>
6738
6739         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6740         (Arm_exidx_merge_section::section_contents_): New data member.
6741         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6742         (Arm_input_section::~Arm_input_section): De-allocate memory.
6743         (Arm_input_section::original_contents_): New data member.
6744         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6745         in parameters instead of calling Object::section_contents without
6746         locking.
6747         (Arm_output_section::group_section): New parameter TASK.  Pass it
6748         to callees that need locking objects.
6749         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6750         to lock EXIDX input sections.  Fix a formatting issue.  Call
6751         Arm_exidx_merged_section::build_contents to create merged section
6752         contents.
6753         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6754         to lock object of stub table owner.
6755         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6756         TEXT_SIZE to initialize data member TEXT_SIZE_.
6757         (Arm_exidx_input_section::addralign): Fix typo in comment.
6758         (Arm_exidx_input_section::text_size): New method.
6759         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6760         that require locking objects.  Lock objects before scanning for stubs
6761         and updating local symbols.
6762         (Arm_input_section<big_endian>::init): Copy contents of original
6763         input section.
6764         (Arm_input_section<big_endian>::do_write): Use saved contents of
6765         original input section instead of calling Object::section_contents
6766         without locking.
6767         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6768         size without calling Object::section_size().
6769         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6770         for size.  Allocate a buffer for merged EXIDX entries.
6771         (Arm_exidx_merged_section::build_contents): New method.
6772         (Arm_exidx_merged_section::do_write): Move merge section contents
6773         building code to Arm_exidx_merged_section::build_contetns.  Write
6774         out contetns in buffer instead of building it on the fly.
6775         (Arm_relobj::make_exidx_input_section): Also pass text section size
6776         to Arm_exidx_input_section constructor.
6777         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6778         (Arm_dynobj::do_read_symbols): Fix memory leak.
6779         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6780         * target.h: (class Task): Add forward declaration.
6781         (Target::relax): Add new parameter TASK and pass it to
6782         Target::do_relax().
6783         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6784
6785 2010-11-05  Cary Coutant  <ccoutant@google.com>
6786
6787         PR gold/10708
6788         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6789         object when reading from the file.
6790         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6791         second layout pass.
6792         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6793         when reading section contents.
6794         (get_section_contents): Likewise.
6795         (icf::find_identical_sections): Likewise.
6796         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6797         object when reading from the file.
6798         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6799         the object when doing deferred section layout.
6800
6801 2010-11-03  Nick Clifton  <nickc@redhat.com>
6802
6803         PR gold/12001
6804         * script.h (class Symbol_assignment: name): New member.  Returns
6805         the name of the symbol.
6806         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6807         Returns true if the given symbol name is on the list of
6808         assignments wating to be processed.
6809         * archive.cc (should_incldue_member): If the symbol is undefined,
6810         check to see if it is on the list of symbols pending assignment.
6811
6812 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6813
6814         * script-sections.cc (Script_sections::find_memory_region): Check
6815         for a NULL output section pointer.
6816
6817 2010-10-29  Doug Kwan  <dougkwan@google.com>
6818
6819         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6820         Output_section::add_relaxed_input_section.
6821         * output.cc (Output_section::add_relaxed_input_section): Add new
6822         arguments LAYOUT and NAME.  Set section order index.
6823         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6824         Copy section order index.
6825         * output.h (Output_section::add_relaxed_input_section): Add new
6826         arguments LAYOUT and NAME.
6827
6828 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6829
6830         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6831         NATIVE_OR_CROSS_LINKER.
6832         * testsuite/Makefile.in: Regenerate.
6833
6834 2010-10-20  Doug Kwan  <dougkwan@google.com>
6835
6836         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6837         without SHF_LINK_ORDER flags.
6838         * layout.cc (Layout::choose_output_section): Do not filter
6839         SHF_LINK_ORDER flag in a relocatable link.
6840
6841 2010-10-17  Cary Coutant  <ccoutant@google.com>
6842
6843         * output.h (Output_segment::set_section_addresses): Change function
6844         signature.  Update all callers.
6845         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6846         sections.
6847         (Output_segment::set_section_addresses): Align after last TLS
6848         section.  Add padding before last relro section instead of after.
6849
6850 2010-10-17  Doug Kwan  <dougkwan@google.com>
6851
6852         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6853         GOT output section to be writable.
6854
6855 2010-10-14  Cary Coutant  <ccoutant@google.com>
6856
6857         * debug.h (DEBUG_INCREMENTAL): New flag.
6858         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6859         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6860         mode.
6861         * incremental.cc (report_command_line): Ignore all forms of
6862         --incremental.
6863         * layout.cc (Layout::Layout): Check parameters for incremental link
6864         mode.
6865         * options.cc (General_options::parse_incremental): New function.
6866         (General_options::parse_no_incremental): New function.
6867         (General_options::parse_incremental_full): New function.
6868         (General_options::parse_incremental_update): New function.
6869         (General_options::incremental_mode_): New data member.
6870         (General_options::finalize): Check incremental_mode_.
6871         * options.h (General_options): Update help text for --incremental.
6872         Add --no-incremental, --incremental-full, --incremental-update.
6873         (General_options::Incremental_mode): New enum type.
6874         (General_options::incremental_mode): New function.
6875         (General_options::incremental_mode_): New data member.
6876         * parameters.cc (Parameters::incremental_mode_): New data member.
6877         (Parameters::set_options): Set incremental_mode_.
6878         (Parameters::set_incremental_full): New function.
6879         (Parameters::incremental): New function.
6880         (Parameters::incremental_update): New function.
6881         (set_parameters_incremental_full): New function.
6882         * parameters.h (Parameters::set_incremental_full): New function.
6883         (Parameters::incremental): New function.
6884         (Parameters::incremental_update): New function.
6885         (Parameters::incremental_mode_): New data member.
6886         (set_parameters_incremental_full): New function.
6887         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6888         incremental link mode.
6889         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6890         (Sized_relobj::do_relocate_sections): Likewise.
6891         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6892         option.
6893         * testsuite/Makefile.in: Regenerate.
6894         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6895
6896 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6897
6898         * script-sections.h (class Script_sections): Make
6899         Sections_elements typedef public.
6900         * script-sections.cc (class Sort_output_sections): Add elements_
6901         field.  Add constructor which sets it; change all callers.
6902         (Sort_output_sections::is_before): New function.
6903         (Sort_output_sections::operator()): Call is_before.
6904         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6905         conditional.
6906         * testsuite/script_test_10.sh: New test. Test script section
6907         order.
6908         * testsuite/script_test_10.t: Likewise.
6909         * testsuite/script_test_10.s: Likewise.
6910         * testsuite/Makefile.am: Wrap the cross linker tests and the
6911         common tests into NATIVE_OR_CROSS_LINKER.
6912         (check_SCRIPTS): Add script_test_10.sh.
6913         (check_DATA): Add script_test_10.stdout.
6914         (script_test_10.o, script_test_10): New targets.
6915         (script_test_10.stdout): New target.
6916         * configure, testsuite/Makefile.in: Regenerate.
6917
6918 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6919
6920         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6921         error for the deprecated relocations.
6922         (Target_arm::Scan::global): Likewise.
6923         (Target_arm::Relocate::relocate): Likewise.
6924
6925 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6926
6927         * fileread.cc (Input_file::find_file): Initialize *found_name
6928         and *namep when using the fallback search for case 4.
6929
6930 2010-10-11  Cary Coutant  <ccoutant@google.com>
6931
6932         * options.h (class General_options): Redefine -z lazy as an alias for
6933         the negation of -z now.
6934
6935 2010-10-11  Ian Lance Taylor  <iant@google.com>
6936
6937         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6938         binding.
6939
6940 2010-10-06  Nick Clifton  <nickc@redhat.com>
6941
6942         * script-sections.cc(class Memory_region): Remove
6943         current_lma_offset_ field.  Rename current_vma_offset_ to
6944         current_offset_.  Add last_section_ field.
6945         (Memory_region::get_current_vma_address): Rename to
6946         get_current_address.
6947         (Memory_region::get_current_lma_address): Delete.
6948         (Memory_region::increment_vma_offset): Rename to
6949         increment_offset.
6950         (Memory_region::increment_lma_offset): Delete.
6951         (Memory_region::attributes_compatible): New method.  Returns
6952         true if the provided section is compatible with the region.
6953         (Memory_region::get_last_section): New method.  Returns the last
6954         section to use the region.
6955         (Memory_region::set_last_section): New method.  Stores the last
6956         section to use the region.
6957         (Script_sections::block_in_region): New method.  Returns true if
6958         a block of memory is contained within a region.
6959         (Script_sections::find_memory_region): New method.  Locates a
6960         memory region to be used to set a VMA or LMA address.
6961         (Output_section_definition::set_section_addresses): Add code to
6962         check for addresses set by memory regions.
6963         (Output_segment::set_section_addresses): Remove memory region
6964         walking code.
6965         (Script_sections::create_segment): Add a warning if a header
6966         segment is created outside of any region.
6967         * script-sections.h (class Script_sections): Add prototypes for
6968         find_memory_region and block_in_region methods.
6969         * testsuite/memory_test.s: Use .long instead of .word.
6970         * testsuite/memory_test.t: Add some more output sections.
6971         * testsuite/memory_test.sh: Update expected output.
6972
6973 2010-10-02  Doug Kwan  <dougkwan@google.com>
6974
6975         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6976         defintion to symtab.h
6977         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6978         declaration to defintion.
6979
6980 2010-10-01  Nick Clifton  <nickc@redhat.com>
6981
6982         * expression.cc (eval): Replace dummy argument with NULL.
6983         (eval_maybe_dot): Check for a NULL result section pointer.
6984         (Symbol_expression::value): Likewise.
6985         (Dot_expression::value): Likewise.
6986         (BINARY_EXPRESSION): Likewise.
6987         (Max_expression::value): Likewise.
6988         (Min_expression::value): Likewise.
6989         (Absolute_expression::value): Likewise.
6990         (Addr_expression::value_from_output_section): Likewise.
6991         (Loaddddr_expression::value_from_output_section): Likewise.
6992         (Segment_start_expression::value): Likewise.
6993         * script-sections.cc
6994         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6995         argument with NULL.
6996         (Sections_elememt_dot_assignment::set_section_addresses):
6997         Likewise.
6998         (Output_data_expression::do_write_to_buffer): Likewise.
6999         (Output_section_definition::finalize_symbols): Likewise.
7000         (Output_section_definition::set_section_addresses): Likewise.
7001
7002 2010-09-30  Doug Kwan  <dougkwan@google.com>
7003
7004         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7005
7006 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7007
7008         * target.h (Target::can_icf_inline_merge_sections): New virtual
7009         function.
7010         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7011         virtual function.
7012         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7013         virtual function.
7014         * icf.cc (get_section_contents): Inline merge sections only when
7015         target allows it.
7016
7017 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7018
7019         * configure: Regenerate.
7020
7021 2010-09-17  Ian Lance Taylor  <iant@google.com>
7022
7023         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7024         * testsuite/Makefile.am (memory_test.o): New target.
7025         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7026         memory_test.t.
7027         * testsuite/Makefile.in: Rebuild.
7028
7029 2010-09-17  Doug Kwan  <dougkwan@google.com>
7030
7031         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7032         defintion if relocation uses GOT entries of the symbol.
7033         * testsuite/icf_safe_test.sh: Fix test.
7034         * testsuite/icf_safe_so_test.sh: Fix test.
7035
7036 2010-09-16  Cary Coutant  <ccoutant@google.com>
7037
7038         * script_sections.cc (class Memory_region): Remove "NULL" from
7039         vector initializations.
7040
7041 2010-09-15  Cary Coutant  <ccoutant@google.com>
7042
7043         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7044         Resolve forwarding symbols.
7045
7046 2010-09-15  Doug Kwan  <dougkwan@google.com>
7047
7048         * gold/testsuite/script_test_3.t: Add ARM special sections.
7049         * gold/testsuite/script_test_4.t: Same.
7050         * gold/testsuite/script_test_5.t: Same.
7051         * gold/testsuite/script_test_6.t: Same.
7052         * gold/testsuite/script_test_7.t: Same.
7053         * gold/testsuite/script_test_7.t: Same.
7054         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7055
7056 2010-09-14  Cary Coutant  <ccoutant@google.com>
7057
7058         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7059         (Target_x86_64::Relocate::relocate_tls): Replace check for
7060         saw_tls_block_reloc_ with test for executable section.
7061
7062 2010-09-12  Cary Coutant  <ccoutant@google.com>
7063
7064         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7065         position-independent executables to shared libraries need dynamic
7066         relocations.
7067         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7068         position-independent executables.
7069         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7070         * testsuite/Makefile.in: Regenerate.
7071
7072 2010-09-10  Nick Clifton  <nickc@redhat.com>
7073
7074         PR gold/11997
7075         * testsuite/memory_test.t: Discard any sections that are not
7076         needed.
7077
7078 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7079
7080         PR gold/11996
7081         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7082         "This::" to work around a bug in gcc 4.2.
7083
7084         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7085
7086 2010-09-09  Rafael Espindola  <espindola@google.com>
7087
7088         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7089         sections with different PF_X flags in the same segment.
7090         (Layout::find_first_load_seg): Search all segments to find the first
7091         one.
7092         * options.h (rosegment): New.
7093
7094 2010-09-08  Rafael Espindola  <espindola@google.com>
7095
7096         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7097
7098 2010-09-08  Doug Kwan  <dougkwan@google.com>
7099
7100         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7101         (Arm_relobj::do_relocate_sections): Add new parameter for output
7102         file to match the parent.
7103         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7104         of local symbols instead of input values.  Update code to track
7105         changes in gold::relocate_section.
7106         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7107         (Sized_relobj::compute_final_local_value_internal): New methods.
7108         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7109         body into private version of Sized_relobj::compute_final_local_value.
7110         Call the inline method.
7111         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7112         merged symbol value if there is one.
7113         (Symbol_value::has_output_value): New method defintiion.
7114         (Sized_relobj::Compute_final_local_value_status): New enum type.
7115         (Sized_relobj::compute_final_local_value): New methods.
7116         (Sized_relobj::compute_final_local_value_internal): New methods.
7117         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7118         and arm_cortex_a8.sh.
7119         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7120         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7121         New tests.
7122         * Makefile.in: Regenerate.
7123         * testsuite/arm_bl_out_of_range.s: Update test.
7124         * testsuite/thumb_bl_out_of_range.s: Ditto.
7125         * testsuite/thumb_blx_out_of_range.s: Ditto.
7126         * testsuite/arm_branch_out_of_range.sh: New file.
7127         * testsuite/arm_cortex_a8.sh: Ditto.
7128         * testsuite/arm_cortex_a8_b.s: Ditto.
7129         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7130         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7131         * testsuite/arm_cortex_a8_bl.s: Ditto.
7132         * testsuite/arm_cortex_a8_blx.s: Ditto.
7133         * testsuite/arm_cortex_a8_local.s: Ditto.
7134         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7135         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7136
7137 2010-09-08  Rafael Espindola  <espindola@google.com>
7138
7139         * Makefile.am (memory_test.stdout): Run readelf with -W.
7140         * Makefile.in: Regenerate.
7141         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7142         64 bit output.
7143
7144 2010-09-08  Rafael Espindola  <espindola@google.com>
7145
7146         * script-sections.cc (Script_sections::add_memory_region): Convert
7147         field precision to int.
7148         * script.cc (script_set_section_region, script_set_section_region):
7149         Convert field precision to int.
7150
7151 2010-09-08  Rafael Espindola  <espindola@google.com>
7152
7153         * arm.cc (do_finalize_sections): Create the __exidx_start and
7154         __exdix_end symbols even when the section is missing.
7155
7156 2010-09-08  Nick Clifton  <nickc@redhat.com>
7157
7158         * README: Remove claim that MEMORY is not supported.
7159         * expression.cc (script_exp_function_origin)
7160         (script_exp_function_length): Move from here to ...
7161         * script.cc: ... here.
7162         (script_set_section_region, script_add_memory)
7163         (script_parse_memory_attr, script_include_directive): New
7164         functions.
7165         * script-sections.cc
7166         (class Memory_region): New class.
7167         (class Output_section_definition): Add set_memory_region,
7168         set_section_vma, set_section_lma and get_section_name methods.
7169         (class Script_Sections): Add add_memory_region,
7170         find_memory_region, find_memory_region_origin,
7171         find_memory_region_length and set_memory_region methods.
7172         Have set_section_addresses method walk the list of set memory
7173         regions.
7174         Extend the print methos to display memory regions.
7175         * script-sections.h: Add prototypes for new methods.
7176         Add enum for MEMORY region attributes.
7177         * yyscript.y: Add support for parsing MEMORY regions.
7178         * script-c.h: Add prototypes for new functions.
7179         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7180         * testsuite/Makefile.in: Regenerate.
7181         * testsuite/memory_test.sh: New script.
7182         * testsuite/memory_test.s: New assembler source file.
7183         * testsuite/memory_test.t: New linker script.
7184
7185 2010-08-27  Doug Kwan  <dougkwan@google.com>
7186
7187         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7188         reference override an existing dynamic weak reference.
7189         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7190         * testsuite/Makefile.in: Regenerate.
7191         * testsuite/dyn_weak_ref.sh: New file.
7192         * testsuite/dyn_weak_ref_1.c: Ditto.
7193         * testsuite/dyn_weak_ref_2.c: Ditto.
7194
7195 2010-08-27  Ian Lance Taylor  <iant@google.com>
7196
7197         * incremental.h (class Incremental_input_entry): Add virtual
7198         destructor.
7199
7200 2010-08-27  Ian Lance Taylor  <iant@google.com>
7201
7202         * testsuite/start_lib_test_3.c: Mark t3 as used.
7203
7204 2010-08-27  Nick Clifton  <nickc@redhat.com>
7205
7206         * options.cc (version_script): Fix small typo in previous
7207         whitespace tidyup.
7208
7209 2010-08-25  Nick Clifton  <nickc@redhat.com>
7210
7211         * archive.cc: Formatting fixes: Remove whitespace between
7212         typename and following asterisk.  Remove whitespace between
7213         function name and opening parenthesis.
7214         * archive.h: Likewise.
7215         * arm.cc: Likewise.
7216         * attributes.cc: Likewise.
7217         * attributes.h: Likewise.
7218         * common.cc: Likewise.
7219         * copy-relocs.cc: Likewise.
7220         * dirsearch.h: Likewise.
7221         * dynobj.cc: Likewise.
7222         * ehframe.cc: Likewise.
7223         * ehframe.h: Likewise.
7224         * expression.cc: Likewise.
7225         * fileread.cc: Likewise.
7226         * fileread.h: Likewise.
7227         * gc.h: Likewise.
7228         * gold-threads.cc: Likewise.
7229         * gold.cc: Likewise.
7230         * i386.cc: Likewise.
7231         * icf.h: Likewise.
7232         * incremental-dump.cc: Likewise.
7233         * incremental.cc: Likewise.
7234         * layout.cc: Likewise.
7235         * layout.h: Likewise.
7236         * main.cc: Likewise.
7237         * merge.cc: Likewise.
7238         * merge.h: Likewise.
7239         * object.cc: Likewise.
7240         * object.h: Likewise.
7241         * options.cc: Likewise.
7242         * options.h: Likewise.
7243         * output.cc: Likewise.
7244         * output.h: Likewise.
7245         * plugin.cc: Likewise.
7246         * plugin.h: Likewise.
7247         * powerpc.cc: Likewise.
7248         * reloc.cc: Likewise.
7249         * script-c.h: Likewise.
7250         * script-sections.cc: Likewise.
7251         * script.cc: Likewise.
7252         * stringpool.cc: Likewise.
7253         * symtab.cc: Likewise.
7254         * symtab.h: Likewise.
7255         * target.cc: Likewise.
7256         * timer.cc: Likewise.
7257         * timer.h: Likewise.
7258         * version.cc: Likewise.
7259         * x86_64.cc: Likewise.
7260
7261 2010-08-24  Nick Clifton  <nickc@redhat.com>
7262
7263         PR 11899
7264         * layout.cc (segment_precedes): Sort segments by their physical
7265         addresses, if they have been set.
7266
7267 2010-08-23  Cary Coutant  <ccoutant@google.com>
7268
7269         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7270         symbols data.
7271         (Lib_group::include_member): Unlock object after deleting its
7272         symbols data.
7273         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7274         the bug fixed here.
7275
7276 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7277             Cary Coutant  <ccoutant@google.com>
7278
7279         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7280         constructor, and set_blocker.
7281         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7282         readsyms_blocker_.
7283         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7284         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7285         * testsuite/Makefile.am (start_lib_test): New test case.
7286         * testsuite/Makefile.in: Regenerate.
7287         * testsuite/start_lib_test_main.c: New file.
7288         * testsuite/start_lib_test_1.c: New file.
7289         * testsuite/start_lib_test_2.c: New file.
7290         * testsuite/start_lib_test_3.c: New file.
7291
7292 2010-08-19  Ian Lance Taylor  <iant@google.com>
7293
7294         * Makefile.in: Rebuild with automake 1.11.1.
7295         * aclocal.m4: Likewise.
7296         * testsuite/Makefile.in: Likewise.
7297
7298 2010-08-19  Ian Lance Taylor  <iant@google.com>
7299
7300         PR 10893
7301         * i386.cc (class Output_data_plt_i386): Update declarations.
7302         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7303         local_ifuncs_ fields.
7304         (Target_i386::do_plt_section_for_global): New function.
7305         (Target_i386::do_plt_section_for_local): New function.
7306         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7307         parameter; change all callers.  Initialize global_ifuncs_ and
7308         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7309         __rel_iplt_end.
7310         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7311         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7312         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7313         symbols.
7314         (Target_i386::make_plt_section): New function, broken out of
7315         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7316         (Target_i386::make_plt_entry): Call make_plt_section.
7317         (Target_i386::make_local_ifunc_plt_entry): New function.
7318         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7319         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7320         R_386_IRELATIVE to switch.
7321         (Target_i386::Scan::global): Likewise.
7322         (Target_i386::Relocate::relocate): Likewise.
7323         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7324         switch.
7325         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7326         (Target_x86_64::do_plt_section_for_global): New function.
7327         (Target_x86_64::do_plt_section_for_local): New function.
7328         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7329         parameter; change all callers.  If doing a static link define
7330         __rela_iplt_start and __rela_iplt_end.
7331         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7332         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7333         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7334         to point to .plt.
7335         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7336         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7337         switch.
7338         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7339         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7340         R_X86_64_IRELATIVE to switch.
7341         (Target_x86_64::Scan::global): Likewise.
7342         (Target_x86_64::Relocate::relocate): Likewise.
7343         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7344         switch.
7345         * target.h (class Target): Add plt_section_for_global and
7346         plt_section_for_local functions.  Add do_plt_section_for_global
7347         and do_plt_section_for_local virtual functions.
7348         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7349         clarifying comments.
7350         (Symbol::use_plt_offset): Handle IFUNC symbol.
7351         * object.cc (Sized_relobj::Sized_relobj): Initialize
7352         local_plt_offsets_.
7353         (Sized_relobj::local_has_plt_offset): New function.
7354         (Sized_relobj::local_plt_offset): New function.
7355         (Sized_relobj::set_local_plt_offset): New function.
7356         (Sized_relobj::do_count): Handle IFUNC symbol.
7357         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7358         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7359         is_ifunc_symbol functions.
7360         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7361         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7362         local_plt_offsets_ field.
7363         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7364         * output.h (class Output_section_data): Add non-const
7365         output_section function.
7366         (class Output_data_got): Update declarations.
7367         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7368         Add use_plt_offset parameter to global and local constructors.
7369         Change all callers.  Change local_sym_index_ field to 31 bits.
7370         Change GSYM_CODE and CONSTANT_CODE accordingly.
7371         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7372         doing a static link don't set sh_link field.
7373         (Output_data_got::Got_entry::write): Use PLT offset if
7374         appropriate.
7375         (Output_data_got::add_global_plt): New function.
7376         (Output_data_got::add_local_plt): New function.
7377         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7378         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7379         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7380         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7381         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7382         IFUNC conditional.
7383         * testsuite/ifunc-sel.h: New file.
7384         * testsuite/ifuncmain1.c: New file.
7385         * testsuite/ifuncmain1vis.c: New file.
7386         * testsuite/ifuncmod1.c: New file.
7387         * testsuite/ifuncdep2.c: New file.
7388         * testsuite/ifuncmain2.c: New file.
7389         * testsuite/ifuncmain3.c: New file.
7390         * testsuite/ifuncmod3.c: New file.
7391         * testsuite/ifuncmain4.c: New file.
7392         * testsuite/ifuncmain5.c: New file.
7393         * testsuite/ifuncmod5.c: New file.
7394         * testsuite/ifuncmain6pie.c: New file.
7395         * testsuite/ifuncmod6.c: New file.
7396         * testsuite/ifuncmain7.c: New file.
7397         * configure, testsuite/Makefile.in: Rebuild.
7398
7399 2010-08-18  Ian Lance Taylor  <iant@google.com>
7400
7401         * incremental.cc
7402         (Output_section_incremental_inputs::write_input_files): Add cast
7403         to avoid signed/unsigned comparison warning.
7404         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7405
7406 2010-08-12  Cary Coutant  <ccoutant@google.com>
7407
7408         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7409
7410 2010-08-13  Ian Lance Taylor  <iant@google.com>
7411
7412         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7413
7414 2010-08-12  Cary Coutant  <ccoutant@google.com>
7415             Doug Kwan  <dougkwan@google.com>
7416
7417         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7418         defintion overrides non-weak undef, remember that the original undef
7419         is not weak.
7420         * symtab.cc (Symbol_table::sized_write_global): For undef without
7421         an original weak binding, set binding to global in output.
7422         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7423         * testsuite/Makefile.in: Regenerate.
7424         * testsuite/strong_ref_weak_def.sh: New file.
7425         * testsuite/strong_ref_weak_def_1.c: Ditto.
7426         * testsuite/strong_ref_weak_def_2.c: Ditto.
7427
7428 2010-08-12  Cary Coutant  <ccoutant@google.com>
7429
7430         * testsuite/incremental_test.sh: Rewrite.
7431         * testsuite/incremental_test_1.c: Rewrite.
7432         * testsuite/incremental_test_2.c: Rewrite.
7433
7434 2010-08-12  Cary Coutant  <ccoutant@google.com>
7435
7436         * arm.cc (Target_arm::got_size): Add const.
7437         (Target_arm::got_entry_count): New function.
7438         (Target_arm::plt_entry_count): New function.
7439         (Target_arm::first_plt_entry_offset): New function.
7440         (Target_arm::plt_entry_size): New function.
7441         (Output_data_plt_arm::entry_count): New function.
7442         (Output_data_plt_arm::first_plt_entry_offset): New function.
7443         (Output_data_plt_arm::get_plt_entry_size): New function.
7444         * i386.cc (Target_i386::got_size): Add const.
7445         (Target_i386::got_entry_count): New function.
7446         (Target_i386::plt_entry_count): New function.
7447         (Target_i386::first_plt_entry_offset): New function.
7448         (Target_i386::plt_entry_size): New function.
7449         (Output_data_plt_i386::entry_count): New function.
7450         (Output_data_plt_i386::first_plt_entry_offset): New function.
7451         (Output_data_plt_i386::get_plt_entry_size): New function.
7452         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7453         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7454         * incremental.cc: Include target.h.
7455         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7456         parameter.  Adjust all callers.  Find incremental_got_plt section.
7457         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7458         section.
7459         (Output_section_incremental_inputs::set_final_data_size): Calculate
7460         size of incremental_got_plt section.
7461         (Output_section_incremental_inputs::do_write): Write the
7462         incremental_got_plt section.
7463         (Got_plt_view_info): New struct.
7464         (Local_got_offset_visitor): New class.
7465         (Global_got_offset_visitor): New class.
7466         (Global_symbol_visitor_got_plt): New class.
7467         (Output_section_incremental_inputs::write_got_plt): New function.
7468         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7469         Add parameter.  Adjust all callers.
7470         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7471         (Incremental_inputs::got_plt_section): New function.
7472         (Incremental_inputs::got_plt_section_): New data member.
7473         (Incremental_got_plt_reader): New class.
7474         * layout.cc (Layout::create_incremental_info_sections): Add the
7475         incremental_got_plt section.
7476         * object.h (Got_offset_list::get_list): New function.
7477         (Got offset_list::for_all_got_offsets): New function.
7478         (Sized_relobj::local_got_offset_list): New function.
7479         * powerpc.cc (Target_powerpc::got_size): Add const.
7480         (Target_powerpc::got_entry_count): New function.
7481         (Target_powerpc::plt_entry_count): New function.
7482         (Target_powerpc::first_plt_entry_offset): New function.
7483         (Target_powerpc::plt_entry_size): New function.
7484         (Output_data_plt_powerpc::entry_count): New function.
7485         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7486         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7487         * sparc.cc (Target_sparc::got_size): Add const.
7488         (Target_sparc::got_entry_count): New function.
7489         (Target_sparc::plt_entry_count): New function.
7490         (Target_sparc::first_plt_entry_offset): New function.
7491         (Target_sparc::plt_entry_size): New function.
7492         (Output_data_plt_sparc::entry_count): New function.
7493         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7494         (Output_data_plt_sparc::get_plt_entry_size): New function.
7495         * symtab.h (Symbol::got_offset_list): New function.
7496         (Symbol_table::for_all_symbols): New function.
7497         * target.h (Sized_target::got_entry_count): New function.
7498         (Sized_target::plt_entry_count): New function.
7499         (Sized_target::plt_entry_size): New function.
7500         * x86_64.cc (Target_x86_64::got_size): Add const.
7501         (Target_x86_64::got_entry_count): New function.
7502         (Target_x86_64::plt_entry_count): New function.
7503         (Target_x86_64::first_plt_entry_offset): New function.
7504         (Target_x86_64::plt_entry_size): New function.
7505         (Output_data_plt_x86_64::entry_count): New function.
7506         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7507         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7508
7509 2010-08-12  Cary Coutant  <ccoutant@google.com>
7510
7511         * archive.cc: Include incremental.h.
7512         (Archive::Archive): Initialize incremental_info_.
7513         (Archive::include_member): Record archive members in incremental info.
7514         (Add_archive_symbols::run): Record begin and end of an archive in
7515         incremental info.
7516         (Lib_group::include_member): Record objects in incremental info.
7517         * archive.h (Incremental_archive_entry): Forward declaration.
7518         (Archive::set_incremental_info): New member function.
7519         (Archive::incremental_info): New member function.
7520         (Archive::Unused_symbol_iterator): New class.
7521         (Archive::unused_symbols_begin): New member function.
7522         (Archive::unused_symbols_end): New member function.
7523         (Archive::incremental_info_): New data member.
7524         * incremental-dump.cc (find_input_containing_global): New function.
7525         (dump_incremental_inputs): Dump new incremental info sections.
7526         * incremental.cc: Include symtab.h.
7527         (Output_section_incremental_inputs): New class.
7528         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7529         new incremental info sections.
7530         (Sized_incremental_binary::do_check_inputs): Likewise.
7531         (Incremental_inputs::report_archive): Remove.
7532         (Incremental_inputs::report_archive_begin): New function.
7533         (Incremental_inputs::report_archive_end): New function.
7534         (Incremental_inputs::report_object): New function.
7535         (Incremental_inputs::finalize_inputs): Remove.
7536         (Incremental_inputs::report_input_section): New function.
7537         (Incremental_inputs::report_script): Rewrite.
7538         (Incremental_inputs::finalize): Do nothing but finalize string table.
7539         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7540         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7541         (Incremental_inputs::create_data_sections): New function.
7542         (Incremental_inputs::relocs_entsize): New function.
7543         (Output_section_incremental_inputs::set_final_data_size): New function.
7544         (Output_section_incremental_inputs::do_write): New function.
7545         (Output_section_incremental_inputs::write_header): New function.
7546         (Output_section_incremental_inputs::write_input_files): New function.
7547         (Output_section_incremental_inputs::write_info_blocks): New function.
7548         (Output_section_incremental_inputs::write_symtab): New function.
7549         * incremental.h (Incremental_script_entry): Forward declaration.
7550         (Incremental_object_entry): Forward declaration.
7551         (Incremental_archive_entry): Forward declaration.
7552         (Incremental_inputs): Forward declaration.
7553         (Incremental_inputs_header_data): Remove.
7554         (Incremental_inputs_header): Remove.
7555         (Incremental_inputs_header_write): Remove.
7556         (Incremental_inputs_entry_data): Remove.
7557         (Incremental_inputs_entry): Remove.
7558         (Incremental_inputs_entry_write): Remove.
7559         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7560         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7561         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7562         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7563         Likewise.
7564         (Incremental_input_entry): New class.
7565         (Incremental_script_entry): New class.
7566         (Incremental_object_entry): New class.
7567         (Incremental_archive_entry): New class.
7568         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7569         (Incremental_inputs::report_inputs): Remove.
7570         (Incremental_inputs::report_archive): Remove.
7571         (Incremental_inputs::report_archive_begin): New function.
7572         (Incremental_inputs::report_archive_end): New function.
7573         (Incremental_inputs::report_object): Change prototype.
7574         (Incremental_inputs::report_input_section): New function.
7575         (Incremental_inputs::report_script): Change prototype.
7576         (Incremental_inputs::get_reloc_count): New function.
7577         (Incremental_inputs::set_reloc_count): New function.
7578         (Incremental_inputs::create_data_sections): New function.
7579         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7580         (Incremental_inputs::inputs_section): New function.
7581         (Incremental_inputs::symtab_section): New function.
7582         (Incremental_inputs::relocs_section): New function.
7583         (Incremental_inputs::get_stringpool): Add const.
7584         (Incremental_inputs::command_line): Add const.
7585         (Incremental_inputs::inputs): Remove.
7586         (Incremental_inputs::command_line_key): New function.
7587         (Incremental_inputs::input_file_count): New function.
7588         (Incremental_inputs::input_files): New function.
7589         (Incremental_inputs::relocs_entsize): New function.
7590         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7591         (Incremental_inputs::finalize_inputs): Remove.
7592         (Incremental_inputs::Input_info): Remove.
7593         (Incremental_inputs::lock_): Remove.
7594         (Incremental_inputs::inputs_): Change type.
7595         (Incremental_inputs::inputs_map_): Remove.
7596         (Incremental_inputs::current_object_entry_): New data member.
7597         (Incremental_inputs::inputs_section_): New data member.
7598         (Incremental_inputs::symtab_section_): New data member.
7599         (Incremental_inputs::relocs_section_): New data member.
7600         (Incremental_inputs::reloc_count_): New data member.
7601         (Incremental_inputs_reader): New class.
7602         (Incremental_symtab_reader): New class.
7603         (Incremental_relocs_reader): New class.
7604         * layout.cc (Layout::finalize): Move finalization of incremental info
7605         and creation of incremental info sections to follow finalization of
7606         symbol table.  Set offsets for postprocessing sections.
7607         (Layout::create_incremental_info_sections): Call
7608         Incremental_inputs::create_data_sections.  Add incremental symtab
7609         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7610         sections to layout after input sections.
7611         * layout.h (struct Timespec): Forward declaration.
7612         (Layout::incremental_inputs): Add const.
7613         (Layout::create_incremental_info_sections): Add parameter.
7614         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7615         * object.cc: Include incremental.h.
7616         (Relobj::finalize_incremental_relocs): New function.
7617         (Sized_relobj::do_layout): Record input sections in incremental info.
7618         * object.h (Object::output_section): New function.
7619         (Object::output_section_offset): Moved from Relobj.
7620         (Object::get_incremental_reloc_base): New function.
7621         (Object::get_incremental_reloc_count): New function.
7622         (Object::do_output_section): New function.
7623         (Object::do_output_section_offset): Moved from Relobj.
7624         (Object::do_get_incremental_reloc_base): New function.
7625         (Object::do_get_incremental_reloc_count): New function.
7626         (Object::Object): Initialize new data members.
7627         (Relobj::output_section): Renamed do_output_section and moved to
7628         protected.
7629         (Relobj::output_section_offset): Moved to Object.
7630         (Relobj::do_get_incremental_reloc_base): New function.
7631         (Relobj::do_get_incremental_reloc_count): New function.
7632         (Relobj::allocate_incremental_reloc_counts): New function.
7633         (Relobj::count_incremental_reloc): New function.
7634         (Relobj::finalize_incremental_relocs): New function.
7635         (Relobj::next_incremental_reloc_index): New function.
7636         (Relobj::reloc_counts_): New data member.
7637         (Relobj::reloc_bases_): New data member.
7638         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7639         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7640         (Sized_relobj::incremental_relocs_scan): New function.
7641         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7642         (Sized_relobj::incremental_relocs_write): New function.
7643         (Sized_relobj::incremental_relocs_write_reltype): New function.
7644         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7645         incremental link.
7646         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7647         archives and object files elsewhere.
7648         (Add_symbols::run): Report object files here.
7649         (Finish_group::run): Report end of archive at end of group.
7650         * reloc.cc: Include layout.h, incremental.h.
7651         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7652         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7653         (Sized_relobj::incremental_relocs_scan): New function.
7654         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7655         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7656         (Sized_relobj::incremental_relocs_write): New function.
7657         (Sized_relobj::incremental_relocs_write_reltype): New function.
7658         * script.cc (read_input_script): Rewrite test for incremental link.
7659         Change call to Incremental_inputs::report_script.
7660         * symtab.h (Symbol_table::first_global_index): New function.
7661         (Symbol_table::output_count): New function.
7662
7663 2010-08-12  Doug Kwan  <dougkwan@google.com>
7664
7665         * arm.cc (Target_arm::merge_object_attributes): Check command line
7666         options --no-wchar-size-warning and --no-enum-size-warning.
7667         * options.h (General_options): Add ld-compatible options
7668         --no-enum-size-warning and --no-wchar-size-warning.
7669
7670 2010-08-04  Ian Lance Taylor  <iant@google.com>
7671
7672         * x86_64.cc (Target_x86_64::Scan::local): Use
7673         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7674         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7675         (Target_x86_64::Scan::global): Likewise.
7676         (Target_x86_64::Relocate::relocate): Likewise.
7677         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7678         Likewise.
7679
7680 2010-08-03  Cary Coutant  <ccoutant@google.com>
7681
7682         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7683         to reserve space in merged_strings vector. Keep total input size
7684         for stats.
7685         (Output_merge_string::do_print_merge_stats): Print total input size.
7686         * merge.h (Output_merge_string): Add input_size_ field.
7687         * stringpool.cc (Stringpool_template::string_length): Move
7688         implementations out of Stringpool_template class and place in
7689         stringpool.h.
7690         * stringpool.h (string_length): Move out of Stringpool_template.
7691
7692 2010-08-03  Ian Lance Taylor  <iant@google.com>
7693
7694         PR 11712
7695         * layout.cc (relaxation_loop_body): If address of load segment is
7696         set, adjust address to include headers if possible.
7697
7698 2010-08-03  Ian Lance Taylor  <iant@google.com>
7699
7700         * version.cc (version_string): Bump to 1.10.
7701
7702 2010-08-03  Ian Lance Taylor  <iant@google.com>
7703
7704         PR 11805
7705         * layout.h (enum Output_section_order): Define.
7706         (class Layout): Update declarations.
7707         * layout.cc (Layout::get_output_section): Add order parameter.
7708         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7709         is_first_non_relro parameters.  Change all callers.
7710         (Layout::choose_output_section): Likewise.
7711         (Layout::add_output_section_data): Likewise.
7712         (Layout::make_output_section): Likewise.  Set order.
7713         (Layout::default_section_order): New function.
7714         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7715         * output.cc (Output_section::Output_section): Initialize order_.
7716         Don't initialize deleted fields.
7717         (Output_segment::Output_segment): Don't initialize deleted
7718         fields.
7719         (Output_segment::add_output_section_to_load): New function
7720         replacing add_output_section.  Change all callers to call this or
7721         add_output_section_to_nonload.
7722         (Output_segment::add_output_section_to_nonload): New function.
7723         (Output_segment::remove_output_section): Rewrite.
7724         (Output_segment::add_initial_output_data): Likewise.
7725         (Output_segment::has_any_data_sections): Likewise.
7726         (Output_segment::is_first_section_relro): Likewise.
7727         (Output_segment::maximum_alignment): Likewise.
7728         (Output_segment::has_dynamic_reloc): New function replacing
7729         dynamic_reloc_count.  Change all callers.
7730         (Output_segment::has_dynamic_reloc_list): New function replacing
7731         dynamic_reloc_count_list.  Change all callers.
7732         (Output_segment::set_section_addresses): Rewrite.
7733         (Output_segment::set_offset): Rewrite.
7734         (Output_segment::find_first_and_last_list): Remove.
7735         (Output_segment::set_tls_offsets): Rewrite.
7736         (Output_segment::first_section_load_address): Likewise.
7737         (Output_segment::output_section_count): Likewise.
7738         (Output_segment::section_with_lowest_load_address): Likewise.
7739         (Output_segment::write_section_headers): Likewise.
7740         (Output_segment::print_sections_to_map): Likewise.
7741         * output.h (class Output_data): Remove dynamic_reloc_count_
7742         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7743         (Output_data::add_dynamic_reloc): Rewrite.
7744         (Output_data::has_dynamic_reloc): New function.
7745         (Output_data::dynamic_reloc_count): Remove.
7746         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7747         is_last_relro_, is_first_non_relro_, is_interp_,
7748         is_dynamic_linker_section_ fields.  Add order and set_order
7749         functions.  Remove is_relro_local, set_is_relro_local,
7750         is_last_relro, set_is_last_relro, is_first_non_relro,
7751         set_is_first_non_relro functions, is_interp, set_is_interp,
7752         is_dynamic_linker_section, and set_is_dynamic_linker_section
7753         functions.
7754         (class Output_segment): Change Output_data_list from std::list to
7755         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7756         output_bss_ fields.  Update declarations.
7757
7758 2010-08-02  Ian Lance Taylor  <iant@google.com>
7759
7760         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7761         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7762         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7763
7764 2010-08-02  Ian Lance Taylor  <iant@google.com>
7765
7766         PR 11855
7767         * script.cc (Script_options::Script_options): Initialize
7768         symbol_definitions_ and symbol_references_.
7769         (Script_options::add_symbol_assignment): Update
7770         symbol_definitions_ and symbol_references_.
7771         (Script_options::add_symbol_reference): New function.
7772         (script_symbol): New function.
7773         * script.h (class Script_options): Add symbol_definitions_ and
7774         symbol_references_ fields.
7775         (Script_options::referenced_const_iterator): New type.
7776         (Script_options::referenced_begin): New function.
7777         (Script_options::referenced_end): New function.
7778         (Script_options::is_referenced): New function.
7779         (Script_options::any_unreferenced): New function.
7780         * script-c.h (script_symbol): Declare.
7781         * yyscript.y (exp): Call script_symbol.
7782         * symtab.cc: Include "script.h".
7783         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7784         Change all callers.  Check symbols referenced by scripts.
7785         (Symbol_table::add_undefined_symbols_from_command_line): Add
7786         layout parameter.  Change all callers.
7787         (Symbol_table::do_add_undefined_symbols_from_command_line):
7788         Likewise.  Break out loop body.  Check symbols referenced by
7789         scripts.
7790         (Symbol_table::add_undefined_symbol_from_command_line): New
7791         function broken out of
7792         do_add_undefined_symbols_from_command_line.
7793         * symtab.h (class Symbol_table): Update declarations.
7794         * archive.cc: Include "layout.h".
7795         (Archive::should_include_member): Add layout parameter.  Change
7796         all callers.  Check for symbol mentioned in expression.
7797         * archive.h (class Archive): Update declaration.
7798         * object.cc (Sized_relobj::do_should_include_member): Add layout
7799         parameter.
7800         * object.h (Object::should_include_member): Add layout parameter.
7801         Change all callers.
7802         (Object::do_should_include_member): Add layout parameter.
7803         (class Sized_relobj): Update declaration.
7804         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7805         parameter.
7806         * dynobj.h (class Sized_dynobj): Update declaration.
7807         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7808         layout parameter.
7809         * plugin.h (class Sized_pluginobj): Update declaration.
7810
7811 2010-08-02  Ian Lance Taylor  <iant@google.com>
7812
7813         PR 11866
7814         * output.cc (Output_segment::set_offset): Search for the first and
7815         last sections rather than assuming that the list is in order.
7816         (Output_segment::find_first_and_last_list): New function.
7817         * output.h (class Output_segment): Update declarations.
7818         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7819         (relro_strip_test_SOURCES): New variable.
7820         (relro_strip_test_DEPENDENCIES): New variable.
7821         (relro_strip_test_LDFLAGS): New variable.
7822         (relro_strip_test_LDADD): New variable.
7823         (relro_strip_test.so): New target.
7824
7825 2010-08-02  Ian Lance Taylor  <iant@google.com>
7826
7827         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7828         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7829         (Target_i386::got_tlsdesc_section): New function.
7830         (Target_i386::got_section): Create space for GOT entries for
7831         TLSDESC relocations.
7832         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7833         R_386_TLS_GOTDESC.
7834         (Target_i386::Scan::global): Likewise.
7835         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7836         using TLSDESC GOT.
7837         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7838         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7839         (Target_x86_64::got_tlsdesc_section): New function.
7840         (Target_x86_64::got_section): Create space for GOT entries for
7841         TLSDESC relocations.
7842         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7843         R_386_TLS_GOTDESC.
7844         (Target_x86_64::Scan::global): Likewise.
7845         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7846         using TLSDESC GOT.
7847
7848 2010-08-02  Ian Lance Taylor  <iant@google.com>
7849
7850         * testsuite/final_layout.sh: Use dc to convert from hex to
7851         decimal.
7852
7853 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7854
7855         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7856         paramter to the call to gold::gc_process_relocs.
7857         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7858         paramter to the call to gold::gc_process_relocs.
7859         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7860         parameter to the call to gold::gc_process_relocs.
7861         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7862         template parameter to the call to gold::gc_process_relocs.
7863         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7864         paramter to the call to gold::gc_process_relocs.
7865         * gc.h (get_embedded_addend_size): New function.
7866         (gc_process_relocs): Save the size of the reloc for use by ICF.
7867         * icf.cc (get_section_contents): Get the addend from the text section
7868         for SHT_REL relocation sections.
7869         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7870         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7871         * int_encoding.h (read_from_pointer): New overloaded function.
7872         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7873         * testsuite/icf_sht_rel_addend_test.sh: New file.
7874         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7875         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7876
7877 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7878
7879         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7880         * Makefile.in: Regenerate.
7881         * testsuite/Makefile.in: Regenerate.
7882
7883 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7884
7885         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7886         * gold/testsuite/debug_msg.cc: Likewise.
7887         * gold/testsuite/odr_violation1.cc
7888         * gold/testsuite/odr_violation2.cc
7889
7890 2010-07-21  Cary Coutant  <ccoutant@google.com>
7891
7892         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7893         string, and length fields.
7894         (Output_merge_string::Merged_strings_list): New type.
7895         (Output_merge_string::Merged_strings_lists): New typedef.
7896         (Output_merge_string): Replace merged_strings_ with
7897         merged_strings_lists_.
7898         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7899         Merged_strings_list per input object and section.  Don't store pointer
7900         to the string.  Don't store length with each merged string entry.
7901         (Output_merge_string::finalize_merged_data): Loop over list of merged
7902         strings lists.  Recompute length of each merged string.
7903
7904 2010-07-15  Cary Coutant  <ccoutant@google.com>
7905
7906         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7907         here.
7908
7909 2010-07-14  Ian Lance Taylor  <iant@google.com>
7910
7911         * descriptors.cc (Descriptors::open): Report correct name in error
7912         message.
7913
7914 2010-07-13  Doug Kwan  <dougkwan@google.com>
7915
7916         * arm.cc (Arm_input_section::Arm_input_section): For a
7917         SHT_ARM_EXIDX section, always keeps the input sections.
7918         (Arm_input_section::set_exidx_section_link): New method.
7919         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7920         has_errors_ to false.
7921         (Arm_exidx_input_section::has_errors,
7922         Arm_exidx_input_section::set_has_errors): New methods.
7923         (Arm_exidx_input_section::has_errors_): New data member.
7924         (Arm_relobj::get_exidx_shndx_list): New method.
7925         (Arm_output_section::append_text_sections_to_list): Do not skip
7926         section without SHF_EXECINSTR.
7927         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7928         errors.
7929         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7930         section header.  Make error messages more verbose.  Check for
7931         a non-executable section linked to an EXIDX section.
7932         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7933         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7934         check that there is no deferred EXIDX section if we exit early.
7935         Instead of not making an EXIDX section in case of an error, make one
7936         and set the has_errors flag of it.
7937         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7938         in a relocatable link.
7939         (Target_arm::do_relax): Look for the EXIDX output section instead of
7940         assuming that it is called .ARM.exidx.
7941         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7942         section list.  Do not check for SHF_EXECINSTR section flags but
7943         skip any input section with errors.
7944         * output.cc (Output_section::Output_section): Initialize
7945         always_keeps_input_sections_ to false.
7946         (Output_section::add_input_section): Check for
7947         always_keeps_input_sections_.
7948         *  output.h (Output_section::always_keeps_input_sections,
7949         Output_section::set_always_keeps_input_sections): New methods.
7950         (Output_section::always_keeps_input_sections): New data member.
7951
7952 2010-07-13  Rafael Espindola  <espindola@google.com>
7953
7954         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7955         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7956
7957 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7958             Ian Lance Taylor  <iant@google.com>
7959
7960         * output.h (Output_section_lookup_maps::add_merge_section):
7961         Correct check of whether value was inserted.
7962         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7963         (Output_section_lookup_maps::add_relaxed_input_section):
7964         Likewise.
7965         * arm.cc (Target_arm::got_section): Remove used local os.
7966         * i386.cc (Target_i386::got_section): Likewise.
7967         * x86_64.cc (Target_x86_64::got_section): Likewise.
7968         * sparc.cc (Target_sparc::got_section): Likewise.
7969         (Target_sparc::relocate): Remove unused local have_got_offset.
7970         * powerpc.cc (Target_powerpc::relocate): Likewise.
7971
7972 2010-07-13  Ian Lance Taylor  <iant@google.com>
7973
7974         * compressed_output.cc (zlib_decompress): Fix signature in
7975         !HAVE_ZLIB_H case.
7976
7977         * archive.cc (Archive::include_member): Unlock an external member
7978         of a thin archive.  Don't bother to delete an object we know is
7979         NULL.
7980
7981 2010-07-12  Cary Coutant  <ccoutant@google.com>
7982
7983         * compressed_output.cc (zlib_decompress): New function.
7984         (get_uncompressed_size): New function.
7985         (decompress_input_section): New function.
7986         * compressed_output.h (get_uncompressed_size): New function.
7987         (decompress_input_section): New function.
7988         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7989         Handle compressed debug sections.
7990         * layout.cc (is_compressed_debug_section): New function.
7991         (Layout::output_section_name): Map compressed section names to
7992         canonical names.
7993         * layout.h (is_compressed_debug_section): New function.
7994         (is_debug_info_section): Recognize compressed debug sections.
7995         * merge.cc: Include compressed_output.h.
7996         (Output_merge_data::do_add_input_section): Handle compressed
7997         debug sections.
7998         (Output_merge_string::do_add_input_section): Handle compressed
7999         debug sections.
8000         * object.cc: Include compressed_output.h.
8001         (Sized_relobj::Sized_relobj): Initialize new data members.
8002         (build_compressed_section_map): New function.
8003         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8004         * object.h (Object::section_is_compressed): New method.
8005         (Object::do_section_is_compressed): New method.
8006         (Sized_relobj::Compressed_section_map): New type.
8007         (Sized_relobj::do_section_is_compressed): New method.
8008         (Sized_relobj::compressed_sections_): New data member.
8009         * output.cc (Output_section::add_input_section): Handle compressed
8010         debug sections.
8011         * reloc.cc: Include compressed_output.h.
8012         (Sized_relobj::write_sections): Handle compressed debug sections.
8013
8014 2010-07-08  Cary Coutant  <ccoutant@google.com>
8015
8016         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8017         weak when resolving to a dynamic def.
8018         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8019         for weak undef/dynamic def cases. Adjust callers.
8020         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8021         undef_binding_weak_.
8022         (Symbol_table::sized_write_globals): Adjust symbol binding.
8023         (Symbol_table::sized_write_symbol): Add binding parameter.
8024         * symtab.h (Symbol::set_undef_binding): New method.
8025         (Symbol::is_undef_binding_weak): New method.
8026         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8027         (Symbol_table::should_override): Add new parameter.
8028         (Symbol_table::sized_write_symbol): Add new parameter.
8029
8030         * testsuite/weak_undef_file1.cc: Add new test case.
8031         * testsuite/weak_undef_file2.cc: Fix header comment.
8032         * testsuite/weak_undef_test.cc: Add new test case.
8033
8034 2010-06-29  Doug Kwan  <dougkwan@google.com>
8035
8036         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8037         Initialize USE_SYMBOL_.
8038         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8039         definition.
8040         (Arm_reloc_property::uses_symbol_): New data member declaration.
8041         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8042         uses symbol value and symbol is undefined but not weakly undefined.
8043
8044 2010-06-28  Rafael Espindola  <espindola@google.com>
8045
8046         * plugin.cc (Plugin::load): Use dlerror.
8047
8048 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8049
8050         * symtab.cc (detect_odr_violations): When reporting an ODR
8051         violation, report an object where the symbol is defined.
8052
8053 2010-06-25  Doug Kwan  <dougkwan@google.com>
8054
8055         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8056         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8057         definition.
8058         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8059         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8060         target hook to detect function points.
8061         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8062         * icf.h (Icf::check_section_for_function_pointers): Change type of
8063         parameter SECTION_NAME to const reference to std::string.  Use
8064         target hook to determine if section may have unsafe pointers.
8065         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8066         method definition.
8067
8068 2010-06-21  Rafael Espindola  <espindola@google.com>
8069
8070         * fileread.cc (Input_file::find_fie): New
8071         (Input_file::open): Use Input_file::find_fie.
8072         * fileread.h (Input_file::find_fie): New
8073         * plugin.cc (set_extra_library_path): New.
8074         (Plugin::load): Add set_extra_library_path to the transfer vector.
8075         (Plugin_manager::set_extra_library_path): New.
8076         (Plugin_manager::add_input_file): Use the extra search path if set.
8077         (set_extra_library_path(): New.
8078         * plugin.h (Plugin_manager): Add set_extra_library_path and
8079         extra_search_path_.
8080
8081 2010-06-19  Cary Coutant  <ccoutant@google.com>
8082
8083         * layout.cc (gdb_sections): Add .debug_types.
8084         (lines_only_debug_sections): Likewise.
8085
8086 2010-06-18  Rafael Espindola  <espindola@google.com>
8087
8088         * plugin.cc (add_input_file,add_input_library)
8089         (Plugin_manager::add_input_file): Make filename arguments const.
8090         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8091         const.
8092
8093 2010-06-16  Doug Kwan  <dougkwan@google.com>
8094
8095         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8096         .ARM.attributes section if we have not merged any input
8097         attributes sections.
8098
8099 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8100
8101         * arm.cc: Allow combining objects with no EABI version
8102         information.
8103
8104 2010-06-15  Rafael Espindola  <espindola@google.com>
8105
8106         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8107
8108 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8109
8110         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8111         (struct iovec): Correct !HAVE_READV definition.
8112
8113 2010-06-10  Cary Coutant  <ccoutant@google.com>
8114
8115         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8116         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8117         reloc sections.
8118         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8119
8120         PR 11683
8121         * symtab.h (Symbol::is_placeholder): New member function.
8122         * target-reloc.h (relocate_section): Check for placeholder symbols.
8123
8124         * testsuite/Makefile.am (plugin_test_8): New test.
8125         (plugin_test_9): New test.
8126         * testsuite/Makefile.in: Regenerate.
8127
8128 2010-06-09  Nick Clifton  <nickc@redhat.com>
8129
8130         * yyscript.y (input_list_element): Allow strings prefixed with
8131         the '-' character.  Treat these as libraries.
8132         * script.cc (script_add_library): New function.  Adds a library
8133         specified by "-l<name>" found in an input script.
8134         * script-c.h: Add prototype for script_add_library.
8135
8136 2010-06-07  Doug Kwan  <dougkwan@google.com>
8137
8138         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8139         Restrict stub-group size to be within long conditional branch
8140         range when working around cortex-A8 erratum.
8141
8142 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8143
8144         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8145         #ifdef typo.
8146
8147 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8148
8149         PR gold/11658
8150         * output.cc
8151         (Output_section::Input_section_sort_entry::compare_section_ordering):
8152         Change to return non-zero correctly.
8153         (Output_section::Input_section_sort_section_order_index_compare
8154         ::operator()): Change to fix ambiguity in comparisons.
8155
8156 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8157
8158         * gold.h (is_wildcard_string): New function.
8159         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8160         (Layout::layout_eh_frame): Ditto.
8161         (Layout::find_section_order_index): New method.
8162         (Layout::read_layout_from_file): New method.
8163         * layout.h (Layout::find_section_order_index): New method.
8164         (Layout::read_layout_from_file): New method.
8165         (Layout::input_section_position_): New private member.
8166         (Layout::input_section_glob_): New private member.
8167         * main.cc (main): Call read_layout_from_file here.
8168         * options.h (--section-ordering-file): New option.
8169         * output.cc (Output_section::input_section_order_specified_): New
8170         member.
8171         (Output_section::Output_section): Initialize new member.
8172         (Output_section::add_input_section): Add new parameter.
8173         Keep input sections when --section-ordering-file is used.
8174         (Output_section::set_final_data_size): Sort input sections when
8175         section ordering file is specified.
8176         (Output_section::Input_section_sort_entry): Add new parameter.
8177         Check sorting type.
8178         (Output_section::Input_section_sort_entry::compare_section_ordering):
8179         New method.
8180         (Output_section::Input_section_sort_compare::operator()): Change to
8181         consider section_order_index.
8182         (Output_section::Input_section_sort_init_fini_compare::operator()):
8183         Change to consider section_order_index.
8184         (Output_section::Input_section_sort_section_order_index_compare
8185         ::operator()): New method.
8186         (Output_section::sort_attached_input_sections): Change to sort
8187         according to section order when specified.
8188         (Output_section::add_input_section<32, true>): Add new parameter.
8189         (Output_section::add_input_section<64, true>): Add new parameter.
8190         (Output_section::add_input_section<32, false>): Add new parameter.
8191         (Output_section::add_input_section<64, false>): Add new parameter.
8192         * output.h (Output_section::add_input_section): Add new parameter.
8193         (Output_section::input_section_order_specified): New
8194         method.
8195         (Output_section::set_input_section_order_specified): New method.
8196         (Input_section::Input_section): Initialize section_order_index_.
8197         (Input_section::section_order_index): New method.
8198         (Input_section::set_section_order_index): New method.
8199         (Input_section::section_order_index_): New member.
8200         (Input_section::Input_section_sort_section_order_index_compare): New
8201         struct.
8202         (Output_section::input_section_order_specified_): New member.
8203         * script-sections.cc (is_wildcard_string): Delete and move modified
8204         method to gold.h.
8205         (Output_section_element_input::Output_section_element_input): Modify
8206         call to is_wildcard_string.
8207         (Output_section_element_input::Input_section_pattern
8208         ::Input_section_pattern): Ditto.
8209         (Output_section_element_input::Output_section_element_input): Ditto.
8210         * testsuite/Makefile.am (final_layout): New test case.
8211         * testsuite/Makefile.in: Regenerate.
8212         * testsuite/final_layout.cc: New file.
8213         * testsuite/final_layout.sh: New file.
8214
8215 2010-06-01  Rafael Espindola  <espindola@google.com>
8216
8217         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8218
8219 2010-06-01  Rafael Espindola  <espindola@google.com>
8220
8221         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8222         visibility of symbols.
8223
8224 2010-05-27  Doug Kwan  <dougkwan@google.com>
8225
8226         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8227         from start of output section instead of address for a local symbol
8228         in a merged or relaxed section when doing a relocatable link.
8229
8230 2010-05-26  Rafael Espindola  <espindola@google.com>
8231
8232         PR 11604
8233         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8234         adding sections the garbage collector removed.
8235         * gold/testsuite/Makefile.am: Add test.
8236         * gold/testsuite/Makefile.in: Regenerate.
8237         * gold/testsuite/plugin_test_7.sh: New.
8238         * gold/testsuite/plugin_test_7_1.c: New.
8239         * gold/testsuite/plugin_test_7_2.c: New.
8240
8241 2010-05-26  Rafael Espindola  <espindola@google.com>
8242
8243         * script-sections.cc (Output_section_definition::set_section_addresses):
8244         Check for --section-start.
8245
8246 2010-05-26  Doug Kwan  <dougkwan@google.com>
8247
8248         * arm.cc (Arm_scan_relocatable_relocs): New class.
8249         (Target_arm::relocate_special_relocatable): New method.
8250         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8251         (Arm_relocate_functions::thumb_branch_common): Same.
8252         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8253         instead of Default_scan_relocatable_relocs.
8254         * target-reloc.h (relocate_for_relocatable): Let target handle
8255         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8256         * target.h (Sized_target::relocate_special_relocatable): New method.
8257
8258 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8259
8260         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8261
8262 2010-05-23  Doug Kwan  <dougkwan@google.com>
8263
8264         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8265         instead of a cast.
8266         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8267         with a direct branch, not a conditional branch, to a stub.
8268         * merge.cc (Output_merge_base::record_input_section): New method
8269         defintion.
8270         (Output_merge_data::do_add_input_section): Record input section if
8271         keeps-input-sections flag is set.
8272         (Output_merge_string::do_add_input_section): Ditto.
8273         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8274         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8275         INPUT_SECTIONS_.
8276         (Output_merge_base::keeps_input_sections,
8277         Output_merge_base::set_keeps_input_sections,
8278         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8279         method definitions.
8280         (Output_merge_base::Input_sections): New type declaration.
8281         (Output_merge_base::input_sections_begin,
8282         Output_merge_base::input_sections_end,
8283         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8284         (Output_merge_base::bool keeps_input_sections_,
8285         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8286         Output_merge_base::input_sections_): New data members.
8287         (Output_merge_data::do_set_keeps_input_sections): New method
8288         defintion.
8289         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8290         * output.cc (Output_section::Input_section::relobj): Move method
8291         defintion from class declaration to here and handle merge sections.
8292         (Output_section::Input_section::shndx): Ditto.
8293         (Output_section::Output_section): Remove initializations of removed
8294         data members and initialize new data member LOOKUP_MAPS_.
8295         (Output_section::add_input_section): Set keeps-input-sections flag
8296         for a newly created merge output section as appropriate.  Adjust code
8297         to use Output_section_lookup_maps class.
8298         (Output_section::add_relaxed_input_section): Adjst code for lookup
8299         maps code refactoring.
8300         (Output_section::add_merge_input_section): Add a new parameter
8301         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8302         class.  If adding input section to a newly created merge output
8303         section fails, remove the new merge section.
8304         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8305         Adjust code for use of the Output_section_lookup_maps class.
8306         (Output_section::find_merge_section): Ditto.
8307         (Output_section::build_lookup_maps): New method defintion.
8308         (Output_section::find_relaxed_input_section): Adjust code to use
8309         Output_section_lookup_maps class.
8310         (Output_section::get_input_sections): Export merge sections.  Adjust
8311         code to use Output_section_lookup_maps class.
8312         (Output_section:::add_script_input_section): Adjust code to use
8313         Output_section_lookup_maps class.  Update lookup maps for merge
8314         sections also.
8315         (Output_section::discard_states): Use Output_section_lookup_maps.
8316         (Output_section::restore_states): Same.
8317         * output.h (Merge_section_properties): Move class defintion out of
8318         Output_section.
8319         (Output_section_lookup_maps): New class.
8320         (Output_section::Input_section::is_merge_section): New method
8321         defintion.
8322         (Output_section::Input_section::relobj): Move defintion out of class
8323         defintion.  Declare method only.
8324         (Output_section::Input_section::shndx): Ditto.
8325         (Output_section::Input_section::output_merge_base): New method defintion.
8326         (Output_section::Input_section::u2_.pomb): New union field.
8327         (Output_section::Merge_section_by_properties_map,
8328         Output_section::Output_section_data_by_input_section_map,
8329         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8330         Remove types.
8331         (Output_section::add_merge_input_section): Add new parameter
8332         KEEPS_INPUT_SECTIONS.
8333         (Output_section::build_lookup_maps): New method declaration.
8334         (Output_section::merge_section_map_,
8335         Output_section::merge_section_by_properties_map_,
8336         Output_section::relaxed_input_section_map_,
8337         Output_section::is_relaxed_input_section_map_valid_): Remove data
8338         members.
8339         (Output_section::lookup_maps_): New data member.
8340
8341 2010-05-21  Doug Kwan  <dougkwan@google.com>
8342
8343         PR gold/11619
8344         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8345         avoid a compilation error.
8346
8347 2010-05-19  Rafael Espindola  <espindola@google.com>
8348
8349         * script-sections.cc (Output_section_definition::allocate_to_segment):
8350         Update the phdrs_list even when the output section is NULL.
8351         * testsuite/Makefile.am: Add test.
8352         * testsuite/Makefile.in: Regenerate.
8353         * testsuite/script_test_9.cc: New.
8354         * testsuite/script_test_9.sh: New.
8355         * testsuite/script_test_9.t: New.
8356
8357 2010-05-19  Doug Kwan  <dougkwan@google.com>
8358
8359         * arm.cc (Arm_input_section::original_size): New method.
8360         (Arm_input_section::do_addralign): Add a cast.
8361         (Arm_input_section::do_output_offset): Remove static cast.
8362         (Arm_input_section::original_addralign,
8363          Arm_input_section::original_size_): Change type to uint32_t.
8364         (Arm_input_section::init): Add safe casts for section alignment
8365         and size.
8366         (Arm_input_section::set_final_data_size): Do not set address and
8367         offset of stub table.
8368         (Arm_output_section::fix_exidx_coverage): Change use of of
8369         Output_section::Simple_input_section to that of
8370         Output_section::Input_section.
8371         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8372         except for the first pass.
8373         * output.cc (Output_section::get_input_sections): Change type of
8374         input_sections to std::list<Input_section>.
8375         (Output_section::add_script_input_section): Rename from
8376         Output_section::add_simple_input_section.  Change type of SIS
8377         parameter from Simple_input_section to Input_section.
8378         * output.h (Output_section::Simple_input_section): Remove class.
8379         (Output_section::Input_section): Change class visibility to public.
8380         (Output_section::Input_section::addralign): Use stored alignments
8381         for special input sections if set.
8382         (Output_section::Input_section::set_addralign): New method.
8383         (Output_section::get_input_sections): Change parameter type from
8384         list of Simple_input_section to list of Input_section.
8385         (Output_section::add_script_input_section): Rename from
8386         Output_section::add_simple_input_section. Change first parameter's
8387         type from Simple_input_section to Input_section and remove the
8388         second and third parameters.
8389         * script-sections.cc (Input_section::Input_section_list): Change
8390         type to list of Output_section::Input_section/
8391         (Input_section_info::Input_section_info): Change parameter type of
8392         INPUT_SECTION to Output_section::Input_section.
8393         (Input_section_info::input_section): Change return type.
8394         (Input_section_info::input_section_): Change type to
8395         Output_section::Input_section.
8396         (Output_section_element_input::set_section_addresses): Adjust code
8397         to use Output_section::Input_section instead of
8398         Output_section::Simple_input_section.  Adjust code for renaming
8399         of Output_section::add_simple_input_section.
8400         (Orphan_output_section::set_section_addresses): Ditto.
8401
8402 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8403
8404         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8405         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8406
8407 2010-05-18  Rafael Espindola  <espindola@google.com>
8408
8409         * options.cc (General_options::finalize): Handle -nostdlib.
8410         * options.h (nostdlib): New option.
8411         * script.cc (script_add_search_dir): Handle -nostdlib.
8412
8413 2010-05-12  Doug Kwan  <dougkwan@google.com>
8414
8415         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8416         attributes section only if there no attributes section after merging.
8417         (Target_arm::merge_object_attributes): Move value of
8418         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8419         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8420         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8421         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8422         and arm_attr_merge_7.stdout.
8423         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8424         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8425         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8426         arm_attr_merge_7b.o): New rules.
8427         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8428         arm_attr_merge_7
8429         * testsuite/Makefile.in: Regenerate.
8430         * testsuite/arm_attr_merge.sh: New file.
8431         * testsuite/arm_attr_merge_[67][ab].s: Same.
8432
8433 2010-05-05  Nick Clifton  <nickc@redhat.com>
8434
8435         * po/es.po: Updated Spanish translation.
8436
8437 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8438
8439         * Makefile.am (install-exec-local): Properly install gold as
8440         default cross linker.
8441         * Makefile.in: Regenerated.
8442
8443 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8444             Nick Clifton  <nickc@redhat.com>
8445
8446         * configure.ac (install_as_default): Define and set to false
8447         unless --enable-gold or --enable-gold=both/gold has been
8448         specified.
8449         * configure: Regenerate.
8450
8451         * Makefile.am (install-exec-local): Install the executable as
8452         'ld.gold'.  If install_as_default is true then also install it as
8453         'ld'.
8454         * Makefile.in: Regenerated.
8455
8456 2010-04-24  Ian Lance Taylor  <iant@google.com>
8457
8458         * layout.cc (Layout::layout_reloc): In relocatable link don't
8459         combine reloc sections for grouped sections.
8460
8461 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8462
8463         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8464         sections that are not ordinary to icf.
8465         * icf.cc (get_section_contents): Handle relocation pointing to section
8466         with no object or shndx information.
8467         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8468         * testsuite/Makefile.in: Regenerate.
8469         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8470         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8471
8472 2010-04-22  Ian Lance Taylor  <iant@google.com>
8473
8474         * expression.cc (Expression::Expression_eval_info): Add
8475         result_alignment_pointer field.
8476         (Expression::eval_with_dot): Add result_alignment_pointer
8477         parameter.  Change all callers.
8478         (Expression::eval_maybe_dot): Likewise.
8479         (class Binary_expression): Add alignment_pointer parameter to
8480         left_value and right_value.  Change all callers.
8481         (BINARY_EXPRESSION): Set result alignment.
8482         (class Trinary_expression): Add alignment_pointer parameter to
8483         arg2_value and arg3_value.  Change all callers.
8484         (Trinary_cond::value): Set result alignment.
8485         (Max_expression::value, Min_expression::value): Likewise.
8486         (Align_expression::value): Likewise.
8487         * script-sections.cc (class Sections_element): Add dot_alignment
8488         parameter to set_section_addresses virtual function.  Update
8489         instantiations.
8490         (class Output_section_element): Likewise.
8491         (Script_sections::create_segments): Add dot_alignment parameter.
8492         Change all callers.
8493         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8494         (Script_sections::set_phdrs_clause_addresses): Likewise.
8495         * script-sections.h: Update declarations.
8496         * script.h: Update declarations.
8497         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8498         min_p_align.
8499         * testsuite/script_test_3.t: Set large alignment.
8500         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8501         segment has expected alignment.
8502
8503 2010-04-22  Nick Clifton  <nickc@redhat.com>
8504
8505         * po/gold.pot: Updated by the Translation project.
8506         * po/vi.po: Updated Vietnamese translation.
8507
8508 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8509
8510         * testsuite/Makefile.am (check_PROGRAMS): Add
8511         icf_virtual_function_folding_test.
8512         * testsuite/Makefile.in: Regenerated.
8513
8514 2010-04-15  Andrew Haley  <aph@redhat.com>
8515
8516         * options.h (merge_exidx_entries): New option.
8517         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8518         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8519         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8520         (Target_arm::merge_exidx_entries): New function.
8521         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8522         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8523         to Arm_exidx_fixup constructor.
8524         Add new arg, merge_exidx_entries.
8525         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8526         Arm_output_section::fix_exidx_coverage.
8527
8528 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8529
8530         * icf.cc (get_section_contents): Check for preemptible functions.
8531         Ignore addend when appropriate.
8532         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8533         section folded.
8534         (add_from_relobj): Check for section folded.
8535         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8536         * symtab.h (should_add_dynsym_entry): Add new parameter.
8537         * target-reloc.h (scan_relocs): Check for section folded.
8538         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8539         Check reloc types for function pointers in shared objects.
8540         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8541         case.
8542         (icf_preemptible_functions_test): New test case.
8543         (icf_string_merge_test): New test case.
8544         * testsuite.Makefile.in: Regenerate.
8545         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8546         bar_glob.  Refactor code.
8547         * testsuite/icf_preemptible_functions_test.cc: New file.
8548         * testsuite/icf_preemptible_functions_test.sh: New file.
8549         * testsuite/icf_string_merge_test.cc: New file.
8550         * testsuite/icf_string_merge_test.sh: New file.
8551         * testsuite/icf_virtual_function_folding_test.cc: New file.
8552         * testsuite/icf_virtual_function_folding_test.sh: New file.
8553
8554 2010-04-14  Doug Kwan  <dougkwan@google.com>
8555
8556         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8557         for local symbol recounting if we remove a section due to ICF.
8558         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8559         there are no regular objects in input.
8560
8561 2010-04-13  Doug Kwan  <dougkwan@google.com>
8562
8563         * arm.cc (Arm_input_section::set_final_data_size): Compute
8564         accurate final data size instead of using current data size.
8565
8566 2010-04-09  Doug Kwan  <dougkwan@google.com>
8567
8568         * layout.cc (Layout::choose_output_section): Handle script section
8569         types.
8570         (Layout::make_output_section_for_script): Add section type parameter.
8571         Handle script section types.
8572         * layout.h (Layout::make_output_section_for_script): Add section
8573         type parameter.
8574         * output.cc (Output_section::Output_section): Initialize data member
8575         is_noload_.
8576         (Output_section::do_reset_address_and_file_offset): Do not set address
8577         to 0 if section is a NOLOAD section.
8578         * output.h (Output_section::is_noload): New method.
8579         (Output_section::set_is_noload): Ditto.
8580         (Output_section::is_noload_): New data member.
8581         * script-c.h (Script_section_type): New enum type.
8582         (struct Parser_output_section_header): Add new file section_type.
8583         * script-sections.cc (Sections_element::output_section_name): Add
8584         parameter for returning script section type.
8585         (Output_section_definition::output_section_name): Ditto.
8586         (Output_section_definition::section_type)P; New method.
8587         (Output_section_definiton::script_section_type_name): Ditto.
8588         (Output_section_definition::script_section_type_): New data member.
8589         (Output_section_definition::Output_section_definition): Initialize
8590         data member Output_section_definition::script_section_type_.
8591         (Output_section_definition::create_sections): Pass script section type
8592         to Layout::make_output_section_for_script.
8593         (Output_section_definition::output_section_name): Return script
8594         section type to caller.
8595         (Output_section_definition::set_section_address): Do not advance
8596         dot value and load address if section type is NOLOAD.  Set address
8597         of NOLOAD sections regardless of section flags.
8598         (Output_section_definition::print): Print section type if it is
8599         not SCRIPT_SECTION_TYPE_NONE.
8600         (Output_section_definition::section_type): New method.
8601         (Output_section_definition::script_section_type_name): Ditto.
8602         (Script_sections::output_section_name): Add new parameter
8603         PSECTION_TYPE for returning script section type.  Pass it to
8604         section elements.  Handle discard sections.
8605         (Sort_output_sections::operator()): Handle NOLOAD sections.
8606         * script-sections.h (Script_sections::Section_type): New enum type.
8607         (Script_sections::output_section_name): Add a new parameter for
8608         returning script section type.
8609         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8610         INFO and NOLOAD.
8611         * yyscript.y (union): Add new field SECTION_TYPE.
8612         (COPY, DSECT, INFO, NOLOAD): New tokens.
8613         (opt_address_and_section_type): Change type to output_section_header.
8614         (section_type): New non-terminal
8615         (section_header): Handle section type.
8616         (opt_address_and_section_type): Return section type value.
8617
8618 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8619
8620         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8621         * testsuite/plugin_common_test_2.c (foo): Likewise.
8622
8623 2010-04-08  Doug Kwan  <dougkwan@google.com>
8624
8625         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8626         Output_merge_data.
8627         * output.cc (Output_section::add_merge_input_section): Simplify
8628         code and return status of Output_merge_base::add_input_section.
8629         Update merge section map only if Output_merge_base::add_input_section
8630         returns true.
8631
8632 2010-04-07  Doug Kwan  <dougkwan@google.com>
8633
8634         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8635         if section is marked as containing instructions but has no mapping
8636         symbols.
8637         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8638         correct section index.
8639         (Arm_relobj::find_linked_text_section): Ditto.
8640
8641 2010-04-07  Cary Coutant  <ccoutant@google.com>
8642
8643         * archive.cc (include_member): Destroy Read_symbols_data object before
8644         releasing file.
8645         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8646         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8647         (Read_symbols_data::~Read_symbols_data) New destructor.
8648         (Section_relocs::Section_relocs) New constructor.
8649         (Section_relocs::~Section_relocs) New destructor.
8650         (Read_relocs_data::Read_relocs_data) New constructor.
8651         (Read_relocs_data::~Read_relocs_data) New destructor.
8652         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8653         pointers to NULL after deleting.
8654
8655 2010-04-07  Doug Kwan  <dougkwan@google.com>
8656
8657         * arm.cc: Replace "endianity" with "endianness" in comments.
8658         (Arm_exidx_cantunwind): Ditto.
8659         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8660         (Arm_relobj::merge_flags_and_attributes): New method.
8661         (Arm_relobj::merge_flags_and_attributes_): New data member.
8662         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8663         (Arm_relobj::scan_sections_for_stubs): Ditto.
8664         (Arm_relobj::do_read_symbols): Check to see if we really want to
8665         merge processor-specific flags and attributes.  Exit early if
8666         an object is empty except for section names and the undefined symbol.
8667         (Target_arm::do_finalize_sections): Move check for ELF format to
8668         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8669         attributes from a regular object only when we have determined that
8670         it is aapropriate.  Do not create an .ARM.attributes section in
8671         output if there is no regular input object.
8672         (Target_arm::merge_processor_specific_flags): Check
8673         --warn-mismatch before printing any error.
8674         (Target_arm::merge_object_attributes): Ditto.
8675         * gold.cc (queue_middle_tasks): Handle the case in which there is
8676         no regular object in input.
8677         * options.cc (General_options::parse_EB): New method.
8678         (General_options::parse_EL): Same.
8679         (General_options::General_options): Initialize endianness_.
8680         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8681         New options.
8682         (General_options::Endianness): New enum.
8683         (General_options::endianness): New method.
8684         (General_options::endianness_): New data member.
8685         * parameters.cc (Parameters::set_options): Check target endianness.
8686         (Parameters::set_target_once): Ditto.
8687         (Parameters::check_target_endianness): New method.
8688         (parameters_force_valid_target): If either -EL or -EB is specified,
8689         use it to define endianness of default target.
8690         * parameters.h (Parameters::check_target_endianness): New method
8691         declaration.
8692         * target.h (class Target): Change "endianity" to "endianness"
8693         in comments.
8694
8695 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8696
8697         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8698         * configure: Regenerate.
8699         * Makefile.in: Regenerate.
8700         * testsuite/Makefile.in: Regenerate.
8701
8702 2010-04-06  Cary Coutant  <ccoutant@google.com>
8703
8704         gcc PR lto/42757
8705         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8706         prevailing definitions of common symbols.
8707         * testsuite/plugin_test_6.sh: New test case.
8708         * testsuite/plugin_common_test_1.c: New test case.
8709         * testsuite/plugin_common_test_2.c: New test case.
8710         * testsuite/Makefile.am (plugin_test_6): New test case.
8711         * testsuite/Makefile.in: Regenerate.
8712
8713 2010-04-06  Nick Clifton  <nickc@redhat.com>
8714
8715         * po/vi.po: New Vietnamese translation.
8716
8717 2010-03-30  Doug Kwan  <dougkwan@google.com>
8718
8719         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8720
8721 2010-03-25  Doug Kwan  <dougkwan@google.com>
8722
8723         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8724         to avoid a conversion warning on a 32-bit host.
8725
8726 2010-03-24  Ian Lance Taylor  <iant@google.com>
8727
8728         * testsuite/script_test_3.t: Add a TLS segment.
8729         * testsuite/Makefile.am (check_PROGRAMS): Add
8730         tls_phdrs_script_test.
8731         (tls_phdrs_script_test_SOURCES): Define.
8732         (tls_phdrs_script_test_DEPENDENCIES): Define.
8733         (tls_phdrs_script_test_LDFLAGS): Define.
8734         (tls_phdrs_script_test_LDADD): Define.
8735         * testsuite/Makefile.in: Rebuild.
8736
8737 2010-03-23  Cary Coutant  <ccoutant@google.com>
8738
8739         * fileread.cc (find_or_make_view): Fix comment.
8740
8741 2010-03-23  Ian Lance Taylor  <iant@google.com>
8742
8743         * script-sections.cc (class Orphan_section_placement): Define
8744         PLACE_TLS and PLACE_TLS_BSS.
8745         (Orphan_section_placement::Orphan_section_placement): Initialize
8746         new places.
8747         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8748         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8749         (tls_script_test_SOURCES): Define.
8750         (tls_script_test_DEPENDENCIES): Define.
8751         (tls_script_test_LDFLAGS): Define.
8752         (tls_script_test_LDADD): Define.
8753         * testsuite/Makefile.in: Rebuild.
8754
8755 2010-03-22  Doug Kwan  <dougkwan@google.com>
8756
8757         * arm.cc (Arm_relocate_functions::abs8,
8758         Arm_relocate_functions::abs16): Use correct check for overflow
8759         specified in the ARM ELF specs.
8760         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8761         target of a BLX instruction specially.
8762         (Reloc_stub::stub_type_for_reloc): Ditto.
8763         (Relocate::relocate): Use symbolic names instead of numeric relocation
8764         codes to report error.
8765         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8766         workaround.
8767         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8768         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8769         thumb2_blx_out_of_range.stdout
8770         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8771         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8772         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8773         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8774         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8775         thumb2_blx_in_range, thumb2_blx_in_range.o,
8776         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8777         thumb2_blx_out_of_range.o): New rules.
8778         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8779         thumb2_blx_in_range and thumb2_blx_out_of_range.
8780         * testsuite/Makefile.in: Regenerate.
8781         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8782         * testsuite/thumb_blx_in_range.s: New file.
8783         * testsuite/thumb_blx_out_of_range.s: New file.
8784
8785 2010-03-22  Rafael Espindola  <espindola@google.com>
8786
8787         * archive.cc (Should_include): Move to archive.h.
8788         (should_include_member): Make it a member of Archive.
8789         (Lib_group): New.
8790         (Add_lib_group_symbols): New.
8791         * archive.h: Include options.h.
8792         (Archive_member): Moved from Archive.
8793         (Should_include): Moved from archive.cc.
8794         (Lib_group): New.
8795         (Add_lib_group_symbols): New.
8796         * dynobj.cc (do_should_include_member): New.
8797         * dynobj.h (do_should_include_member): New.
8798         * gold.cc (queue_initial_tasks): Update call to queue.
8799         * main.cc (main): Print lib group stats.
8800         * object.cc (do_should_include_member): New.
8801         * object.h: Include archive.h.
8802         (Object::should_include_member): New.
8803         (Object::do_should_include_member): New.
8804         (Sized_relobj::do_should_include_member): New.
8805         * options.cc (General_options::parse_start_lib): New.
8806         (General_options::parse_end_lib): New.
8807         (Input_arguments::add_file): Handle lib groups.
8808         (Input_arguments::start_group): Check we are not in a lib.
8809         (Input_arguments::start_lib): New.
8810         (Input_arguments::end_lib): New.
8811         * options.h (General_options): Add start_lib and end_lib.
8812         (Input_argument::lib_): New.
8813         (Input_argument::lib): New.
8814         (Input_argument::is_lib): New.
8815         (Input_file_lib): New.
8816         (Input_arguments::in_lib_): New.
8817         (Input_arguments::in_lib): New.
8818         (Input_arguments::start_lib): New.
8819         (Input_arguments::end_lib_): New.
8820         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8821         in unused members as preempted.
8822         (Sized_pluginobj::do_should_include_member): New.
8823         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8824         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8825         return the blocker.
8826         (Read_symbols::do_whole_lib_group): New.
8827         (Read_symbols::do_lib_group): New.
8828         (Read_symbols::do_read_symbols): Handle lib groups.
8829         (Read_symbols::get_name): Handle lib groups.
8830         * readsyms.h (Read_symbols): Add an archive member pointer.
8831         (Read_symbols::do_whole_lib_group): New.
8832         (Read_symbols::do_lib_group): New.
8833         (Read_symbols::member_): New.
8834         * script.cc (read_input_script): Update call to queue_soon.
8835
8836 2010-03-19  Doug Kwan  <dougkwan@google.com>
8837
8838         * arm.cc (Stub_table::Stub_table): Initialize new data members
8839         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8840         (Stub_table::add_reloc_stub): Assign stub offset and update
8841         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8842         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8843         New data members.
8844         (Stub_table::update_data_size_and_addralign): Use
8845         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8846         instead of going over all reloc stubs.
8847         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8848         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8849         Stringpool_template::offset_ to size of Stringpool_char.
8850         (Stringpool_template::new_key_offset): Remove code to initialize
8851         Stringpool_template::offset_.
8852         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8853         Stringpool_template::offset_ to zero.
8854
8855 2010-03-15  Doug Kwan  <dougkwan@google.com>
8856
8857         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8858         offset_.
8859         (Stringpool_template::new_key_offset): New method.
8860         (Stringpool_template::add_string): Assign offsets when adding new
8861         strings.
8862         (Stringpool_template::set_string_offsets): Do not set string offsets
8863         when not optimizing.
8864         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8865         member size_.
8866         (Chunked_vector::clear): Clear size_.
8867         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8868         (Chunked_vector::size): Return size_.
8869         (Chunked_vector::push_back): Use size_ to find insert position.
8870         (Chunked_vector::size_): New data member.
8871         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8872         (Stringpool_template::new_key_offset): New method declaration.
8873         (Stringpool_template::offset_): New data member.
8874
8875 2010-03-15   Rafael Espindola  <espindola@google.com>
8876
8877         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8878         Add_symbols' constructor.
8879         * readsyms.h (Add_symbols): Remove the input_group member.
8880
8881 2010-03-10  Ian Lance Taylor  <iant@google.com>
8882
8883         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8884         target to ask whether a reference to a symbol requires a stack
8885         split.
8886         * target.h (Target::is_call_to_non_split): New function.
8887         (Target::do_is_call_to_non_split): Declare virtual function.
8888         * target.cc: Include "symtab.h".
8889         (Target::do_is_call_to_non_split): New function.
8890         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8891
8892 2010-03-10  Cary Coutant  <ccoutant@google.com>
8893
8894         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8895         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8896         (File_read::open[2]): Add whole_file_view_ to list of views.
8897         (File_read::make_view): Remove test of whole_file_view_.
8898         (File_read::find_or_make_view): Create whole_file_view_ if
8899         necessary.
8900         (File_read::clear_views): Replace bool parameter with enum;
8901         adjust all callers.  Don't delete views with permanent data;
8902         do delete cached views and views from archives if
8903         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8904         if clearing the corresponding view.
8905         * fileread.h (File_read::Clear_views_mode): New enum.
8906         (File_read::View::is_permanent_view): New method.
8907         (File_read::clear_views): Replace bool parameter
8908         with enum; adjust all callers.
8909         * options.h (General_options): Change keep_files_mapped option;
8910         add map_whole_files.
8911         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8912         releasing the file.
8913         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8914         the file.
8915
8916 2010-03-10  David S. Miller  <davem@davemloft.net>
8917
8918         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8919
8920 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8921
8922         * icf.cc (get_section_contents): Add '@' marker after processing the
8923         merge reloc.
8924
8925 2010-03-08  Doug Kwan  <dougkwan@google.com>
8926
8927         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8928         due to a conversion warning.
8929         (Arm_relobj::update_output_local_symbol_count): Check for local
8930         symbol with unset output index.
8931
8932 2010-03-05  Ian Lance Taylor  <iant@google.com>
8933
8934         * options.h (class General_options): Add --spare-dynamic-tags.
8935         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8936         --spare-dynamic-tags.
8937
8938 2010-03-05  Ian Lance Taylor  <iant@google.com>
8939
8940         * incremental.cc: Include "libiberty.h".
8941
8942 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8943
8944         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8945         function, is_info_ member.
8946         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8947         (Versions::Versions): Update caller.
8948         (Versions::define_base_version): Likewise.
8949         (Versions::add_def): Likewise.
8950
8951 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8952
8953         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8954         (Scan::possible_function_pointer_reloc): New function.
8955         (Scan::local_reloc_may_be_function_pointer): Change to call
8956         possible_function_pointer_reloc.
8957         (Scan::global_reloc_may_be_function_pointer): Ditto.
8958         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8959         relocations in ".data.rel.ro._ZTV" section.
8960         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8961         * testsuite/icf_safe_so_test.cc: Ditto.
8962         * testsuite/icf_safe_test.cc: Ditto.
8963         * testsuite/icf_safe_test.sh: Ditto.
8964
8965 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8966             Ian Lance Taylor  <iant@google.com>
8967
8968         * target-reloc.h (relocate_section): Check the symbol table index
8969         for -1U before setting the local symbol index.
8970         (scan_relocatable_relocs): If copying the relocation, record that
8971         the local symbol is required.
8972         * object.h (Symbol_value::is_output_symtab_index_set): New
8973         function.
8974         (Symbol_value::may_be_discarded_from_output_symtab): New
8975         function.
8976         (Symbol_value::has_output_symtab_entry): New function.
8977         (Symbol_value::needs_output_symtab_entry): Remove.
8978         (Symbol_value::output_symtab_index): Make sure the symbol index is
8979         set.
8980         (Symbol_value::set_output_symtab_index): Make sure the symbol
8981         index is not set.  Make sure the new index is valid.
8982         (Symbol_value::set_must_have_output_symtab_entry): New function.
8983         (Symbol_value::has_output_dynsym_entry): New function.
8984         (Symbol_value::set_output_dynsym_index): Make sure the new index
8985         is valid.
8986         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8987         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8988         local symbol if permitted.
8989         (Sized_relobj::do_finalize_local_symbols): Call
8990         is_output_symtab_index_set rather than needs_output_symtab_entry.
8991         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8992         rather than needs_output_symtab_entry.  Call
8993         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8994         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8995         is_output_symtab_index_set rather than needs_output_symtab_entry.
8996         * testsuite/discard_locals_relocatable_test.c: New file.
8997         * testsuite/discard_locals_test.sh: Test -r.
8998         * testsuite/Makefile.am (check_DATA): Add
8999         discard_locals_relocatable_test1.syms,
9000         discard_local_relocatable_test2.syms.
9001         (MOSTLYCLEANFILES): Likewise.  Also add
9002         discard_locals_relocatable_test1.lout and
9003         discard_locals_relocatable_test2.out.
9004         (discard_locals_relocatable_test1.syms): New target.
9005         (discard_locals_relocatable_test.o): New target.
9006         (discard_locals_relocatable_test1.out): New target.
9007         (discard_locals_relocatable_test2.syms): New target.
9008         (discard_locals_relocatable_test2.out): New target.
9009         (various): Add missing ../ld-new dependencies.
9010         * testsuite/Makefile.in: Rebuild.
9011
9012 2010-03-03  Nick Clifton  <nickc@redhat.com>
9013
9014         * po/fi.po: New Finnish translation.
9015
9016 2010-03-01  Doug Kwan  <dougkwan@google.com>
9017
9018         * layout.cc (Layout::Layout): Force section types of .init_array*,
9019         .preinit_array* and .fini_array* sections.
9020         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9021         Fix check of return value of std::string::find.().
9022         (Output_section::Input_section_sort_compare::operator()): Remove
9023         comment about .init_array.
9024         (Output_section::Input_section_sort_init_fini_compare::operator()):
9025         New method.
9026         (Output_section::sort_attached_input_sections): Handle .init_array
9027         and .fini_array specially.
9028         * output.h (Output_section::Inut_section_sort_compare): Update
9029         comment.
9030         (Output_section::Input_section_sort_init_fini_compare): New struct.
9031
9032 2010-02-26  Doug Kwan  <dougkwan@google.com>
9033
9034         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9035         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9036         * testsuite/debug_msg.sh: Avoid matching source line number for
9037         use of global variable undef_int.
9038
9039 2010-02-26  Doug Kwan  <dougkwan@google.com>
9040
9041         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9042         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9043         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9044         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9045         * options.cc (General_options::General_options): Initialize member
9046         fix_v4bx_.
9047         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9048         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9049         and rm_no_fix_v4bx.stdout
9050         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9051         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9052         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9053         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9054         and arm_no_fix_v4bx.
9055         * Makefile.in: Regenerate.
9056         * testsuite/arm_fix_v4bx.s: New file.
9057         * testsuite/arm_fix_v4bx.sh: Ditto.
9058
9059 2010-02-24  Doug Kwan  <dougkwan@google.com>
9060
9061         * arm.cc (Target_arm::got_section): Make the .got section the first
9062         non RELRO section in the data segment.
9063         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9064         suffixes of section names.
9065
9066 2010-02-24  Doug Kwan  <dougkwan@google.com>
9067
9068         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9069         flags and attributes merging if an input file is a binary file.
9070         * fileread.cc (Input_file::open): Record format of original file.
9071         * fileread.h (Input_file::Format): New enum type.
9072         (Input_file::Input_file): Initialize data member format_.
9073         (Input_file::format): New method definition.
9074         (Input_file::format_):: New data member.
9075
9076 2010-02-24  Doug Kwan  <dougkwan@google.com>
9077
9078         * arm.cc (Arm_output_data_got): New class.
9079         (ARM_TCB_SIZE): New constant
9080         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9081         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9082         If user uses a script with a SECTIONS clause, issue only a warning
9083         for a misplaced EXIDX input section.  Otherwise, issue an error.
9084         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9085         garbage collection.
9086         (Target_arm::got_mode_index_entry): Handle static linking.
9087         (Target_arm::Scan::local): Ditto.
9088         (Target_arm::Scan::global): Ditto.
9089         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9090         all incorrectly implemented relocations.
9091         (Target_arm::fix_exidx_coverage): Pass layout to
9092         Arm_output_section::fix_exidx_coverage.
9093         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9094         from ".ARM.exidx." and ".ARM.extab.".
9095
9096 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9097
9098         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9099         section if it does not already exist.
9100         * attributes.cc (Attributes_section_data::Attributes_section_data):
9101         Don't crash if size is zero.
9102
9103 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9104             Ian Lance Taylor  <iant@google.com>
9105
9106         * gold.cc (queue_middle_tasks): If no input files were opened,
9107         exit.
9108         * workqueue.h (Task_function::Task_function): Assert that there is
9109         a blocker.
9110
9111 2010-02-22  Doug Kwan  <dougkwan@google.com>
9112
9113         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9114         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9115         types to avoid warnings due to different uint64_t implementations
9116         on different hosts.
9117
9118 2010-02-21  Doug Kwan  <dougkwan@google.com>
9119
9120         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9121         handling of the maximum backward branch offset.
9122         (Arm_relocate_functions::thumb_branch_common): Ditto.
9123         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9124         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9125         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9126         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9127         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9128         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9129         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9130         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9131         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9132         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9133         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9134         thumb2_bl_out_of_range.o): New rules.
9135         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9136         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9137         thumb2_bl_out_of_range
9138         * testsuite/Makefile.in: Regenerate.
9139         * testsuite/arm_bl_in_range.s: New file.
9140         * testsuite/arm_bl_out_of_range.s: Ditto.
9141         * testsuite/arm_branch_in_range.sh: Ditto.
9142         * testsuite/arm_branch_range.t: Ditto.
9143         * testsuite/thumb2_branch_range.t: Ditto.
9144         * testsuite/thumb_bl_in_range.s: Ditto.
9145         * testsuite/thumb_bl_out_of_range.s: Ditto.
9146         * testsuite/thumb_branch_range.t: Ditto.
9147
9148 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9149
9150         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9151         Add reloc offset information.
9152         * icf.cc (get_section_contents): Change iterators to point to the new
9153         vectors. Add reloc offset information to the contents.
9154         * icf.h (Icf::Sections_reachable_info): New typedef.
9155         (Icf::Sections_reachable_list): New typedef.
9156         (Icf::Offset_info): New typedef.
9157         (Icf::Reloc_info): New struct typedef.
9158         (Icf::Reloc_info_list): New typedef.
9159         (Icf::symbol_reloc_list): Delete method.
9160         (Icf::addend_reloc_list): Delete method.
9161         (Icf::section_reloc_list): Delete method.
9162         (Icf::reloc_info_list): New method.
9163         (Icf::reloc_info_list_): New member.
9164
9165 2010-02-19  Doug Kwan  <dougkwan@google.com>
9166
9167         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9168         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9169         * arm.cc (Arm_relocation_functions): New forward declaration.
9170         (Target_arm::Target_arm): Initialize new data members
9171         got_mod_index_offset_ and tls_base_symbol_defined_.
9172         (Target_arm::Relocate::relocate_tls): New method.
9173         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9174          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9175         New methods.
9176         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9177         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9178         (Target_arm::got_mod_index_offset_,
9179         Target_arm::tls_base_symbol_defined_): New data members.
9180         (Target_arm::Scan::local, Target::Scan::global,
9181         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9182         relocations.
9183
9184 2010-02-18  Doug Kwan  <dougkwan@google.com>
9185
9186         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9187         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9188         text section as a parameter becuase some broken tools may not set
9189         the link in section header.
9190         (Target_arm::has_got_section): New method.
9191         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9192         without any mapping symbol as data only.  Remove warning.
9193         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9194         link in its section header, try to discover the link by inspecting the
9195         REL31 relocation at the beginning of the section.
9196         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9197         in error message.
9198         (Target_arm::Scan::global): Treat any reference to the symbol
9199         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9200
9201 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9202
9203         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9204         (Scan::global_reloc_may_be_function_pointer): New function.
9205         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9206         (Scan::global_reloc_may_be_function_pointer): New function.
9207         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9208         (Scan::global_reloc_may_be_function_pointer): New function.
9209         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9210         (Scan::global_reloc_may_be_function_pointer): New function.
9211         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9212         (Scan::global_reloc_may_be_function_pointer): New function.
9213         (Scan::possible_function_pointer_reloc): New function.
9214         (Target_x86_64::can_check_for_function_pointers): New function.
9215         * gc.h (gc_process_relocs): Scan relocation types to determine if
9216         function pointers were taken for targets that support it.
9217         * icf.cc (Icf::find_identical_sections): Include functions for
9218         folding in safe ICF whose pointer is not taken.
9219         * icf.h (Secn_fptr_taken_set): New typedef.
9220         (fptr_section_id_): New member.
9221         (section_has_function_pointers): New function.
9222         (set_section_has_function_pointers): New function.
9223         (check_section_for_function_pointers): New function.
9224         * options.h: Fix comment for safe ICF option.
9225         * target.h (can_check_for_function_pointers): New function.
9226         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9227         Modify icf_safe_test for X86-64.
9228         * testsuite/Makefile.in: Regenerate.
9229         * testsuite/icf_safe_so_test.cc: New file.
9230         * testsuite/icf_safe_so_test.sh: New file.
9231         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9232         (main): Change to take pointer to function kept_func_3.
9233         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9234         folding is done correctly for X86-64.
9235
9236 2010-02-12  David S. Miller  <davem@davemloft.net>
9237
9238         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9239         is_symbolless parameter.
9240         (Output_reloc<SHT_REL>::is_symbolless): New.
9241         (Output_reloc<SHT_REL>::is_symbolless_): New.
9242         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9243         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9244         (Output_reloc<SHT_RELA>::is_symbolless): New.
9245         (Output_data_reloc::add_global): Handle is_symbolless.
9246         (Output_data_reloc::add_global_relative): Likewise.
9247         (Output_data_reloc::add_local): Likewise.
9248         (Output_data_reloc::add_local_relative): Likewise.
9249         (Output_data_reloc::add_symbolless_global_addend): New.
9250         (Output_data_reloc::add_symbolless_local_addend): New.
9251         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9252         is_symbolless.
9253         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9254         instead of ->is_relative_
9255         (Output_reloc::write): Likewise.
9256         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9257         (Output_reloc::write_rel): Simplify.
9258
9259         * sparc.cc (Target_sparc::Scan::local): Use
9260         ->add_symbolless_local_addend as needed.
9261         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9262         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9263         based upon relocation offset.
9264
9265 2010-02-11  Doug Kwan  <dougkwan@google.com>
9266
9267         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9268         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9269         beginning of function.
9270         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9271         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9272         parameter is_32bit in calls to should_apply_static_reloc.
9273         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9274         (check_DATA): Add arm_abs_global.stdout.
9275         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9276         arm_abs_global.stdout): New rules.
9277         (MOSTLLYCLEANFILES): Add arm_abs_global
9278         * Makefile.in: Regenerate.
9279         * testsuite/arm_abs_global.s: New file.
9280         * testsuite/arm_abs_global.sh: Ditto.
9281         * testsuite/arm_abs_lib.s: Ditto.
9282
9283 2010-02-11  Ian Lance Taylor  <iant@google.com>
9284
9285         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9286         Read_relocs task.
9287         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9288         Allocate_commons_task first.
9289         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9290         task, rather than symtab_lock_.
9291         (Gc_process_relocs::~Gc_process_relocs): New function.
9292         (Gc_process_relocs::is_runnable): Check this_blocker_.
9293         (Gc_process_relocs::locks): Use next_blocker_ rather than
9294         blocker_.
9295         (Scan_relocs::~Scan_relocs): New function.
9296         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9297         symtab_lock_.
9298         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9299         next_blocker_.
9300         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9301         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9302         constructor accordingly.
9303         (class Gc_process_relocs): Likewise.
9304         (class Scan_relocs): Likewise.
9305         * common.h (class Allocate_commons_task): Remove symtab_lock_
9306         field, and corresponding constructor parameter.
9307         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9308         symtab_lock_.
9309         (Allocate_commons_task::locks): Likewise.
9310
9311 2010-02-11  Ian Lance Taylor  <iant@google.com>
9312
9313         * gold-threads.h (class Once): Define.
9314         (class Initialize_lock): Rewrite as child of Once.
9315         * gold-threads.cc (class Once_initialize): Define.
9316         (once_pointer_control): New static variable.
9317         (once_pointer, once_arg): New static variables.
9318         (c_run_once): New static function.
9319         (Once::Once, Once::run_once, Once::internal_run): New functions.
9320         (class Initialize_lock_once): Remove.
9321         (initialize_lock_control): Remove.
9322         (initialize_lock_pointer): Remove.
9323         (initialize_lock_once): Remove.
9324         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9325         (Initialize_lock::initialize): Rewrite.
9326         (Initialize_lock::do_run_once): New function.
9327         * archive.cc (Archive::interpret_header): Only clear name if it is
9328         not already empty.
9329         * fileread.cc: Include "gold-threads.h"
9330         (file_counts_lock): New static variable.
9331         (file_counts_initialize_lock): Likewise.
9332         (File_read::release): Only increment counts when using --stats.
9333         Use a lock around the increment.
9334         * parameters.cc (class Set_parameters_target_once): Define.
9335         (set_parameters_target_once): New static variable.
9336         (Parameters::Parameters): Move here from parameters.h.
9337         (Parameters::set_target): Rewrite.
9338         (Parameters::set_target_once): New function.
9339         (Parameters::clear_target): Move here and rewrite.
9340         * parameters.h (class Parameters): Update declarations.  Add
9341         set_parameters_target_once_ field.
9342         (Parameters::Parameters): Move to parameters.cc.
9343         (Parameters::clear_target): Likewise.
9344         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9345         task.
9346         (Start_group::~Start_group): New function.
9347         (Start_group::is_runnable): New function.
9348         (Start_group::locks, Start_group::run): New functions.
9349         (Finish_group::run): Change saw_undefined to size_t.
9350         * readsyms.h (class Start_group): Define.
9351         (class Finish_group): Change saw_undefined_ field to size_t.
9352         (Finish_group::Finish_group): Remove saw_undefined and
9353         this_blocker parameters.  Change all callers.
9354         (Finish_group::set_saw_undefined): New function.
9355         (Finish_group::set_blocker): New function.
9356         * symtab.h (class Symbol_table): Change saw_undefined to return
9357         size_t.  Change saw_undefined_ field to size_t.
9358         * target-select.cc (Set_target_once::do_run_once): New function.
9359         (Target_selector::Target_selector): Initialize set_target_once_
9360         field.  Don't initialize lock_ and initialize_lock_ fields.
9361         (Target_selector::instantiate_target): Rewrite.
9362         (Target_selector::set_target): New function.
9363         * target-select.h (class Set_target_once): Define.
9364         (class Target_selector): Update declarations.  Make
9365         Set_target_once a friend.  Remove lock_ and initialize_lock_
9366         fields.  Add set_target_once_ field.
9367
9368 2010-02-10  Ian Lance Taylor  <iant@google.com>
9369
9370         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9371         queueing any tasks.
9372         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9373         (queue_middle_tasks): Add all blockers before queueing any tasks.
9374         (queue_final_tasks): Likewise.
9375         * token.h (Task_token::add_blockers): New function.
9376         * object.h (Input_objects::number_of_relobjs): New function.
9377
9378 2010-02-10  Ian Lance Taylor  <iant@google.com>
9379
9380         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9381         shared, not if not position independent.
9382         * x86_64.cc (Relocate::relocate_tls): Likewise.
9383         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9384         (tls_pie_pic_test): New target.
9385         * testsuite/Makefile.in: Rebuild.
9386
9387         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9388         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9389         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9390         * testsuite/Makefile.in: Rebuild.
9391
9392 2010-02-09  David S. Miller  <davem@davemloft.net>
9393
9394         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9395         R_SPARC_RELATIVE using ->add_local_relative().
9396         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9397
9398         * output.h (Output_data_dynamic::add_section_size): New method
9399         that takes two Output_data objects.
9400         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9401         entry param.  Handle it in initializers.
9402         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9403         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9404         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9405         arg.
9406         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9407         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9408         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9409         for dynrel_includes_plt.
9410         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9411         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9412         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9413         before .rela.plt
9414         (Target_sparc::do_finalize_sections): Update to pass true for
9415         dynrel_includes_plt.
9416         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9417         output before .rela.plt
9418         (Target_powerpc::do_finalize_sections): Update to pass true for
9419         dynrel_includes_plt when 32-bit.
9420
9421 2010-02-08  Doug Kwan  <dougkwan@google.com>
9422
9423         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9424         method.
9425         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9426         Arm_relobj::scan_section_for_cortex_a8_stubs,
9427         Arm_relobj::do_relocation_section): Instead of calling
9428         Output_section::output_address, use faster
9429         Arm_relobj::simple_input_section_output_address.
9430
9431 2010-02-08  David S. Miller  <davem@davemloft.net>
9432
9433         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9434         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9435         relocation helper function.
9436
9437         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9438         just like R_SPARC_GOT{10,13,22}.
9439         (Target_sparc::Scan::local): Likewise.
9440         (Target_sparc::Relocate:relocate): Likewise.
9441
9442 2010-02-06  Ian Lance Taylor  <iant@google.com>
9443
9444         * configure.ac: Rewrite targetobjs duplicate removal code to use
9445         only shell constructs.
9446         * configure: Rebuild.
9447
9448 2010-02-05  Doug Kwan  <dougkwan@google.com>
9449
9450         PR 11247
9451         * arm.cc (Arm_relobj::section_is_scannable): New method.
9452         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9453         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9454
9455 2010-02-04  Doug Kwan  <dougkwan@google.com>
9456
9457         PR 11247
9458         * arm-reloc-property.cc (cstdio): Include.
9459         * configure.ac (targetobjs): Remove duplicates.
9460         * configure: Regenerate.
9461         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9462         big and little endian version for a given address size.
9463
9464 2010-02-03  Doug Kwan  <dougkwan@google.com>
9465
9466         * arm-reloc-property.cc
9467         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9468         definition.
9469         * arm-reloc-property.h
9470         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9471         New method definition.
9472         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9473         declaration.
9474         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9475         overflow to N.
9476         (GOT_PREL): Change implemented to Y.
9477         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9478         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9479         (Arm_relocate_functions::movw_abs_nc): Remove method.
9480         (Arm_relocate_functions::movt_abs): Ditto.
9481         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9482         (Arm_relocate_functions::thm_movt_abs): Ditto.
9483         (Arm_relocate_functions::movw_rel_nc): Ditto.
9484         (Arm_relocate_functions::movw_rel): Ditto.
9485         (Arm_relocate_functions::movt_rel): Ditto.
9486         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9487         (Arm_relocate_functions:thm_movw_rel): Ditto.
9488         (Arm_relocate_functions:thm_movt_rel): Ditto.
9489         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9490         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9491         New method definitions.
9492         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9493         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9494         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9495         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9496         (Target_arm::Relocate::relocate): Check for non-static or
9497         unimplemented relocation code and exit early.  Change calls to
9498         Target_arm::reloc_uses_thumb_bit and
9499         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9500         instead.  Refactor code to handle similar relocations to increase
9501         code sharing.  Remove check for unsupported relocation code in switch
9502         statement.
9503         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9504         relocation property table to find out size.  Change error message to
9505         print out the name of a relocation code instead of the numeric value.
9506         (Target_arm::scan_reloc_for_stub): Use relocation property table
9507         instead of calling Target_arm::reloc_uses_thumb_bit().
9508
9509 2010-02-02  Doug Kwan  <dougkwan@google.com>
9510
9511         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9512         types of relaxed input section.
9513
9514 2010-02-02  Doug Kwan  <dougkwan@google.com>
9515
9516         * Makefile.am (HFILES): Add arm-reloc-property.h.
9517         (DEFFILES): New.
9518         (TARGETSOURCES): Add arm-reloc-property.cc
9519         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9520         (libgold_a_SOURCES): $(DEFFILES)
9521         * Makefile.in: Regenerate.
9522         * arm-reloc-property.cc: New file.
9523         * arm-reloc-property.h: New file.
9524         * arm-reloc.def: New file.
9525         * arm.cc: Update comments.
9526         (arm-reloc-property.h): New included header.
9527         (arm_reloc_property_table): New global variable.
9528         (Target_arm::do_select_as_default_target): New method definition.
9529         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9530         arm-reloc-property to targ_extra_obj.
9531         * parameters.cc (set_parameters_target): Call
9532         Target::select_as_default_target().
9533         * target.h (Target::select_as_default_target): New method definition.
9534         (Target::do_select_as_default_target): Same.
9535
9536 2010-02-01  Doug Kwan  <dougkwan@google.com>
9537
9538         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9539         first_output_text_section_.
9540         (Arm_exidx_fixup::first_output_text_section): New method definition.
9541         (Arm_exidx_fixup::first_output_text_section_): New data member.
9542         (Arm_exidx_fixup::process_exidx_section): Record the first text
9543         output section seen.
9544         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9545         and entsize in output section header.
9546
9547 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9548
9549         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9550         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9551         (Arm_relocate_functions::thm_alu11): New Method.
9552         (Arm_relocate_functions::thm_pc8): New Method.
9553         (Arm_relocate_functions::thm_pc12): New Method.
9554         (Target_arm::Scan::local): Handle the relocations.
9555         (Target_arm::Scan::global): Likewise.
9556         (Target_arm::Relocate::relocate): Likewise.
9557         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9558
9559 2010-01-29  Doug Kwan  <dougkwan@google.com>
9560
9561         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9562         of relocation types as ld.
9563
9564 2010-01-29  Doug Kwan  <dougkwan@google.com>
9565
9566         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9567         to public.
9568         (Arm_relocate_functions::thumb_branch_common): Ditto.
9569         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9570         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9571         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9572         Arm_relocate_functions::jump24): Remove.
9573         (Target_arm::Relocate::relocate): Adjust code to call
9574         Arm_relocation_functions::arm_branch_common and
9575         Arm_relocation_functions::thumb_branch_common instead of their removed
9576         wrappers.  Merge switch-cases together to reduce source code size.
9577
9578 2010-01-29  Doug Kwan  <dougkwan@google.com>
9579
9580         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9581         output_local_symbol_count_needs_update_.
9582         (Arm_relobj::output_local_symbol_count_needs_update,
9583          Arm_relobj::set_output_local_symbol_count_needs_update,
9584          Arm_relobj::update_output_local_symbol_count): New methods.
9585         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9586         member.
9587         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9588         of pointed function as in a R_ARM_PREL31 relocation.
9589         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9590         for output local symbol count updating.
9591         (Target_arm::do_relax): Update output local symbol counts in objects
9592         if necessary.
9593         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9594
9595 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9596
9597         * arm.cc: Added support for the ARM relocations:
9598         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9599         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9600         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9601         movw_prel_nc).
9602         (Arm_relocate_functions::movw_rel): New method.
9603         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9604         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9605         thm_movw_prel_nc).
9606         (Arm_relocate_functions::thm_movw_rel): New method.
9607         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9608         thm_movt_prel).
9609         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9610         relocations.
9611         (Target_arm::Scan::global): Likewise.
9612         (Target_arm::Relocate::relocate): Likewise.
9613         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9614         Likewise.
9615
9616 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9617
9618         * arm.cc: Added support for ARM group relocations.
9619         (Target_arm::reloc_needs_sym_origin): New method.
9620         (Arm_relocate_functions::calc_grp_kn): New method.
9621         (Arm_relocate_functions::calc_grp_residual): New method.
9622         (Arm_relocate_functions::calc_grp_gn): New method.
9623         (Arm_relocate_functions::arm_grp_alu): New Method.
9624         (Arm_relocate_functions::arm_grp_ldr): New Method.
9625         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9626         (Arm_relocate_functions::arm_grp_ldc): New Method.
9627         (Target_arm::Scan::local): Handle the ARM group relocations.
9628         (Target_arm::Scan::global): Likewise.
9629         (Target_arm::Relocate::relocate): Likewise.
9630         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9631         Likewise.
9632
9633 2010-01-26  Doug Kwan  <dougkwan@google.com>
9634
9635         * arm.cc (set): Include.
9636         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9637         pointer type.
9638         (Arm_output_section::Text_section_list): New type.
9639         (Arm_output_section::append_text_sections_to_list): New method.
9640         (Arm_output_section::fix_exidx_coverage): Ditto.
9641         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9642         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9643         Relobj::set_section_offset() instead of
9644         Sized_relobj::invalidate_section_offset().
9645         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9646         parameter for section headers. Ignore relocation sections for
9647         unallocated sections and EXIDX sections.
9648         (Target_arm::fix_exidx_coverage): New method.
9649         (Target_arm::output_section_address_less_than): New type.
9650         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9651         linked text section instead of the EXIDX section.
9652         (Arm_output_section::create_stub_group): Add an assertion to check
9653         that this is not an EXIDX output section.
9654         (Arm_output_section::append_text_sections_to_list): New method.
9655         (Arm_output_section::fix_exidx_coverage): Ditto.
9656         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9657         Arm_relobj::section_needs_reloc_stub_scanning.
9658         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9659         first pass.
9660         (Target_arm::fix_exidx_coverage): New method.
9661         * object.h (Relobj::set_output_section): New method.
9662         (Sized_relobj::invalidate_section_offset): Remove method.
9663         (Sized_relobj::do_invalidate_section_offset): Remove method.
9664         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9665
9666 2010-01-25  Doug Kwan  <dougkwan@google.com>
9667
9668         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9669         Fix warning due to signed and unsigned comparison on a 32-bit host.
9670
9671 2010-01-22  Doug Kwan  <dougkwan@google.com>
9672
9673         * arm.cc (Target_arm::do_relax): Record an output section for section
9674         offset adjustment it contains any stub table that has changed.
9675         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9676         offsets in an output section if necessary.
9677         * output.cc (Output_section::Output_section): Initialize
9678         section_offsets_need_adjustments_.
9679         (Output_section::add_input_section_for_script): Renamed to
9680         Output_section::add_simple_input_section.
9681         (Output_section::save_states): Add a comment.
9682         (Output_section::discard_states): New method defintion.
9683         (Output_section::adjust_section_offsets): Same.
9684         * output.h (Output_section::add_input_section_for_script): Renamed to
9685         Output_section::add_simple_input_section.
9686         (Output_section::discard_states): New method declaration.
9687         (Output_section::adjust_section_offsets): Same.
9688         (Output_section::section_offsets_need_adjustment,
9689         Output_section::set_section_offsets_need_adjustment): New method
9690         definitions.
9691         (Output_section::section_offsets_need_adjustment_): New data member.
9692         * script-sections.cc
9693         (Output_section_element_input::set_section_address): Adjust code for
9694         renaming of Output_section::add_input_section_for_script.
9695         (Orphan_output_section::set_section_address): Same.
9696
9697 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9698
9699         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9700         Fix_v4bx enum values .
9701         * gold/options.h (General_options): New option definitions.
9702         (General_options::fix_v4bx): New method.
9703         (General_options::Fix_v4bx): New enum.
9704         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9705         (General_options::parse_fix_v4bx_interworking): New method.
9706
9707 2010-01-22  Doug Kwan  <dougkwan@google.com>
9708
9709         * arm.cc (Arm_exidx_fixup): New class.
9710
9711 2010-01-21  Doug Kwan  <dougkwan@google.com>
9712
9713         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9714         classes.
9715         (Arm_exidx_section_offset_map): New type.
9716
9717 2010-01-21  Doug Kwan  <dougkwan@google.com>
9718
9719         * arm.cc (Arm_exidx_input_section): New class.
9720         (Arm_relobj::exidx_input_section_by_link,
9721         Arm_relobj::exidx_input_section_by_shndx,
9722         Arm_relobj::make_exidx_input_section): New methods.
9723         (read_arm_attributes_section): Remove.
9724         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9725         information about them.
9726         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9727         to here.
9728
9729 2010-01-20  Doug Kwan  <dougkwan@google.com>
9730
9731         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9732         Input_section_specifier to Section_id.
9733         (Target_arm::new_arm_input_section: Adjust code for change of key
9734         type.
9735         (Target_arm::find_arm_input_section): Ditto.
9736         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9737         (Section_id): Remove.
9738         (Garbage_collection::Section_id_hash): Remove.
9739         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9740         (Section_id): Remove.
9741         (Icf::Section_id_hash): Remove.
9742         * object.h (Section_id, Const_section_id, Section_id_hash,
9743         Const_section_id_hash): New type definitions.
9744         * output.cc (Output_section::add_relaxed_input_section): Change to
9745         use Const_section_id instead of Input_section_specifier as key type.
9746         (Output_section::add_merge_input_section): Ditto.
9747         (Output_section::build_relaxation_map): Change to use Section_id
9748         instead of Input_section_specifier as key type.
9749         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9750         Ditto.
9751         (Output_section::convert_input_sections_to_relaxed_sections): Change
9752         to use Const_section_id instead of Input_section_specifier as key type.
9753         (Output_section::find_merge_section): Ditto.
9754         (Output_section::find_relaxed_input_section): Ditto.
9755         * output.h (Input_section_specifier): Remove class.
9756         (Output_section::Output_section_data_by_input_section_map): Change
9757         key type to Const_section_id.
9758         (Output_section::Output_relaxed_input_section_by_input_section_map):
9759         Ditto.
9760         (Output_section::Relaxation_map): Change key type to Section_id.
9761
9762 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9763
9764         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9765         (class Arm_v4bx_stub): New class.
9766         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9767         (Stub_factory::make_arm_v4bx_stub): New method.
9768         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9769         (Stub_table::empty): Handle v4bx stubs.
9770         (Stub_table::add_arm_v4bx_stub): New method.
9771         (Stub_table::find_arm_v4bx_stub): New method.
9772         (Arm_relocate_functions::v4bx): New method.
9773         (Target_arm::fix_v4bx): New method.
9774         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9775         (Stub_table::relocate_stubs): Likewise.
9776         (Stub_table::do_write): Likewise.
9777         (Stub_table::update_data_size_and_addralign): Likewise.
9778         (Stub_table::finalize_stubs):  Likewise.
9779         (Target_arm::Scan::local): Likewise.
9780         (Target_arm::Scan::global): Likewise.
9781         (Target_arm::do_finalize_sections): Likewise.
9782         (Target_arm::Relocate::relocate): Likewise.
9783         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9784         Likewise.
9785         (Target_arm::scan_reloc_for_stub): Likewise.
9786         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9787
9788 2010-01-19  Ian Lance Taylor  <iant@google.com>
9789
9790         * output.cc (Output_section_headers::do_sized_write): Write large
9791         segment count to sh_info field.
9792         (Output_file_header::do_sized_write): For large segment count,
9793         write PN_XNUM to e_phnum field.
9794
9795 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9796
9797         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9798         (Arm_relocate_functions::thm_jump8): New function.
9799         (Arm_relocate_functions::thm_jump11): New function.
9800         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9801         R_ARM_THM_JUMP11.
9802         (Target_arm::Scan::global): Likewise.
9803         (Target_arm::Relocate::relocate): Likewise.
9804         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9805         Likewise.
9806
9807 2010-01-14  Doug Kwan  <dougkwan@google.com>
9808
9809         * arm.cc (map, utility): Include headers.
9810         (Target_arm::apply_cortex_a8_workaround): New method.
9811         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9812         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9813         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9814         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9815         the --[no-]fix-cortex-a8 command line options.
9816         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9817         (Target_arm::relocate_stub): Use addend in instruction template.
9818         * options.h (DEFINE_bool): Set the user-set flag.
9819         (General_options): Add --[no-]-fix-cortex options.
9820         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9821         : Update fast look-up map after conversion.
9822
9823 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9824
9825         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9826         in the first pass of do_layout.
9827
9828 2010-01-13  Doug Kwan  <dougkwan@google.com>
9829
9830         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9831         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9832         apparent compiler problem of not folding static constant integral
9833         data members of elfcpp::Elf_sizes<32>.
9834
9835 2010-01-13  Doug Kwan  <dougkwan@google.com>
9836
9837         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9838         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9839         Arm_relobj::scan_section_for_cortex_a8_erratum,
9840         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9841         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9842         sections to scan for relocation stubs into a new method
9843         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9844         relocation and Cortex-A8 stub scanning.
9845         (Target_arm::do_relax): Force stubs to be after stubbed sections
9846         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9847         the beginning of a new relaxation pass.  Update a comment.
9848         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9849
9850 2010-01-12  Ian Lance Taylor  <iant@google.com>
9851
9852         * target-reloc.h (visibility_error): New inline function.
9853         (relocate_section): Call visibility_error.
9854         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9855         (MOSTLYCLEANFILES): Likewise.
9856         (protected_4_pic.o, protected_3.err): New targets.
9857         * testsuite/protected_4.cc: New file.
9858
9859 2010-01-12  Doug Kwan  <dougkwan@google.com>
9860
9861         * arm.cc (Cortex_a8_reloc): New class.
9862         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9863         and cortex_a8_relocs_info_.
9864         (Target_arm::fix_cortex_a8): New method definition.
9865         (Target_arm::Cortex_a8_relocs_info): New type.
9866         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9867         New data member declarations.
9868         (Target_arm::scan_reloc_for_stub): Record information about
9869         relocations for THUMB branches that might be exempted from the
9870         Cortex-A8 workaround.
9871         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9872         at the beginning of a relaxation pass.
9873
9874 2010-01-12  Doug Kwan  <dougkwan@google.com>
9875
9876         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9877         (Arm_relobj::Mapping_symbol_position,
9878          Arm_reloj::Mapping_symbol_position_less,
9879          Arm_relobj::Mapping_symbols_info): New types.
9880         (Target_arm::is_mapping_symbol_name): New method definition.
9881         (Arm_relobj::do_count_local_symbols): Save information about mapping
9882         symbols.
9883
9884 2010-01-11  Doug Kwan  <dougkwan@google.com>
9885
9886         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9887         Arm_relocate_functions::thumb32_branch_upper,
9888         Arm_relocate_functions::thumb32_branch_lower,
9889         Arm_relocate_functions::thumb32_cond_branch_offset,
9890         Arm_relocate_functions::thumb32_cond_branch_upper,
9891         Arm_relocate_functions::thumb32_cond_branch_lower,
9892         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9893         branch offset encoding.
9894         (Arm_relocate_functions::thumb_branch_common): Use new branch
9895         offset encoding methods to avoid code duplication.
9896         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9897         (Stub_addend_reader::operator()): Use new branch encoding method
9898         to avoid code duplication.
9899
9900 2010-01-11  Doug Kwan  <dougkwan@google.com>
9901
9902         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9903         (Target_arm::do_finalize_sections): Define special EXIDX section
9904         symbols only if referenced.
9905         * gc.h (Garbage_collection::add_reference): New method.
9906         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9907         code duplication.
9908
9909 2010-01-11  Ian Lance Taylor  <iant@google.com>
9910
9911         * script.cc (Version_script_info::build_expression_list_lookup):
9912         Change complaing about duplicate wildcard match from error to
9913         warning.
9914
9915         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9916         of 2009-12-30.
9917         (Version_script_info::Version_script_info): Initialize globs_,
9918         default_version_, default_is_global_, and exact_.  Don't
9919         initialize globals_ or locals_.
9920         (Version_script_info::build_lookup_tables): Build local symbols
9921         first.
9922         (Version_script_info::unquote): New function.
9923         (Version_script_info::add_exact_match): New function.
9924         (Version_script_info::build_expression_list_lookup): Remove lookup
9925         parameter.  Add is_global parameter.  Change all callers.  Handle
9926         wildcard pattern specially.  Unquote pattern.  Call
9927         add_exact_match.
9928         (Version_script_info::get_name_to_match): New function.
9929         (Version_script_info::get_symbol_version): New function.
9930         (Version_script_info::get_symbol_version_helper): Remove.
9931         (Version_script_info::check_unmatched_names): Call unquote.
9932         * script.h (class Version_script_info): Change get_symbol_version
9933         to be non-inline and add is_global parameter; change all callers.
9934         Rewrite symbol_is_local.  Update declarations.  Define struct
9935         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9936         Remove globals_ and locals_ members.  Add exact_, globs_,
9937         default_version_, is_global_.
9938         (Version_script_info::Glob): Remove pattern, add expression and
9939         is_global.  Update constructor.  Change all callers.
9940         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9941         default version.
9942         (Versions::symbol_section_contents): If a symbol is undefined, or
9943         defined in a dynamic object, set the version index to
9944         VER_NDX_LOCAL.
9945         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9946         symbol_is_local.
9947         (Symbol_table::add_from_pluginobj): Likewise.
9948         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9949
9950 2010-01-11  Doug Kwan  <dougkwan@google.com>
9951
9952         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9953         (incremental_dump_LDADD): Add linking option for libintl.
9954         * Makefile.in: Regenerate.
9955
9956 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9957
9958         PR gold/11144
9959         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9960         instead of -Ds.
9961         * testsuite/Makefile.in: Regenerated.
9962
9963 2010-01-10  Doug Kwan  <dougkwan@google.com>
9964
9965         * options.h (DEFINE_var): Use parentheses around argument varname__
9966         in macro body to avoid any unintended subsequent substitutions.
9967
9968 2010-01-10  Ian Lance Taylor  <iant@google.com>
9969
9970         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9971         candidates before doing symbol resolution.
9972
9973         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9974         ODR candidates if only one is weak.
9975
9976 2010-01-08  Ian Lance Taylor  <iant@google.com>
9977
9978         * script.cc (Version_script_info::build_expression_list_lookup):
9979         Don't warn about ambiguous version, just record the ambiguity.
9980         (Version_script_info::get_symbol_version_helper): Give error if
9981         version is ambiguous.
9982
9983 2010-01-08  Doug Kwan  <dougkwan@google.com>
9984
9985         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9986         prev_data_size_ and prev_addralign_.  Remove initializer for
9987         deleted data member has_been_changed_.
9988         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9989         to determine if the table is empty.
9990         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9991         Remove.
9992         (Stub_table::add_reloc_stub): Define method in class definition
9993         instead of just declaring it there.
9994         (Stub_table::add_cortex_a8_stub): New method definition.
9995         (Stub_table::update_data_size_and_addralign): Ditto.
9996         (Stub_table::finalize_stubs): Ditto.
9997         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9998         (Stub_table::do_addralign_): Return address alignment in the
9999         (Stub_table::do_reset_address_and_file_offset): Define method in
10000         class definition instead of declaring it there.  Set current data
10001         size to be the data size of the previous pass.
10002         (Stub_table::set_final_data_size): Use current data size as the
10003         final data size.
10004         (Stub_table::relocate_stub): Change parameter type of stub from
10005         Reloc_stub pointer to Stub pointer.
10006         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10007         (Stub_table::Cortex_a8_stub_list): New typedef.
10008         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10009          Stub_table::prev_addralign_): New data member.
10010         (Arm_relobj::Arm_relobj): Initialize data member
10011         section_has_cortex_a8_workaround_.
10012         (Arm_relobj::section_has_cortex_a8_workaround,
10013          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10014          definitions.
10015         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10016         declarations.
10017         (Target_arm::relocate_stub): Change parameter type of stub from
10018         Reloc_stub pointer to Stub pointer.
10019         (Insn_template::size, Insn_template::alignment): Handle
10020         THUMB16_SPECIAL_TYPE.
10021         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10022          Stub_table::update_data_size_and_addralign,
10023          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10024         definitions.
10025         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10026         (Stub_table::do_write): Ditto.
10027         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10028
10029 2010-01-08  Ian Lance Taylor  <iant@google.com>
10030
10031         PR 11108
10032         * symtab.h (class Symbol): Remove fields is_target_special_ and
10033         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10034         (Symbol::is_defined_in_discarded_section): New function.
10035         (Symbol::set_is_defined_in_discarded_section): New function.
10036         (Symbol::has_plt_offset): Rewrite.
10037         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10038         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10039         Don't initialize is_target_special_ or has_plt_offset_.
10040         Initialize is_defined_in_discarded_section_.
10041         (Symbol_table::add_from_relobj): If appropriate, set
10042         is_defined_in_discarded_section.
10043         * resolve.cc (Symbol::override_base_with_special): Don't test
10044         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10045         * target-reloc.h (relocate_section): Do special handling for
10046         symbols defined in discarded sections for global symbols as well
10047         as local symbols.
10048
10049 2010-01-08  Ian Lance Taylor  <iant@google.com>
10050
10051         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10052         the SHT_SYMTAB case.
10053
10054 2010-01-08  Ian Lance Taylor  <iant@google.com>
10055
10056         * object.cc (Sized_relobj::do_layout): Don't get confused if
10057         layout_eh_frame returns NULL.
10058
10059 2010-01-08  Ian Lance Taylor  <iant@google.com>
10060
10061         PR 11084
10062         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10063         dynamic symbol table, use the normal symbol table.
10064         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10065         symbol table.
10066
10067 2010-01-08  Ian Lance Taylor  <iant@google.com>
10068
10069         PR 11072
10070         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10071         sections.
10072
10073 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10074
10075         * version.cc (print_version): Change to "Copyright 2010".
10076
10077 2010-01-08  Ian Lance Taylor  <iant@google.com>
10078
10079         PR 10287
10080         PR 11063
10081         * i386.cc (class Target_i386): Change return type of plt_section
10082         to be non-const.
10083         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10084         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10085         tls_desc_rel_ field.
10086         (Output_data_plt_i386::rel_tls_desc): New function.
10087         (Target_i386::rel_tls_desc_section): New function.
10088         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10089         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10090         R_386_TLS_DESC reloc in rel_tls_desc_section.
10091         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10092         Define struct Tlsdesc_info.
10093         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10094         (Target_x86_64::do_reloc_symbol_index): New function.
10095         (Target_x86_64::add_tlsdesc_info): New function.
10096         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10097         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10098         tlsdesc_rel_ field.
10099         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10100         all callers.
10101         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10102         (Target_x86_64::rela_tlsdesc_section): New function.
10103         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10104         handling.
10105         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10106         (Target_x86_64::do_reloc_addend): New function.
10107         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10108         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10109         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10110         (Output_reloc::type): New function.
10111         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10112         (Output_reloc::is_target_specific): New function.
10113         (Output_reloc::target_arg): New function.
10114         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10115         absolute relocs and target specific relocs.
10116         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10117         add_target_specific.
10118         (class Output_data_reloc) [SHT_RELA]: Likewise.
10119         * output.cc (Output_reloc::Output_reloc): Add four new versions
10120         for absolute relocs and target specific relocs.
10121         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10122         (Output_reloc::get_symbol_index): Likewise.
10123         (Output_reloc::local_section_offset): Check that local_sym_index_
10124         is not TARGET_CODE or 0.
10125         (Output_reloc::symbol_value): Likewise.
10126         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10127         reloc.
10128         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10129         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10130         functions.
10131         * layout.cc (add_target_dynamic_tags): Use output section for
10132         DT_PLTRELSZ and DT_JMPREL.
10133
10134 2010-01-07  Ian Lance Taylor  <iant@google.com>
10135
10136         PR 11061
10137         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10138         function.
10139         (class Output_data_reloc_generic): Define.
10140         (class Output_data_reloc_base): Change base class to
10141         Output_data_reloc_generic.  Change add() method to call
10142         bump_relative_reloc_count for a relative reloc.  Remove
10143         sort_relocs_ field.
10144         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10145         to sort_relocs().
10146         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10147         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10148         appropriate.
10149         * layout.h (class Layout): Update declaration.
10150
10151 2010-01-07  Ian Lance Taylor  <iant@google.com>
10152
10153         * output.h (class Output_data): Add const version of
10154         output_section and do_output_section.
10155         (class Output_section_data): Add const version of
10156         do_output_section.
10157         (class Output_section): Likewise.
10158         * layout.cc (Layout::add_target_dynamic_tags): New function.
10159         * layout.h (class Layout): Update declarations.
10160         * arm.cc (Target_arm::do_finalize_sections): Use
10161         add_target_dynamic_tags.
10162         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10163         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10164         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10165         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10166
10167 2010-01-07  Ian Lance Taylor  <iant@google.com>
10168
10169         PR 11042
10170         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10171         object as needed.
10172
10173 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10174             Ian Lance Taylor  <iant@google.com>
10175
10176         PR 11019
10177         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10178         Xindex::read_symtab_xindex.
10179
10180 2010-01-07  Doug Kwan  <dougkwan@google.com>
10181
10182         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10183         (Insn_template::thumb16_bcond_insn): New method declaration.
10184         (Insn_template): Fix spelling.
10185         (Stub::thumb16_special): New method declaration.
10186         (Stub::do_write): Define virtual method which was previously pure
10187         virtual.
10188         (Stub::do_thumb16_special): New method declaration.
10189         (Stub::do_fixed_endian_write): New template member.
10190         (Reloc_stub::do_write): Remove.
10191         (Reloc_stub::do_fixed_endian_write): Remove.
10192         (Cortex_a8_stub): New class definition.
10193         (Stub_factory::make_cortex_a8_stub): New method definition.
10194         (Stub_factory::Stub_factory): Add missing static storage class
10195         qualifier for elf32_arm_stub_a8_veneer_blx.
10196
10197 2010-01-07  Ian Lance Taylor  <iant@google.com>
10198
10199         PR 10980
10200         * options.h (class General_options): Add --warn-unresolved-symbols
10201         and --error-unresolved-symbols.
10202         * errors.cc (Errors::undefined_symbol): Implement
10203         --warn-unresolved-symbols.
10204
10205         * options.h (class General_options): Add -z text and -z textoff.
10206         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10207
10208 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10209
10210         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10211         (Garbage_collection::cident_sections): New function.
10212         (Garbage_collection::add_cident_section): New function.
10213         (Garbage_collection::cident_sections_): New member.
10214         (gc_process_relocs): Add references to sections whose names are C
10215         identifiers.
10216         * gold.h (cident_section_start_prefix): New constant.
10217         (cident_section_stop_prefix): New constant.
10218         (is_cident): New function.
10219         * layout.cc (Layout::define_section_symbols): Replace string constants
10220         with the newly defined constants.
10221         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10222         C identifiers.
10223         * testsuite/Makefile.am: Add gc_orphan_section_test.
10224         * testsuite/Makefile.in: Regenerate.
10225         * testsuite/gc_orphan_section_test.cc: New file.
10226         * testsuite/gc_orphan_section_test.sh: New file.
10227
10228 2010-01-06  Ian Lance Taylor  <iant@google.com>
10229
10230         PR 10980
10231         * options.h (class General_options): Add --warn-shared-textrel.
10232         * layout.cc (Layout::finish_dynamic_section): Implement
10233         --warn-shared-textrel.
10234
10235         PR 10980
10236         * options.h (class General_options): Add --warn-multiple-gp.
10237
10238 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10239
10240         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10241         $(THREADSLIB) and $(LIBDL).
10242         * Makefile.in: Rebuild.
10243
10244 2010-01-06  Ian Lance Taylor  <iant@google.com>
10245
10246         PR 10980
10247         * options.cc (General_options::parse_section_start): New function.
10248         (General_options::section_start): New function.
10249         (General_options::General_options): Initialize all members.
10250         * options.h: Include <map>
10251         (class General_options): Add --section-start.  Add section_starts_
10252         member.
10253         * layout.cc (Layout::attach_allocated_section_to_segment): If
10254         --section-start was used, set the address of the segment.  Remove
10255         local sort_sections.
10256         (Layout::relaxation_loop_body): If the address of the load segment
10257         has been set by --section-start, don't use it.
10258         * output.h (Output_segment::update_flags_for_output_section): New
10259         function.
10260         * output.cc (Output_segment::add_output_section): Call
10261         update_flags_for_output_section.
10262
10263 2010-01-05  Ian Lance Taylor  <iant@google.com>
10264
10265         PR 10980
10266         * options.h (class General_options): Add --undefined-version.
10267         * script.cc (struct Version_expression): Add was_matched_by_symbol
10268         field.
10269         (Version_script_info::matched_symbol): New function.
10270         (Version_script_info::get_symbol_version_helper): Call
10271         matched_symbol.
10272         (Version_script_info::check_unmatched_names): New function.
10273         * script.h (class Version_script_info): Update declarations.
10274         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10275
10276         * options.h (class General_options): Use DEFINE_bool_alias for
10277         allow_multiple_definition.
10278         * resolve.cc (Symbol_table::should_override): Don't test
10279         allow_multiple_definition.
10280
10281         PR 10980
10282         * options.h (class General_options): Add --cref.
10283         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10284         until after printing cref table.
10285         * cref.cc: Include "symtab.h".
10286         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10287         (Cref_table_compare::operator()): New function.
10288         (Cref_inputs::gather_cref): New function.
10289         (filecol): New static const.
10290         (Cref_inputs::print_cref): New function.
10291         (Cref::print_cref): New function.
10292         * cref.h: Include <cstdio>.
10293         (class Cref): Update declarations.
10294         * mapfile.h (Mapfile::file): New function.
10295         * object.h (class Object): Define Symbols.  Declare virtual
10296         do_get_global_symbols.
10297         (Object::get_global_symbols): New function.
10298         * object.cc (Input_objects::add_object): Pass object to cref_ if
10299         --cref.
10300         (Input_objects::archive_start): Likewise.
10301         (Input_objects::archive_stop): Likewise.
10302         (Input_objects::print_cref): New function.
10303         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10304         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10305         --cref.
10306         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10307         function.
10308         * plugin.h (class Sized_pluginobj): Update declarations.
10309
10310 2010-01-05  Ian Lance Taylor  <iant@google.com>
10311
10312         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10313         to is_default_version.  Rename insdef to insdefault.
10314         (Symbol_table::add_from_relobj): Rename def to is_default_version
10315         and local to is_forced_local.
10316         (Symbol_table::add_from_pluginobj): Likewise.
10317         (Symbol_table::add_from_dynobj): Likewise.
10318         (Symbol_table::define_special_symbol): Rename insdef to
10319         insdefault.
10320
10321 2010-01-04  Ian Lance Taylor  <iant@google.com>
10322
10323         PR 10980
10324         * options.h (class General_options): Add
10325         --allow-multiple-definition and -z muldefs.
10326         * resolve.cc (Symbol_table::should_override): Don't warn about a
10327         multiple symbol definition if --allow-multiple-definition or -z
10328         muldefs.
10329
10330         PR 10980
10331         * options.h (class General_options): Add --add-needed and
10332         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10333         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10334         error if --copy-dt-needed-entries aka --add-needed is used and
10335         would cause a change in behaviour.
10336
10337         PR 10980
10338         * options.h (class General_options): Add -G as a short version of
10339         --shared.  Add no-op options -assert, -g, and -i.
10340
10341 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10342
10343         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10344         check for .text or .gnu.linkonce.t sections.
10345         * icf.cc (Icf::find_identical_sections): Ditto.
10346         Change the detection for mangled function name within the section
10347         name.
10348         * icf.h (is_section_foldable_candidate): New function.
10349
10350 2009-12-30  Ian Lance Taylor  <iant@google.com>
10351
10352         PR 10980
10353         * options.h (class General_options): Permit two dashes with
10354         --retain-symbols-file.
10355
10356 2009-12-30  Ian Lance Taylor  <iant@google.com>
10357
10358         PR 10979
10359         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10360         don't put the file header and segment headers in the text
10361         segment.
10362
10363         PR 10979
10364         * common.cc (Sort_commons::operator()): Stabilize sort when both
10365         entries are NULL.
10366         (Symbol_table::do_allocate_commons_list): When allocating common
10367         symbols, skip a symbol which is no longer common.
10368         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10369         an object before checking its type.
10370         * testsuite/common_test_2.c: New file.
10371         * testsuite/common_test_3.c: New file.
10372         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10373         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10374         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10375         (common_test_2_pic.o, common_test_2.so): New targets.
10376         (common_test_3_pic.o, common_test_3.so): New targets.
10377         * testsuite/Makefile.in: Rebuild.
10378
10379         PR 10979
10380         * script.cc (read_input_script): If we see a new SECTIONS clause,
10381         and we have added an input section, give an error.
10382         * layout.h (class Layout): Add have_added_input_section function.
10383         Add have_added_input_section_ field.
10384         * layout.cc (Layout::Layout): Initialize
10385         have_added_input_section_.
10386         (Layout::layout): Set have_added_input_section_.
10387         (Layout::layout_eh_frame): Likewise.
10388
10389 2009-12-30  Ian Lance Taylor  <iant@google.com>
10390
10391         PR 10931
10392         * options.h (class General_options): Add --sort-common option.
10393         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10394         * common.cc (Sort_common): Add sort_order parameter to
10395         constructor.  Add sort_order_ field.
10396         (Sort_commons::operator): Check sort_order_.
10397         (Symbol_table::allocate_commons): Determine the sort order.
10398         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10399         Change all callers.
10400         (Symbol_table::do_allocate_commons_list): Likewise.
10401
10402 2009-12-30  Ian Lance Taylor  <iant@google.com>
10403
10404         PR 10916
10405         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10406         symbols from this object, don't change the visibility of an
10407         undefined symbol.
10408         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10409
10410 2009-12-30  Ian Lance Taylor  <iant@google.com>
10411
10412         PR 10861
10413         * script.h (class Version_script_info): Define Language enum.
10414         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10415         new fields globals_, locals_, and is_finalized_.
10416         * script.cc: Various formatting fixes.
10417         (class Parser_closure): Change language_stack_ from a vector of
10418         std::string to one of Version_script_info::Language.  Adjust all
10419         uses accordingly.
10420         (class Lazy_demangler): Remove.
10421         (struct Version_expression): Change language from std::string to
10422         Version_script_info::Language.
10423         (Version_script_info::Version_script_info): New function.
10424         (Version_script_info::~Version_script_info): Don't call clear.
10425         (Version_script_info::finalize): New function.
10426         (Version_script_info::build_lookup_tables): New function.
10427         (Version_script_info::build_expression_list_lookup): New
10428         function.
10429         (Version_script_info::get_symbol_version_helper): Rewrite to use
10430         lookup tables.
10431         (Version_script_info::print_expression_list): Adjust to use
10432         Version_script_info::Language.
10433         (script_push_lex_into_version_mode): Check that the version script
10434         has not been finalized.
10435         (version_script_push_lang): Change language string to
10436         Version_script_info::Language.
10437         * options.cc (Command_line::version_script): New function.
10438         * options.h (class General_options): Add finalize_dynamic_list
10439         function.  Change version_script from declaration to definition.
10440         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10441         * testsuite/version_script.map: Remove duplicate def of foo.
10442         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10443         version_script.map.
10444         * testsuite/Makefile.in: Rebuild.
10445
10446 2009-12-30  Ian Lance Taylor  <iant@google.com>
10447
10448         PR 10843
10449         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10450         if the input symbol index is 0, make the output symbol index 0.
10451
10452 2009-12-30  Ian Lance Taylor  <iant@google.com>
10453
10454         PR 10670
10455         * options.h (class General_options): Add -x/--discard-all.
10456         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10457         --discard-all.  If the local symbol needs a dynamic entry, check
10458         that before handling --discard-locals.
10459
10460 2009-12-30  Ian Lance Taylor  <iant@google.com>
10461
10462         PR 10450
10463         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10464         flags to PF_R.
10465         (Output_segment::add_output_section): Don't change the flags if
10466         the type is PT_TLS.
10467
10468         PR 10450
10469         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10470         GNU hash table if they need a dynamic value.  Otherwise, don't add
10471         them if they are defined in a dynamic object or are forced local.
10472
10473 2009-12-29  Ian Lance Taylor  <iant@google.com>
10474
10475         PR 10450
10476         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10477         .gnu.hash table for a 32-bit target.
10478
10479         PR 10450
10480         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10481         regular and a dynamic object only needs a dynamic symbol table
10482         entry if it is externally visible.
10483
10484         PR 10450
10485         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10486         constructor.  Add global_offset_table_ field.
10487         (Target_i386::got_section): Set global_offset_table_.
10488         (Target_i386::do_finalize_sections): Set global_offset_table_
10489         size.
10490         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10491         in constructor.  Add global_offset_table_ field.
10492         (Target_x86_64::got_section): Set global_offset_table_.
10493         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10494         size.
10495
10496         * layout.cc (Layout::Layout): Initialize increase_relro_.
10497         (Layout::get_output_section): Add is_relro, is_last_relro, and
10498         is_first_non_relro parameters.  Change all callers.
10499         (Layout::choose_output_section): Likewise.
10500         (Layout::add_output_section_data): Likewise.
10501         (Layout::make_output_section): Likewise.
10502         (Layout::set_segment_offsets): Clear increase_relro when using a
10503         linker script.
10504         * layout.h (class Layout): Add increase_relro method.  Add
10505         increase_relro_ field.  Update declarations.
10506         * output.cc (Output_section::Output_section): Initialize
10507         is_last_relro_ and is_first_non_relro_.
10508         (Output_segment::add_output_section): Group relro sections is
10509         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10510         (Output_segment::maximum_alignment): Remove relro handling.
10511         (Output_segment::set_section_addresses): Add increase_relro
10512         parameter.  Change all callers.  Add initial alignment to align
10513         relro sections on separate page.  Remove old relro handling.
10514         (Output_segment::set_section_list_addresses): Remove in_relro
10515         parameter.  Change all callers.
10516         (Output_segment::set_offset): Add increase parameter.  Change all
10517         callers.  Remove old relro handling.
10518         * output.h (class Output_section): Add new methods: is_last_relro,
10519         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10520         Add is_last_relro_ and is_first_non_relro_ fields.
10521         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10522         Create separate .got.plt section.  Call increase_relro.
10523         * x86_64.cc (Target_x86_64::got_section): Likewise.
10524         * testsuite/relro_script_test.t: Add .got.plt.
10525
10526         PR 10450
10527         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10528         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10529         (Layout::finalize): Call set_dynamic_symbol_size.
10530         (Layout::set_dynamic_symbol_size): New function.
10531         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10532         set_dynamic_symbol_size.
10533
10534         PR 10450
10535         * output.h (class Output_section): Add is_entsize_zero_ field.
10536         * output.cc (Output_section::Output_section): Initialize
10537         is_entsize_zero_.
10538         (Output_section::set_entsize): If two different entsizes are
10539         requested, force it to zero.
10540         (Output_section::add_input_section): Set flags for .debug_str
10541         before updating section flags.  Set entsize.
10542         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10543         and SHF_STRING if all input sections have those flags.
10544
10545 2009-12-29   Rafael Espindola  <espindola@google.com>
10546
10547         * main.cc (main): Fix the sys time reporting.
10548         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10549         reporting.
10550
10551 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10552
10553         * options.cc (General_options::parse_version): Allow -v to exit
10554         without an error if there is nothing to link.
10555
10556 2009-12-29  Ian Lance Taylor  <iant@google.com>
10557
10558         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10559         using a version of gcc before 4.1.
10560         * configure: Rebuild.
10561
10562 2009-12-28  Chris Demetriou  <cgd@google.com>
10563
10564         * attributes.cc (Output_attributes_section_data::do_write): Use
10565         std::vector::front rather than std::vector::data.
10566
10567 2009-12-28  Ian Lance Taylor  <iant@google.com>
10568
10569         * symtab.h (class Symbol_table): Add enum Defined.
10570         * resolve.cc (Symbol_table::should_override): Add defined
10571         parameter.  Change all callers.  Test whether object is NULL
10572         before calling a method on it.
10573         (Symbol_table::report_resolve_problem): Add defined parameter.
10574         Change all callers.
10575         (Symbol_table::should_override_with_special): Likewise.
10576         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10577         parameter.  Change all callers.
10578         (Symbol_table::do_define_in_output_data): Likewise.
10579         (Symbol_table::define_in_output_segment): Likewise.
10580         (Symbol_table::do_define_in_output_segment): Likewise.
10581         (Symbol_table::define_as_constant): Likewise.
10582         (Symbol_table::do_define_as_constant): Likewise.
10583         * script.h (class Symbol_assignment): Add is_defsym parameter to
10584         constructor; change all callers.
10585         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10586         parameter.  Change all callers.  Add is_defsym_ field.
10587         (class Parser_closure): Add parsing_defsym parameter to
10588         constructor; change all callers.  Add parsing_defsym accessor
10589         function.  Add parsing_defsym_ field.
10590
10591 2009-12-28  Ian Lance Taylor  <iant@google.com>
10592
10593         * gold.cc (queue_middle_tasks): Fix formatting.
10594         * object.cc (Relobj::is_section_name_included): Likewise.
10595
10596 2009-12-23  Ian Lance Taylor  <iant@google.com>
10597
10598         * i386.cc (Target_i386::do_calls_non_split): Recognize
10599         -fsplit-stack prologue for a function with a static chain.
10600         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10601         -fsplit-stack prologue when using %r11.
10602
10603 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10604
10605         * options.cc (General_options::parse_version): Make -v continue and do
10606         the link like GNU ld does.
10607
10608 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10609
10610         * Makefile.am (CCFILES): Add timer.cc.
10611         (HFILES): Add timer.h.
10612         * configure.ac: Check for sysconf and times.
10613         * main.cc: include timer.h.
10614         (main): Use Timer instead of get_run_time.
10615         * timer.cc: New.
10616         * timer.h: New.
10617         * workqueue.cc: include timer.h.
10618         (Workqueue::find_and_run_task):
10619         Report user, sys and wall time.
10620         * Makefile.in: Regenerate.
10621         * config.in: Regenerate.
10622         * configure: Regenerate.
10623
10624 2009-12-16  Doug Kwan  <dougkwan@google.com>
10625
10626         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10627         sections.
10628         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10629         relaxed input sections.
10630         * output.cc (Output_section::find_relaxed_input_section): Change
10631         return type to Output_relaxed_input_section pointer.  Adjust code
10632         for new type of relaxed_input_section_map_.
10633         * output.h (Output_section::find_relaxed_input_section): Change
10634         return type to Output_relaxed_input_section pointer.
10635         (Output_section::Output_relaxed_input_section_by_input_section_map):
10636         New type.
10637         (Output_section::relaxed_input_section_map_): Change type to
10638         Output_section::Output_relaxed_input_section_by_input_section_map.
10639         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10640         input section.
10641
10642 2009-12-15  Ian Lance Taylor  <iant@google.com>
10643
10644         * layout.cc (Layout::create_shstrtab): Only write out after input
10645         sections if we are compressing debug sections.
10646
10647 2009-12-15  Ian Lance Taylor  <iant@google.com>
10648
10649         * archive.cc (Archive::add_symbols): Only look up a symbol without
10650         a version if there is, in fact, a version.
10651
10652 2009-12-14  Ian Lance Taylor  <iant@google.com>
10653
10654         Revert -Wshadow changes, all changes from:
10655         2009-12-11  Doug Kwan  <dougkwan@google.com>
10656         2009-12-11  Nick Clifton  <nickc@redhat.com>
10657         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10658
10659 2009-12-11  Doug Kwan  <dougkwan@google.com>
10660
10661         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10662         due to -Wshadow.
10663         * attributes.cc (Object_attribute::size): Ditto.
10664         (Attributes_section_data::size): Ditto.
10665         (Attributes_section_data::Attributes_section_data): Ditto.
10666         (Output_attributes_section_data::do_write): Ditto.
10667         * attributes.h (Object_attribute::set_type): Ditto.
10668         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10669
10670 2009-12-11  Nick Clifton  <nickc@redhat.com>
10671
10672         * archive.cc: Fix shadowed variable warnings.
10673         * arm.cc: Likewise.
10674         * compressed_output.cc: Likewise.
10675         * compressed_output.h: Likewise.
10676         * configure: Likewise.
10677         * dwarf_reader.cc: Likewise.
10678         * dynobj.cc: Likewise.
10679         * dynobj.h: Likewise.
10680         * ehframe.cc: Likewise.
10681         * ehframe.h: Likewise.
10682         * errors.cc: Likewise.
10683         * expression.cc: Likewise.
10684         * fileread.cc: Likewise.
10685         * fileread.h: Likewise.
10686         * freebsd.h: Likewise.
10687         * i386.cc: Likewise.
10688         * icf.cc: Likewise.
10689         * incremental.h: Likewise.
10690         * layout.cc: Likewise.
10691         * layout.h: Likewise.
10692         * mapfile.cc: Likewise.
10693         * merge.cc: Likewise.
10694         * merge.h: Likewise.
10695         * object.cc: Likewise.
10696         * object.h: Likewise.
10697         * options.h: Likewise.
10698         * output.cc: Likewise.
10699         * output.h: Likewise.
10700         * parameters.cc: Likewise.
10701         * plugin.cc: Likewise.
10702         * powerpc.cc: Likewise.
10703         * reduced_debug_output.cc: Likewise.
10704         * reduced_debug_output.h: Likewise.
10705         * reloc.cc: Likewise.
10706         * reloc.h: Likewise.
10707         * resolve.cc: Likewise.
10708         * script-sections.cc: Likewise.
10709         * script.cc: Likewise.
10710         * script.h: Likewise.
10711         * sparc.cc: Likewise.
10712         * symtab.cc: Likewise.
10713         * symtab.h: Likewise.
10714         * target-select.cc: Likewise.
10715         * target-select.h: Likewise.
10716         * token.h: Likewise.
10717         * workqueue.cc: Likewise.
10718         * workqueue.h: Likewise.
10719         * x86_64.cc: Likewise.
10720
10721 2009-12-10  Doug Kwan  <dougkwan@google.com>
10722
10723         * arm.cc (attributes.h): New include.
10724         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10725         (Arm_relobj::~Arm_relobj): Delete object pointed by
10726         attributes_section_data_.
10727         (Arm_relobj::attributes_section_data): New method definition.
10728         (Arm_relobj::attributes_section_data_): New data member declaration.
10729         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10730         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10731         attributes_section_data_.
10732         (Arm_dynobj::attributes_section_data): New method definition.
10733         (Arm_dynobj::attributes_section_data_): New data member declaration.
10734         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10735         initialization value of may_use_blx_ to false.
10736         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10737         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10738         object attributes to compute results instead of hard-coding.
10739         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10740         Target_arm::get_secondary_compatible_arch,
10741         Target_arm::set_secondary_compatible_arch
10742         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10743         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10744         New method declarations.
10745         (Target_arm::get_aeabi_object_attribute): New method definition.
10746         (Target_arm::attributes_section_data_): New data member declaration.
10747         (read_arm_attributes_section): New template definition.
10748         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10749         (Arm_dynobj::do_read_symbols): Ditto.
10750         (Target_arm::do_finalize_sections): Merge attributes sections from
10751         input.  Check for BLX use after attributes section merging.
10752         Fix __exidx_start and __exidx_end visibility.  Create an
10753         .ARM.attributes section if necessary.
10754         (Target_arm::get_secondary_compatible_arch,
10755         Target_arm::set_secondary_compatible_arch,
10756         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10757         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10758         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10759         New method definitions.
10760
10761 2009-12-09  Ian Lance Taylor  <iant@google.com>
10762
10763         * plugin.cc (Plugin::load): Don't cast from void* to a function
10764         pointer.
10765
10766 2009-12-09  Ian Lance Taylor  <iant@google.com>
10767
10768         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10769         information fields.
10770
10771 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10772
10773         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10774         Replace two_file_shared_1.so with two_file_shared_2.so.
10775         * testsuite/Makefile.in: Regenerated.
10776
10777 2009-12-08  Doug Kwan  <dougkwan@google.com>
10778
10779         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10780         (HFILES): Add attributes.h and int_encoding.h.
10781         * Makefile.in: Regenerate.
10782         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10783         function definitions to int_encoding.cc
10784         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10785         prototypes to int_encoding.h
10786         * reduced_debug_output.cc (int_encoding.h): New include.
10787         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10788         function definitions to int_encoding.cc
10789         (insert_into_vector, read_from_pointer): Move template definitions to
10790         int_encoding.h
10791         * attributes.cc: New file.
10792         * attributes.h: New file.
10793         * int_encoding.cc: New file.
10794         * int_encoding.h: New file.
10795
10796 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10797
10798         PR gold/11055
10799         * incremental-dump.cc (dump_incremental_inputs): New.
10800         (main): Use dump_incremental_inputs.
10801
10802 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10803
10804         PR gold/10893
10805         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10806         checking elfcpp::STT_FUNC.
10807         (Target_i386::Relocate::relocate): Likewise.
10808         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10809
10810         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10811         symbols from shared libraries into normal FUNC symbols.
10812
10813         * symtab.h (Symbol): Add is_func and use it.
10814
10815 2009-12-05  Doug Kwan  <dougkwan@google.com>
10816
10817         * arm.cc (Target_arm::arm_info): Initialize new fields
10818         attributes_section and attributes_vendor.
10819         * i386.cc (Target_i386::i386_info): Same.
10820         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10821         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10822         fields attributes_section and attributes_vendor.
10823         * sparc.cc (Target_sparc::sparc_info): Same.
10824         * target.h (Target::attributes_section, Target::attributes_vendor,
10825         Target::is_attributes_section, Target::attribute_arg_type,
10826         Target::attributes_order): New method definitions.
10827         (Target::Target_info::attributes_section,
10828         Target::Target_info::attributes_vendor): New fields.
10829         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10830         virtual method definitions.
10831         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10832         attributes_section and attributes_vendor.
10833         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10834
10835 2009-12-05  Doug Kwan  <dougkwan@google.com>
10836
10837         * arm.cc: Update comments about interworking and stub generation.
10838         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10839         considered as non-PIC.
10840         (Arm_relocate_functions::base_abs): Fix formatting.
10841         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10842         of function to use GOT entry address instead of offset.
10843         (Target_arm::Scan::global): Issue an error if a symbol would need a
10844         PLT does not get one because it is untyped.  Remove code to create
10845         dynamic symbols for relative branches.
10846         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10847         takes unsigned integer instead of boolean.
10848
10849 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10850
10851         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10852         (two_file_test_LDADD): Likewise.
10853         (common_test_1_LDADD): Likewise.
10854         (exception_test_LDADD) Likewise.
10855         (weak_test_LDADD): Likewise.
10856         (many_sections_test_LDADD): Likewise.
10857         (initpri1_LDADD): Likewise.
10858         (script_test_1_LDADD): Likewise.
10859         (script_test_2_LDADD): Likewise.
10860         (justsyms_LDADD): Likewise.
10861         (binary_test_LDADD): Likewise.
10862         (large_LDADD): Likewise.
10863         * testsuite/Makefile.in: Regenerated.
10864
10865 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10866
10867         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10868         (Symbol_table::override_with_special): Likewise.
10869         (Symbol_table::add_from_object): Likewise.
10870
10871 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10872
10873         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10874         Don't set the data_offset twice.
10875
10876 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10877
10878         * testsuite/Makefile.in: Regenerate.
10879
10880 2009-12-03  Doug Kwan  <dougkwan@google.com>
10881
10882         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10883         (Target_arm::do_finalize_sections): Add parameter for symbol table
10884         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10885         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10886         parameter for symbol table pointer.
10887         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10888         an additional parameter for a pointer to symbol table.
10889         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10890         parameter for a symbol table pointer.
10891         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10892         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10893         Ditto.
10894         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10895         parameter for a symbol table pointer.
10896
10897 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10898
10899         * incremental.cc (Incremental_inputs_header)
10900         (Incremental_inputs_header_write, Incremental_inputs_entry)
10901         (Incremental_inputs_entry_write): Move ...
10902         * incremental.h (Incremental_inputs_header)
10903         (Incremental_inputs_header_write, Incremental_inputs_entry)
10904         (Incremental_inputs_entry_write): here.
10905
10906 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10907
10908         * incremental.cc (make_sized_incremental_binary): Set the target.
10909         Error if it is incompatible.
10910         * output.h (Output_file): Add filename method.
10911
10912 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10913
10914         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10915         from the get_* methods.
10916
10917 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10918
10919         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10920         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10921         Write 0 for the data_offset of scripts.
10922
10923 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10924
10925         * testsuite/Makefile.am: Add the incremental_test.sh test.
10926         * testsuite/incremental_test.sh: New.
10927         * testsuite/incremental_test_1.c: New.
10928         * testsuite/incremental_test_2.c: New.
10929
10930 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10931
10932         * incremental-dump.cc (main): Fix typos.
10933
10934 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10935
10936         PR gold/11025
10937         * incremental-dump.cc (main): Use llu to print 64 bit values.
10938
10939 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10940             H.J. Lu  <hongjiu.lu@intel.com>
10941
10942         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10943         $(LIBDL).
10944         (incremental_dump_LDADD): Likewise.
10945         * Makefile.in: Regenerated.
10946
10947 2009-11-25  Doug Kwan  <dougkwan@google.com>
10948
10949         Revert:
10950
10951         2009-11-25  Doug Kwan  <dougkwan@google.com>
10952
10953                 * arm.cc (Target_arm::Target_arm): Move method definition
10954                 outside of class definition.  Add code to handle
10955                 --target1-rel, --target1-abs and --target2= options.
10956                 (Target_arm::get_reloc_reloc_type): Change method to be
10957                 non-static and const.
10958                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10959                 New data member declaration.
10960                 (Target_arm::Scan::local, Target_arm::Scan::global,
10961                 Target_arm::Relocate::relocate,
10962                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10963                 Adjust call to Target_arm::get_real_reloc_type.
10964                 (Target_arm::get_real_reloc_type): Use command line options
10965                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10966                 * options.h (--target1-rel, --target1-abs, --target2): New
10967                 ARM-only options.
10968
10969 2009-11-25  Doug Kwan  <dougkwan@google.com>
10970
10971         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10972         class definition.  Add code to handle --target1-rel, --target1-abs
10973         and --target2= options.
10974         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10975         and const.
10976         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10977         member declaration.
10978         (Target_arm::Scan::local, Target_arm::Scan::global,
10979         Target_arm::Relocate::relocate,
10980         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10981         call to Target_arm::get_real_reloc_type.
10982         (Target_arm::get_real_reloc_type): Use command line options to
10983         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10984         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10985         options.
10986
10987 2009-11-25  Doug Kwan  <dougkwan@google.com>
10988
10989         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10990         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10991         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10992         formatting.
10993         (Arm_relocate_functions::thm_call): Replace body with a call to
10994         Arm_relocate_functions::thumb_branch_common.
10995         (Arm_relocate_functions::thm_jump24,
10996         Arm_relocate_functions::thm_xpc22): New method definitions.
10997         (Arm_relocate_functions::thumb_branch_common): New method definition.
10998         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10999         operator.
11000         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11001         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11002
11003 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11004
11005         * Makefile.am: Build incremental-dump
11006         * Makefile.in: Regenerate.
11007         * incremental-dump.cc: New.
11008         * incremental.cc (Incremental_inputs_header_data,
11009         Incremental_inputs_entry_data): Move to incremental.h
11010         * incremental.h: (Incremental_inputs_header_data,
11011         Incremental_inputs_entry_data): Move from incremental.cc
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): Add a typedef with the data type.
11018
11019 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11020
11021         * incremental.cc (Incremental_inputs_header,
11022         Incremental_inputs_header_write, Incremental_inputs_entry,
11023         Incremental_inputs_entry_write): Update comment about which
11024         type has the filed descriptions.
11025
11026 2009-11-15  Doug Kwan  <dougkwan@google.com>
11027
11028         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11029         (Arm_relocate_functions::arm_branch_common): Change method defintion
11030         in class definition to a method declaration and update list of formal
11031         parameters.
11032         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11033         Arm_relocation_functions::jump24): Adjust call to
11034         Arm_relocate_functions::arm_branch_common.  Update list of formal
11035         parameters.
11036         (Arm_relocate_functions::xpc25): New method definition.
11037         (Arm_relocate_functions::arm_branch_common): Move method defintion
11038         out from class definition.  Use stubs for mode-switching and extending
11039         branch ranges.
11040         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11041         specially.  Change code to enable use of stubs in ARM branches.
11042
11043 2009-11-10  Doug Kwan  <dougkwan@google.com>
11044
11045         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11046         in method declaration.
11047         (Target_arm::relocate_stub): New method declaration.
11048         (Target_arm::default_target): Change to return a pointer instead of
11049         a const reference.
11050         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11051         Target_arm::default_target.
11052         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11053         method definition.
11054         (Target_arm::relocate_section): Adjust view.
11055         (Target_arm::relocate_stub): New method definition.
11056
11057 2009-11-10  Doug Kwan  <dougkwan@google.com>
11058
11059         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11060         a format warning.
11061         * incremental.cc (open_incremental_binary): Initialized local
11062         variables to avoid warnings.
11063         * object.cc (make_elf_object): Ditto.
11064         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11065         a format warning.
11066
11067 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11068
11069         PR gold/10930
11070         * testsuite/plugin_test.c: Include "config.h".
11071
11072 2009-11-09  Doug Kwan  <dougkwan@google.com>
11073
11074         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11075         (arm_symbol_value): Remove.
11076         (Arm_relocate_functions::arm_branch_common,
11077         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11078         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11079         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11080         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11081         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11082         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11083         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11084         Arm_relocate_functions::thm_mobw_abs_nc,
11085         Arm_relocate_functions::thm_mov_abs,
11086         Arm_relocate_functions::movw_prel_nc,
11087         Arm_relocate_functions::thm_movt_abs,
11088         Arm_relocate_functions::movt_prel,
11089         Arm_relocate_functions::thm_movw_prel_nc,
11090         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11091         (Target_arm::Relocate::relocate): Only decompose address into two
11092         parts if relocation type uses the thumb-bit and pass the actual
11093         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11094         calls to methods in Arm_relocate_functions for this change.
11095
11096 2009-11-08  Ian Lance Taylor  <iant@google.com>
11097
11098         PR 10925
11099         * reloc.cc: Instantiate
11100         Sized_relobj::initialize_input_to_output_maps and
11101         Sized_relobj:free_input_to_output_maps.
11102
11103 2009-11-06  Ian Lance Taylor  <iant@google.com>
11104
11105         PR 10876
11106         * defstd.cc (in_segment): Set only_if_ref true for "end".
11107
11108 2009-11-06  Doug Kwan  <dougkwan@google.com>
11109
11110         * arm.cc (class Reloc_stub): Correct a comment.
11111         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11112         (Target_arm::scan_section_for_stubs): New method declaration.
11113         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11114         Change methods from private to protected.
11115         (Target_arm::do_may_relax): New method definition.
11116         (Target_arm::do_relax, Target_arm::group_sections,
11117         Target_arm::scan_reloc_for_stub,
11118         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11119         (Target_arm::arm_input_section_map_): New data member declaration.
11120         (Target_arm::scan_reloc_for_stub,
11121         Target_arm::scan_reloc_section_for_stubs,
11122         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11123         Target_arm::do_relax): New method definitions.
11124
11125 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11126
11127         * configure.ac: Check for (struct stat)::st_mtim
11128         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11129         * config.in: Regenerate.
11130         * configure: Regenerate.
11131
11132 2009-11-05  Ian Lance Taylor  <iant@google.com>
11133
11134         PR 10910
11135         * output.cc (Output_segment::add_output_section): Add missing
11136         return statement.
11137
11138 2009-11-04  Ian Lance Taylor  <iant@google.com>
11139
11140         PR 10880
11141         * object.h (class Object): Add is_needed and set_is_needed
11142         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11143         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11144         defined in a dynamic object and referenced by a regular object,
11145         set is_needed for the dynamic object.
11146         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11147         if the file is marked with as_needed and it is not needed.
11148
11149 2009-11-04  Ian Lance Taylor  <iant@google.com>
11150
11151         PR 10887
11152         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11153         tags if data is discarded by linker script.
11154         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11155         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11156         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11157         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11158
11159 2009-11-04  Ian Lance Taylor  <iant@google.com>
11160
11161         * layout.cc (Layout::get_output_section): Add is_interp and
11162         is_dynamic_linker_section parameters.  Change all callers.
11163         (Layout::choose_output_section): Likewise.
11164         (Layout::make_output_section): Likewise.
11165         (Layout::add_output_section_data): Add is_dynamic_linker_section
11166         parameter.  Change all callers.
11167         * layout.h (class Layout): Update declarations.
11168         * output.h (class Output_section): Add is_interp, set_is_interp,
11169         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11170         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11171         generate_code_fills_at_write_ to a bitfield.
11172         * output.cc (Output_section::Output_sections): Initialize new
11173         fields.
11174         (Output_segment::add_output_section): Add do_sort parameter.
11175         Change all callers.
11176
11177 2009-11-03  Ian Lance Taylor  <iant@google.com>
11178
11179         PR 10860
11180         * options.h (class General_options): Add --warn-common.
11181         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11182         merging two common symbols.
11183         (Symbol_table::should_override): Handle --warn-common when merging
11184         a common symbol with a defined symbol.  Use report_resolve_problem
11185         for multiple definitions.
11186         (Symbol_table::report_resolve_problem): New function.
11187         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11188
11189 2009-11-03  Doug Kwan  <dougkwan@google.com>
11190
11191         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11192         stub_factory_.
11193         (Target_arm::stub_factory): New method definition.
11194         (Target_arm::new_arm_input_section,
11195         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11196         Target_arm::reloc_uses_thumb_bit): New method declarations.
11197         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11198         New type definitions.
11199         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11200         member declarations.
11201         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11202         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11203         New method definitions.
11204
11205 2009-11-03  Ian Lance Taylor  <iant@google.com>
11206
11207         * options.h (class General_options): Add --warn_constructors.
11208
11209 2009-11-03  Ian Lance Taylor  <iant@google.com>
11210
11211         PR 10893
11212         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11213         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11214
11215 2009-11-03  Ian Lance Taylor  <iant@google.com>
11216
11217         PR 10895
11218         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11219         --msgid-bugs-address.
11220         (install-pdf): New target.
11221         (install-data_yes): Look up one directory to find mkinstalldirs.
11222
11223 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11224
11225         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11226         tree.
11227
11228 2009-10-30  Doug Kwan  <dougkwan@google.com>
11229
11230         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11231
11232 2009-10-30  Doug Kwan  <dougkwan@google.com>
11233
11234         * arm.cc (Stub_addend_reader): New struct template definition
11235         and partial specializations.
11236         (Stub_addend_reader::operator()): New method definition for a
11237         partially specialized template.
11238
11239 2009-10-30  Doug Kwan  <dougkwan@google.com>
11240
11241         * arm.cc (Arm_relobj::processor_specific_flags): New method
11242         definition.
11243         (Arm_relobj::do_read_symbols): New method declaration.
11244         (Arm_relobj::processor_specific_flags_): New data member declaration.
11245         (Arm_dynobj): New class definition.
11246         (Target_arm::do_finalize_sections): Add input_objects parameter.
11247         (Target_arm::do_adjust_elf_header): New method declaration.
11248         (Target_arm::are_eabi_versions_compatible,
11249         (Target_arm::merge_processor_specific_flags): New method declaration.
11250         (Target_arm::do_make_elf_object): New overloaded method definitions
11251         and declaration.
11252         (Arm_relobj::do_read_symbols): New method definition.
11253         (Arm_dynobj::do_read_symbols): Ditto.
11254         (Target_arm::do_finalize_sections): Add input_objects parameters.
11255         Merge processor-specific flags from all input objects.
11256         (Target_arm::are_eabi_versions_compatible,
11257         Target_arm::merge_processor_specific_flags,
11258         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11259         New method definitions.
11260         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11261         Input_objects pointer type parameter.
11262         * layout.cc (Layout::finalize): Pass input objects to target's.
11263         finalize_sections function.
11264         * output.cc (Output_file_header::do_sized_write): Set ELF file
11265         header's processor-specific flags.
11266         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11267         Input_objects pointer type parameter.
11268         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11269         * target.h (Input_objects): New forward class declaration.
11270         (Target::processor_specific_flags,
11271         Target::are_processor_specific_flags_sect): New method definitions.
11272         (Target::finalize_sections): Add input_objects parameter.
11273         (Target::Target): Initialize processor_specific_flags_ and
11274         are_processor_specific_flags_set_.
11275         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11276         parameter.
11277         (Target::set_processor_specific_flags): New method definition.
11278         (Target::processor_specific_flags_,
11279         Target::are_processor_specific_flags_set_): New data member
11280         declarations.
11281         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11282         Input_objects pointer type parameter.
11283
11284 2009-10-30  Doug Kwan  <dougkwan@google.com>
11285
11286         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11287
11288 2009-10-28  Ian Lance Taylor  <iant@google.com>
11289
11290         * object.h (class Relobj): Drop options parameter from
11291         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11292         do_scan_relocs, do_relocate.  Change all callers.
11293         (class Sized_relobj): Drop options parameters from
11294         do_gc_process_relocs, do_scan_relocs, do_relocate,
11295         do_relocate_sections, relocate_sections, emit_relocs_scan,
11296         emit_relocs_scan_reltype.  Change all callers.
11297         (struct Relocate_info): Remove options field and all references to
11298         it.
11299         * reloc.h (class Read_relocs): Remove options constructor
11300         parameter and options_ field.  Change all callers.
11301         (class Gc_process_relocs, class Scan_relocs): Likewise.
11302         (class Relocate_task): Likewise.
11303         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11304         all callers.
11305         (scan_relocatable_relocs): Likewise.
11306         * target.h (class Sized_target): Remove options parameter from
11307         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11308         all callers.
11309         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11310         callers.
11311         * arm.cc: Update functions to remove options parameters.
11312         * i386.cc: Likewise.
11313         * powerpc.cc: Likewise.
11314         * sparc.cc: Likewise.
11315         * x86_64.cc: Likewise.
11316         * testsuite/testfile.cc: Likewise.
11317
11318 2009-10-28  Doug Kwan  <dougkwan@google.com>
11319
11320         * arm.cc (Arm_relobj): New class definition.
11321         (Arm_relobj::scan_sections_for_stubs,
11322         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11323         New method definitions.
11324
11325 2009-10-28  Cary Coutant  <ccoutant@google.com>
11326
11327         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11328         (Plugin::cleanup_done_): New member.
11329         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11330         (Plugin_manager::cleanup_done_): Remove.
11331         (Plugin_manager::add_input_file): Edit error message.
11332         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11333         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11334
11335 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11336
11337         * fileread.cc: (File_read::View::~View): Use the new
11338         data_ownership_ filed.
11339         (File_read::~File_read): Dispose the new whole_file_view_.
11340         (File_read::open): Mmap the whole file if needed.
11341         (File_read::open): Use whole_file_view_ instead of contents_.
11342         (File_read::find_view): Use whole_file_view_ if applicable.
11343         (File_read::do_read): Use whole_file_view_ instead of contents_.
11344         (File_read::make_view): Use whole_file_view_ instead of contents_,
11345         update File_read::View::View call.
11346         (File_read::find_or_make_view): Update File_read::View::View
11347         call.
11348         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11349         remove contents_
11350         (File_read::View::Data_ownership): New enum.
11351         (File_read::View::View): Replace bool mapped_ with Data_ownership
11352         argument.
11353         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11354         (File_read::View::data_ownership_): New field.
11355         (File_read::contents_): Remove (replaced by whole_file_view_).
11356         (File_read::whole_file_view_): New field.
11357         * options.h (class General_options): Add --keep-files-mapped.
11358
11359 2009-10-27  Cary Coutant  <ccoutant@google.com>
11360
11361         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11362         * testsuite/Makefile.am (plugin_test_5): New test case.
11363         * testsuite/Makefile.in: Regenerate.
11364
11365 2009-10-25  Doug Kwan  <dougkwan@google.com>
11366
11367         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11368         from private to protected to allow access by child class.
11369         (Sized_relobj::do_relocate_sections): New method declaration.
11370         (Sized_relobj::relocate_sections): Virtualize.
11371         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11372         Sized_relobj::relocate_sections.  Instantiate template explicitly
11373         for different target sizes and endianity.
11374
11375 2009-10-24  Doug Kwan  <dougkwan@google.com>
11376
11377         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11378         (Arm_input_section::as_arm_input_section): New method.
11379         (Arm_output_section): New class definition.
11380         (Arm_output_section::create_stub_group,
11381         Arm_output_section::group_sections): New method definitions.
11382
11383 2009-10-22  Doug Kwan  <dougkwan@google.com>
11384
11385         * arm.cc (Arm_input_section): New class definition.
11386         (Arm_input_section::init, Arm_input_section:do_write,
11387         Arm_input_section::set_final_data_size,
11388         Arm_input_section::do_reset_address_and_file_offset): New method
11389         definitions.
11390
11391 2009-10-21  Doug Kwan  <dougkwan@google.com>
11392
11393         * arm.cc (Stub_table, Arm_input_section): New forward class
11394         declarations.
11395         (Stub_table): New class defintion.
11396         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11397         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11398         New method definition.
11399
11400 2009-10-21  Doug Kwan  <dougkwan@google.com>
11401
11402         * arm.cc: Update copyright comments.
11403         (Target_arm): New forward class template declaration.
11404         (Arm_address): New type.
11405         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11406         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11407         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11408         constants.
11409         (Insn_template): Same.
11410         (DEF_STUBS): New macro.
11411         (Stub_type): New enum type.
11412         (Stub_template): New class definition.
11413         (Stub): Same.
11414         (Reloc_stub): Same.
11415         (Stub_factory): Same.
11416         (Target_arm::Target_arm): Initialize may_use_blx_ and
11417         should_force_pic_veneer_.
11418         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11419         Target_arm::should_force_pic_veneer,
11420         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11421         Target_arm::using_thumb_only, Target_arm:;default_target): New
11422         method defintions.
11423         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11424         New data member declarations.
11425         (Insn_template::size, Insn_template::alignment): New method defintions.
11426         (Stub_template::Stub_template): New method definition.
11427         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11428         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11429         (Stub_factory::Stub_factory): New method definition.
11430         * gold.h (string_hash): New template.
11431         * output.h (Input_section_specifier::hash_value): Use
11432         gold::string_hash.
11433         (Input_section_specifier::string_hash): Remove.
11434         * stringpool.cc (Stringpool_template::string_hash): Use
11435         gold::string_hash.
11436
11437 2009-10-20  Doug Kwan  <dougkwan@google.com>
11438
11439         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11440         symbols of relaxed input sections.
11441         * output.h (Output_section::find_relaxed_input_section): Make
11442         method public.
11443
11444 2009-10-16  Doug Kwan  <dougkwan@google.com>
11445
11446         * dynobj.cc (Versions::Versions): Initialize version_script_.
11447         Only insert base version symbol definition for a shared object
11448         if version script defines any version versions.
11449         (Versions::define_base_version): New method definition.
11450         (Versions::add_def): Check that base version is not needed.
11451         (Versions::add_need): Define base version lazily.
11452         * dynobj.h (Versions::define_base_version): New method declaration.
11453         (Versions::needs_base_version_): New data member declaration.
11454         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11455         (check_DATA): Add no_version_test.stdout.
11456         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11457         New make rules.
11458         * testsuite/Makefile.in: Regenerate.
11459         * testsuite/no_version_test.c: New file.
11460         * testsuite/no_version_test.sh: Ditto.
11461
11462 2009-10-16  Doug Kwan  <dougkwan@google.com>
11463
11464         * expression.cc (class Segment_start_expression): New class definition.
11465         (Segment_start_expression::value): New method definition.
11466         (script_exp_function_segment_start): Return a new
11467         Segment_start_expression.
11468         * gold/script-c.h (script_saw_segment_start_expression): New function
11469         prototype.
11470         * script-sections.cc (Script_sections::Script_sections): Initialize
11471         SAW_SEGMENT_START_EXPRESSION_ to false.
11472         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11473         and -Tbbs options to specify section addresses if given in
11474         command line and no SEGMENT_START expression is seen in a script.
11475         * script-sections.h (Script_sections::saw_segment_start_expression,
11476         Script_sections::set_saw_segment_start_expression): New method
11477         definition.
11478         (Script_sections::saw_segment_start_expression_): New data member
11479         declaration.
11480         * script.cc (script_saw_segment_start_expression): New function.
11481         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11482         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11483         script_test_7.sh and script_test_8.sh.
11484         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11485         script_test_8.stdout.
11486         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11487         (script_test_6, script_test_6.stdout, script_test_7,
11488         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11489         * Makefile.in: Regenerate.
11490         * testsuite/script_test_6.sh: New file.
11491         * testsuite/script_test_6.t: Same.
11492         * testsuite/script_test_7.sh: Same.
11493         * testsuite/script_test_7.t: Same.
11494         * testsuite/script_test_8.sh: Same.
11495
11496 2009-10-16  Doug Kwan  <dougkwan@google.com>
11497
11498         * output.cc (Output_segment::set_section_list_address): Cast
11499         expressions to unsigned long long type to avoid format warnings.
11500
11501 2009-10-15  Ian Lance Taylor  <iant@google.com>
11502
11503         * script.cc (Script_options::add_symbol_assignment): Always add a
11504         dot assignment to script_sections_.
11505         * script-sections.cc (Script_sections::add_dot_assignment):
11506         Initialize if necessary.
11507
11508         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11509         program headers with no load segment if there is a linker script.
11510
11511         * layout.cc (Layout::set_segment_offsets): Align the file offset
11512         to the segment aligment for -N or -n with no load segment.
11513         * output.cc (Output_segment::add_output_section): Don't crash if
11514         the first section is a TLS section.
11515         (Output_segment::set_section_list_addresses): Print an error
11516         message if the address moves backward in a linker script.
11517         * script-sections.cc
11518         (Output_section_element_input::set_section_addresses): Don't
11519         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11520         (Orphan_output_section::set_section_addresses): Likewise.
11521
11522 2009-10-15  Doug Kwan  <dougkwan@google.com>
11523
11524         * layout.cc (Layout::finish_dynamic_section): Generate tags
11525         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11526         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11527         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11528
11529 2009-10-14  Ian Lance Taylor  <iant@google.com>
11530
11531         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11532         fields.
11533         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11534         data_shdr fields of relinfo.
11535         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11536         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11537         R_386_TLS_LDO_32, adjust based on section flags.
11538         (Target_i386::Relocate::fix_up_ldo): Remove.
11539
11540 2009-10-13  Ian Lance Taylor  <iant@google.com>
11541
11542         Add support for -pie.
11543         * options.h (class General_options): Add -pie and
11544         --pic-executable.
11545         (General_options::output_is_position_independent): Test -pie.
11546         (General_options::output_is_executable): Return true if not shared
11547         and not relocatable.
11548         (General_options::output_is_pie): Remove.
11549         * options.cc (General_options::finalize): Reject incompatible uses
11550         of -pie.
11551         * gold.cc (queue_middle_tasks): A -pie link is not static.
11552         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11553         * symtab.cc (Symbol::final_value_is_known): Return false if
11554         output_is_position_independent.
11555         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11556         output_is_position_independent.
11557         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11558         output_is_position_independent.
11559         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11560         output_is_position_independent.
11561         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11562         two_file_pie_test.
11563         (basic_pie_test.o, basic_pie_test): New targets.
11564         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11565         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11566         (two_file_pie_test): New target.
11567         * testsuite/Makefile.in: Rebuild.
11568         * README: Remove note saying that -pie is not supported.
11569
11570 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11571
11572         * options.h (class General_options): Add -init and -fini.
11573         * layout.cc (Layout::finish_dynamic_section): Emit
11574         given init and fini functions.
11575
11576 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11577
11578         * gc.h (gc_process_relocs): Check if icf is enabled using new
11579         function.
11580         * gold.cc (queue_initial_tasks): Likewise.
11581         (queue_middle_tasks): Likewise.
11582         * object.cc (do_layout): Likewise.
11583         * symtab.cc (is_section_folded): Likewise.
11584         * main.cc (main): Likewise.
11585         * reloc.cc (Read_relocs::run): Likewise.
11586         (Sized_relobj::do_scan_relocs): Likewise.
11587         * icf.cc (is_function_ctor_or_dtor): New function.
11588         (Icf::find_identical_sections): Check if function is ctor or dtor when
11589         safe icf is chosen.
11590         * options.h (General_options::icf): Change option to be an enum.
11591         (Icf_status): New enum.
11592         (icf_enabled): New method.
11593         (icf_safe_folding): New method.
11594         (set_icf_status): New method.
11595         (icf_status_): New variable.
11596         * (options.cc) (General_options::finalize): Set icf_status_.
11597         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11598         icf_test and icf_keep_unique_test to use the --icf enum flag.
11599         * testsuite/icf_safe_test.sh: New file.
11600         * testsuite/icf_safe_test.cc: New file.
11601
11602 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11603
11604         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11605         includes to gc.h and icf.h.
11606         * arm.cc: Include gc.h.
11607         * gold.cc: Likewise.
11608         * i386.cc: Likewise.
11609         * powerpc.cc: Likewise.
11610         * sparc.cc: Likewise.
11611         * x86_64.cc: Likewise.
11612         * gc.h: Include icf.h.
11613
11614 2009-10-11  Ian Lance Taylor  <iant@google.com>
11615
11616         * plugin.cc: Include "gold.h" before other header files.
11617
11618 2009-10-10  Chris Demetriou  <cgd@google.com>
11619
11620         * options.h (Input_file_argument::Input_file_type): New enum.
11621         (Input_file_argument::is_lib_): Replace with...
11622         (Input_file_argument::type_): New member.
11623         (Input_file_argument::Input_file_argument): Take Input_file_type
11624         'type' rather than boolean 'is_lib' as second argument.
11625         (Input_file_argument::is_lib): Use type_.
11626         (Input_file_argument::is_searched_file): New function.
11627         (Input_file_argument::may_need_search): Handle is_searched_file.
11628         * options.cc (General_options::parse_library): Support -l:filename.
11629         (General_options::parse_just_symbols): Update for Input_file_argument
11630         changes.
11631         (Command_line::process): Likewise.
11632         * archive.cc (Archive::get_file_and_offset): Likewise.
11633         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11634         * script.cc (read_script_file, script_add_file): Likewise.
11635         * fileread.cc (Input_file::Input_file): Likewise.
11636         (Input_file::will_search_for): Handle is_searched_file.
11637         (Input_file::open): Likewise.
11638         * readsyms.cc (Read_symbols::get_name): Likewise.
11639         * testsuite/Makefile.am (searched_file_test): New test.
11640         * testsuite/Makefile.in: Regenerate.
11641         * testsuite/searched_file_test.cc: New file.
11642         * testsuite/searched_file_test_lib.cc: New file.
11643
11644 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11645             Ian Lance Taylor  <iant@google.com>
11646
11647         * descriptor.cc: Include <cstdio> and "binary-io.h".
11648         (Descriptors::open): Open the files in binary mode always.
11649         * script.cc (Lex::get_token): Treat \r as whitespace.
11650
11651 2009-10-09  Ian Lance Taylor  <iant@google.com>
11652
11653         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11654
11655 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11656             Ian Lance Taylor  <iant@google.com>
11657
11658         * configure.ac: Check for readv function also.
11659         * fileread.cc (readv): Define if not HAVE_READV.
11660         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11661         does not exist.
11662         * config.in: Regenerate.
11663         * configure: Regenerate.
11664
11665 2009-10-09  Doug Kwan  <dougkwan@google.com>
11666
11667         * layout.cc (Layout::make_output_section): Call target hook to make
11668         ordinary output section.
11669         (Layout::finalize): Adjust parameter list of call the
11670         Target::may_relax().
11671         * layout.h (class Layout::section_list): New method.
11672         * merge.h (Output_merge_base::entsize): Change visibility to public.
11673         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11674         New methods.
11675         (Output_merge_string::do_is_string): New method.
11676         * object.cc (Sized_relobj::do_setup): renamed from
11677         Sized_relobj::set_up.
11678         * object.h (Sized_relobj::adjust_shndx,
11679         Sized_relobj::initializ_input_to_output_maps,
11680         Sized_relobj::free_input_to_output_maps): Change visibilities to
11681         protected.
11682         (Sized_relobj::setup): Virtualize.
11683         (Sized_relobj::do_setup): New method declaration.
11684         (Sized_relobj::invalidate_section_offset,
11685         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11686         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11687         * options.cc (parse_int): New function.
11688         * options.h (parse_int): New declaration.
11689         (DEFINE_int): New macro.
11690         (stub_group_size): New option.
11691         * output.cc (Output_section::Output_section): Initialize memebers
11692         merge_section_map_, merge_section_by_properties_map_,
11693         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11694         (Output_section::add_input_section): Handled deferred code-fill
11695         generation and remove an old comment.
11696         (Output_section::add_relaxed_input_section): New method definition.
11697         (Output_section::add_merge_input_section): Use merge section by
11698         properties map to speed to search.  Update merge section maps
11699         as appropriate.
11700         (Output_section::build_relaxation_map): New method definition.
11701         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11702         Same.
11703         (Output_section::relax_input_section): Renamed to
11704         Output_section::convert_input_sections_to_relaxed_sections and change
11705         interface to take a vector of pointers to relaxed sections.
11706         (Output_section::find_merge_section,
11707         Output_section::find_relaxed_input_section): New method definitions.
11708         (Output_section::is_input_address_mapped,
11709         Output_section::output_offset, Output_section::output_address):
11710         Use output section data maps to speed up searching.
11711         (Output_section::find_starting_output_address): Add comments.
11712         (Output_section::do_write,
11713         Output_section::write_to_postprocessing_buffer): Do code-fill
11714         generation as appropriate.
11715         (Output_section::get_input_sections): Invalidate relaxed input section
11716         map.
11717         (Output_section::restore_states): Adjust type of checkpoint .
11718         Invalidate relaxed input section map.
11719         * output.h (Output_merge_base): New class declaration.
11720         (Input_section_specifier): New class defintion.
11721         (class Output_relaxed_input_section) Change base class to
11722         Output_section_data_build.
11723         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11724         base class initializer.
11725         (Output_section::add_relaxed_input_section): New method declaration.
11726         (Output_section::Input_section): Change visibility to protected.
11727         (Output_section::Input_section::relobj,
11728         Output_section::Input_section::shndx): Handle relaxed input sections.
11729         Output_section::input_sections) Change visibility to protected.  Also
11730         define overload to return a non-const pointer.
11731         (Output_section::Merge_section_properties): New class defintion.
11732         (Output_section::Merge_section_by_properties_map,
11733         Output_section::Output_section_data_by_input_section_map,
11734         Output_section::Relaxation_map): New types.
11735         (Output_section::relax_input_section): Rename method to
11736         Output_section::convert_input_sections_to_relaxed_sections and change
11737         interface to take a vector of relaxed section pointers.
11738         (Output_section::find_merge_section,
11739         Output_section::find_relaxed_input_section,
11740         Output_section::build_relaxation_map,
11741         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11742         New method declarations.
11743         (Output_section::merge_section_map_
11744         Output_section::merge_section_by_properties_map_,
11745         Output_section::relaxed_input_section_map_,
11746         Output_section::is_relaxed_input_section_map_valid_,
11747         Output_section::generate_code_fills_at_write_): New data members.
11748         * script-sections.cc
11749         (Output_section_element_input::set_section_addresses): Call
11750         current_data_size and addralign methods of relaxed input sections.
11751         (Orphan_output_section::set_section_addresses): Call current_data_size
11752         and addralign methods of relaxed input sections.
11753         * symtab.cc (Symbol_table::compute_final_value): Extract template
11754         from the body of Symbol_table::sized_finalize_symbol.
11755         (Symbol_table::sized_finalized_symbol): Call
11756         Symbol_table::compute_final_value.
11757         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11758         (Symbol_table::compute_final_value): New templated method declaration.
11759         * target.cc (Target::do_make_output_section): New method defintion.
11760         * target.h (Target::make_output_section): New method declaration.
11761         (Target::relax): Add more parameters for input objects, symbol table
11762         and layout.  Adjust call to do_relax.
11763         (Target::do_make_output_section): New method declaration.
11764         (Target::do_relax): Add parameters for input objects, symbol table
11765         and layout.
11766
11767 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11768
11769         * pread.c: Include stdio.h.
11770
11771 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11772
11773         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11774         defined.
11775
11776 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11777
11778         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11779         Change read_shndx type to unsigned int.
11780         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11781         int.
11782         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11783         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11784         Change read_shndx type to unsigned int.
11785         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11786         int.
11787         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11788         * layout.cc (Layout::create_symtab_sections): Cast the result of
11789         local_symcount * symsize to off_t in the gold_assert.
11790
11791 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11792
11793         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11794         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11795         R_ARM_BASE_ABS.
11796         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11797         (Arm_relocate_functions::thm_abs5): New function.
11798         (Arm_relocate_functions::abs12): New function.
11799         (Arm_relocate_functions::abs16): New function.
11800         (Arm_relocate_functions::base_abs): New function.
11801         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11802         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11803         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11804         R_ARM_BASE_ABS.
11805         (Scan::global): Likewise.
11806         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11807         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11808         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11809         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11810         R_ARM_BASE_ABS.
11811
11812 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11813
11814         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11815         (Arm_relocate_functions::movt_prel): New function.
11816         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11817         (Arm_relocate_functions::thm_movt_prel): New function.
11818         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11819         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11820         (Scan::global, Relocate::relocate): Likewise.
11821         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11822
11823 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11824
11825         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11826         Incremental_checker.
11827         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11828         unsigned int.
11829         (class Incremental_inputs_header): New class.
11830         (Incremental_inputs_header_writer): Edit comment.
11831         (Incremental_inputs_entry): New class.
11832         (Incremental_inputs_entry_writer): Edit comment.
11833         (Sized_incremental_binary::do_find_incremental_inputs_section):
11834         Add *strtab_shndx parameter, fill it.
11835         (Sized_incremental_binary::do_check_inputs): New method.
11836         (Incremental_checker::can_incrementally_link_output_file): Use
11837         Sized_incremental_binary::check_inputs.
11838         (Incremental_inputs::report_command_line): Save command line in
11839         command_line_.
11840         * incremental.h:
11841         (Incremental_binary::find_incremental_inputs_section): New
11842         method.
11843         (Incremental_binary::do_find_incremental_inputs_section): Add
11844         strtab_shndx parameter.
11845         (Incremental_binary::do_check_inputs): New pure virtual method.
11846         (Sized_incremental_binary::do_check_inputs): Declare.
11847         (Incremental_checker::Incremental_checker): Add incremental_inputs
11848         parameter, use it to initialize incremental_inputs_.
11849         (Incremental_checker::incremental_inputs_): New field.
11850         (Incremental_checker::command_line): New method.
11851         (Incremental_checker::inputs): New method.
11852         (Incremental_checker::command_line_): New field.
11853
11854 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11855
11856         * incremental.cc: Include <cstdarg> and "target-select.h".
11857         (vexplain_no_incremental): New function.
11858         (explain_no_incremental): New function.
11859         (Incremental_binary::error): New method.
11860         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11861         method.
11862         (make_sized_incremental_binary): New function.
11863         (open_incremental_binary): New function.
11864         (can_incrementally_link_file): Add checks if output is ELF and has
11865         inputs section.
11866         * incremental.h: Include "elfcpp_file.h" and "output.h".
11867         (Incremental_binary): New class.
11868         (Sized_incremental_binary): New class.
11869         (open_incremental_binary): Declare.
11870         * object.cc (is_elf_object): Use
11871         elfcpp::Elf_recognizer::is_elf_file.
11872         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11873         * output.h (Output_file::filesize): New method.
11874
11875 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11876
11877         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11878         New function.
11879         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11880         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11881         function.
11882         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11883         function.
11884         (Arm_relocate_functions::movw_abs_nc): New function.
11885         (Arm_relocate_functions::movt_abs): New function.
11886         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11887         (Arm_relocate_functions::thm_movt_abs): New function.
11888         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11889         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11890         (Scan::global): Likewise.
11891         (Relocate::relocate): Likewise.
11892         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11893
11894 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11895
11896         * arm.cc (Arm_relocate_functions::got_prel) New function.
11897         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11898         (Relocate::relocate): Likewise.
11899         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11900
11901 2009-10-06  Ian Lance Taylor  <iant@google.com>
11902
11903         * options.h (class General_options): Define
11904         split_stack_adjust_size parameter.
11905         * object.h (class Object): Add uses_split_stack_ and
11906         has_no_split_stack_ fields.  Add uses_split_stack and
11907         has_no_split_stack accessor functions.  Declare
11908         handle_split_stack_section.
11909         (class Reloc_symbol_changes): Define.
11910         (class Sized_relobj): Define Function_offsets.  Declare
11911         split_stack_adjust, split_stack_adjust_reltype, and
11912         find_functions.
11913         * object.cc (Object::handle_split_stack_section): New function.
11914         (Sized_relobj::do_layout): Call handle_split_stack_section.
11915         * dynobj.cc (Sized_dynobj::do_layout): Call
11916         handle_split_stack_section.
11917         * reloc.cc (Sized_relobj::relocate_sections): Call
11918         split_stack_adjust for executable sections in split_stack
11919         objects.  Pass reloc_map to relocate_section.
11920         (Sized_relobj::split_stack_adjust): New function.
11921         (Sized_relobj::split_stack_adjust_reltype): New function.
11922         (Sized_relobj::find_functions): New function.
11923         * target-reloc.h: Include "object.h".
11924         (relocate_section): Add reloc_symbol_changes parameter.  Change
11925         all callers.
11926         * target.h (class Target): Add calls_non_split method.  Declare
11927         do_calls_non_split virtual method.  Declare match_view and
11928         set_view_to_nop.
11929         * target.cc: Include "elfcpp.h".
11930         (Target::do_calls_non_split): New function.
11931         (Target::match_view): New function.
11932         (Target::set_view_to_nop): New function.
11933         * gold.cc (queue_middle_tasks): Give an error if mixing
11934         split-stack and non-split-stack objects with -r.
11935         * i386.cc (Target_i386::relocate_section): Add
11936         reloc_symbol_changes parameter.
11937         (Target_i386::do_calls_non_split): New function.
11938         * x86_64.cc (Target_x86_64::relocate_section): Add
11939         reloc_symbol_changes parameter.
11940         (Target_x86_64::do_calls_non_split): New function.
11941         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11942         parameter.
11943         * powerpc.cc (Target_powerpc::relocate_section): Add
11944         reloc_symbol_changes parameter.
11945         * sparc.cc (Target_sparc::relocate_section): Add
11946         reloc_symbol_changes parameter.
11947         * configure.ac: Call AM_CONDITIONAL for the default target.
11948         * configure: Rebuild.
11949         * testsuite/Makefile.am (TEST_AS): New variable.
11950         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11951         (check_DATA): Add split_i386 and split_x86_64 files.
11952         (SPLIT_DEFSYMS): Define.
11953         (split_i386_[1234n].o): New targets.
11954         (split_i386_[124]): New targets.
11955         (split_i386_[1234r].stdout): New targets.
11956         (split_x86_64_[1234n].o): New targets.
11957         (split_x86_64_[124]): New targets.
11958         (split_x86_64_[1234r].stdout): New targets.
11959         (MOSTLYCLEANFILES): Add new executables.
11960         * testsuite/split_i386.sh: New file.
11961         * testsuite/split_x86_64.sh: New file.
11962         * testsuite/split_i386_1.s: New file.
11963         * testsuite/split_i386_2.s: New file.
11964         * testsuite/split_i386_3.s: New file.
11965         * testsuite/split_i386_4.s: New file.
11966         * testsuite/split_i386_n.s: New file.
11967         * testsuite/split_x86_64_1.s: New file.
11968         * testsuite/split_x86_64_2.s: New file.
11969         * testsuite/split_x86_64_3.s: New file.
11970         * testsuite/split_x86_64_4.s: New file.
11971         * testsuite/split_x86_64_n.s: New file.
11972         * testsuite/testfile.cc (Target_test): Update relocation_section
11973         function.
11974         * testsuite/Makefile.in: Rebuild.
11975
11976 2009-10-06  Ian Lance Taylor  <iant@google.com>
11977
11978         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11979         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11980         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11981         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11982         the address on ldo_addrs_.
11983         (Target_i386::Relocate::fix_up_ldo): New function.
11984
11985 2009-10-06   Rafael Espindola  <espindola@google.com>
11986
11987         * plugin.cc (add_input_library): New.
11988         (Plugin::load): Add add_input_library to tv.
11989         (Plugin_manager::add_input_file): Add the is_lib argument.
11990         (add_input_file): Update call to Plugin_manager::add_input_file.
11991         (add_input_library): New.
11992         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11993
11994 2009-09-30  Doug Kwan  <dougkwan@google.com>
11995
11996         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11997         symbol and call Symbol::may_need_copy_reloc to determine if
11998         a copy reloc is needed.
11999         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12000         nocopyreloc is given in command line.
12001         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12002         given in command line.
12003         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12004         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12005         of the removed Target_i386::may_need_copy_reloc.
12006         * options.h (copyreloc): New option with default value false.
12007         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12008         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12009         instead of the removed Target_powerpc::may_need_copy_reloc.
12010         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12011         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12012         instead of the removed Target_sparc::may_need_copy_reloc.
12013         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12014         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12015         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12016         instead of the removed Target_x86_64::may_need_copy_reloc.
12017
12018 2009-09-30  Ian Lance Taylor  <iant@google.com>
12019
12020         * object.h (class Object): Remove target_ field, and target,
12021         sized_target, and set_target methods.
12022         (Object::sized_target): Remove.
12023         (class Sized_relobj): Update declarations.  Remove sized_target.
12024         * object.cc (Sized_relobj::setup): Remove target parameter.
12025         Change all callers.
12026         (Input_objects::add_object): Don't do anything with the target.
12027         (make_elf_sized_object): Add punconfigured parameter.  Change all
12028         callers.  Set or test parameter target.
12029         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12030         Change all callers.
12031         * parameters.cc (Parameters::set_target): Change parameter type to
12032         be non-const.
12033         (Parameters::default_target): Remove.
12034         (set_parameters_target): Change parameter type to be non-const.
12035         (parameters_force_valid_target): New function.
12036         (parameters_clear_target): New function.
12037         * parameters.h (class Parameters): Update declarations.  Remove
12038         default_target method.  Add sized_target and clear_target
12039         methods.  Change target_ to be non-const.
12040         (set_parameters_target): Update declaration.
12041         (parameters_force_valid_target): Declare.
12042         (parameters_clear_target): Declare.
12043         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12044         as NULL if we aren't searching.
12045         (Add_symbols::run): Don't check for compatible target.
12046         * fileread.cc (Input_file::open_binary): Call
12047         parameters_force_valid_target.
12048         * gold.cc (queue_middle_tasks): Likewise.
12049         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12050         set_target on object.
12051         * dynobj.h (class Sized_dynobj): Update declarations.
12052         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12053         make_elf_object returns NULL.
12054         (Archive::include_member): Don't check whether object target is
12055         compatible.
12056         * output.cc (Output_section::add_input_section): Get target from
12057         parameters.
12058         (Output_section::relax_input_section): Likewise.
12059         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12060         parameters.
12061         (Sized_relobj::do_scan_relocs): Likewise.
12062         (Sized_relobj::relocate_sections): Likewise.
12063         * resolve.cc (Symbol_table::resolve): Likewise.
12064         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12065         parameter.  Change all callers.
12066         (Symbol_table::add_from_object): Get target from parameters.
12067         (Symbol_table::add_from_relobj): Don't check object target.
12068         (Symbol_table::add_from_dynobj): Likewise.
12069         (Symbol_table::define_special_symbol): Get target from
12070         parameters.
12071         * symtab.h (class Symbol_table): Update declaration.
12072         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12073         parameter.  Change all callers.  Clear parameter target.
12074         (Binary_test): Test target here.
12075         * testsuite/object_unittest.cc (gold_testsuite): Remove
12076         target_test_pointer parameter.  Change all callers.
12077         (Object_test): Test target here.
12078
12079 2009-09-26  Ian Lance Taylor  <iant@google.com>
12080
12081         * testsuite/initpri1.c: Don't try to use constructor priorities if
12082         compiling with gcc before 4.3.
12083
12084 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12085
12086         * testsuite/retain_symbols_file_test.sh (check_present): Change
12087         output file name to retain_symbols_file_test.stdout.
12088         (check_absent): Likewise.
12089
12090 2009-09-18  Craig Silverstein  <csilvers@google.com>
12091
12092         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12093         * options.cc: Include <cerrno> and <fstream>.
12094         (General_options::finalize): Parse -retain-symbols-file tag.
12095         * options.h: New flag.
12096         (General_options): New method should_retain_symbol, new
12097         variable symbols_to_retain.
12098         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12099         should_retain_symbol map.
12100         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12101         * testsuite/Makefile.in: Regenerate.
12102         * testsuite/retain_symbols_file_test.sh: New file.
12103
12104 2009-09-18  Nick Clifton  <nickc@redhat.com>
12105
12106         * po/es.po: Updated Spanish translation.
12107
12108 2009-09-17  Doug Kwan  <dougkwan@google.com>
12109
12110         * debug.h (DEBUG_RELAXATION): New constant.
12111         (DEBUG_ALL): Add DEBUG_RELAXATION.
12112         (debug_string_to_enum): Add relaxation debug option.
12113         * layout.cc
12114         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12115         Layout::Relaxation_debug_check::read_sections,
12116         Layout::Relaxation_debug_check::read_sections): New method definitions.
12117         (Layout::Layout): Initialize data members
12118         record_output_section_data_from_scrips_,
12119         script_output_section_data_list_ and relaxation_debug_check_.
12120         (Layout::save_segments, Layout::restore_segments,
12121         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12122         Layout::relaxation_loop_body): New method definitions.
12123         (Layout::finalize): Support relaxation.  Move section layout code to
12124         Layout::relaxation_loop_body.
12125         (Layout::set_asection_address_from_script): Move code for orphan
12126         section placement out.
12127         (Layout::place_orphan_sections_in_script): New method definition.
12128         * layout.h (Output_segment_headers, Output_file_header):
12129         New forward class declarations.
12130         (Layout::~Layout): Define.
12131         (Layout::new_output_section_data_from_script): New method definition.
12132         (Layout::place_orphan_sections_in_script): New method declaration.
12133         (Layout::Segment_states): New type declaration.
12134         (Layout::save_segments, Layout::restore_segments,
12135         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12136         Layout::relaxation_loop_body): New method declarations.
12137         (Layout::Output_section_data_list): New type declaration.
12138         (Layout::Relaxation_debug_check): New class definition.
12139         (Layout::record_output_section_data_from_script_,
12140         Layout::script_output_section_data_list_, Layout::segment_states_,
12141         Layout::relaxation_debug_check_): New data members.
12142         * output.cc: (Output_section_headers::do_size): New method definition.
12143         (Output_section_headers::Output_section_headers): Move size
12144         computation to Output_section_headers::do_size.
12145         (Output_segment_headers::do_size): New method definition.
12146         (Output_file_header::Output_file_header): Move size computation to
12147         Output_file_header::do_size and call it.
12148         (Output_file_header::do_size): New method definition.
12149         (Output_data_group::Output_data_group): Adjust call to
12150         Output_section_data.
12151         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12152         (Output_symtab_xindex::do_write): Add array bound check.
12153         (Output_section::Input_section::print_to_mapfile): Handle
12154         RELAXED_INPUT_SECTION_CODE.
12155         (Output_section::Output_section): Initialize data member checkpoint_.
12156         (Output_section::~Output_section): Delete checkpoint object pointed
12157         by checkpoint_.
12158         (Output_section::add_input_section): Always add an Input_section if
12159         relaxing.
12160         (Output_section::add_merge_input_section): Add assert.
12161         (Output_section::relax_input_section): New method definition.
12162         (Output_section::set_final_data_size): Set load address to zero for
12163         an unallocated section.
12164         (Output_section::do_address_and_file_offset_have_reset_values):
12165         New method definition.
12166         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12167         Handle relaxed input section.
12168         (Output_section::sort_attached_input_sections): Checkpoint input
12169         section list lazily.
12170         (Output_section::get_input_sections): Change type of input_sections to
12171         list of Simple_input_section pointers.  Checkpoint input section list
12172         lazily.  Also handle relaxed input sections.
12173         (Output_section::add_input_section_for_script): Take a reference to
12174         a Simple_input_section object instead of Relobj pointer and section
12175         index as parameter.  Handle relaxed input sections.
12176         (Output_section::save_states, Output_section::restore_states): New
12177         method definitions.
12178         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12179         (Output_data::is_data_size_fixed): New method definition.
12180         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12181         if it is fixed.
12182         (Output_data::address_and_file_offset_have_reset_values): New method
12183         definition.
12184         (Output_data::do_address_and_file_offset_have_reset_values): New method
12185         definition.
12186         (Output_data::set_data_size): Check that data size is not fixed.
12187         (Output_data::fix_data_size): New method definition.
12188         (Output_data::is_data_size_fixed_): New data member.
12189         (Output_section_headers::set_final_data_size): New method definition.
12190         (Output_section_headers::do_size): New method declaration.
12191         (Output_segment_headers::set_final_data_size): New method definition.
12192         (Output_segment_headers::do_size): New method declaration.
12193         (Output_file_header::set_final_data_size)::New method definition.
12194         (Output_file_header::do_size)::New method declaration.
12195         (Output_section_data::Output_section_data): Add new parameter
12196         is_data_size_fixed and use it to fix data size.
12197         (Output_data_const::Output_data_const): Adjust call to base class
12198         constructor and fix data size.
12199         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12200         base class constructor and fix data size.
12201         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12202         base class constructor and fix data size.
12203         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12204         class constructor and fix data size.
12205         (Output_data_group::set_final_data_size): New method definition.
12206         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12207         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12208         class constructor and fix data size.
12209         (Output_relaxed_input_section): New class definition.
12210         (Output_section::Simple_input_section): New class definition.
12211         (Output_section::get_input_sections): Adjust parameter list.
12212         (Output_section::add_input_section_for_script): Same.
12213         (Output_section::save_states, Output_section::restore_states,
12214         Output_section::do_address_and_file_offset_have_reset_values,
12215         (Output_section::Input_section::Input_section): Handle
12216         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12217         Output_relaxed_input_section.
12218         (Output_section::Input_section::is_input_section,
12219         Output_section::Input_section::set_output_section): Handle relaxed
12220         input section.
12221         (Output_section::Input_section::is_relaxed_input_section,
12222         Output_section::Input_section::output_section_data,
12223         Output_section::Input_section::relaxed_input_section): New method
12224         definitions.
12225         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12226         value.
12227         (Output_section::Input_section::u1_): Update comments.
12228         (Output_section::Input_section::u2_): Add new union member poris.
12229         (Output_section::Checkpoint_output_section): New classs definition.
12230         (Output_section::relax_input_section): New method declaration.
12231         (Output_section::checkpoint_): New data member.
12232         (Output_segment): Update comments.
12233         (Output_segment::Output_segment): Un-privatize copy constructor.
12234         (Output_segment::operator=): Un-privatize.
12235         * script-sections.cc (Output_section_element::Input_section_list):
12236         Change element type to Output_section::Simple_input_section.
12237         (Output_section_element_dot_assignment::set_section_addresses):
12238         Register output section data for relaxation clean up.
12239         (Output_data_exression::Output_data_expression): Adjust call to base
12240         constructor to fix data size.
12241         (Output_section_element_data::set_section_addresses): Register
12242         Output_data_expression object for relaxation clean up.
12243         (struct Input_section_info): Replace Relobj pointer and section index
12244         pair with Output_section::Simple_input_section and Convert struct to a
12245         class.
12246         (Input_section_sorter::operator()): Adjust access to
12247         Input_section_info data member to use accessors.
12248         (Output_section_element_input::set_section_addresses): Use layout
12249         parameter.  Adjust code to use Output_section::Simple_input_section
12250         and Input_secction_info classes.  Register filler for relaxation
12251         clean up.
12252         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12253         and section index pair with Output_section::Simple_input_section
12254         class.  Adjust code accordingly.
12255         (Phdrs_element::release_segment): New method definition.
12256         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12257         segment list.
12258         (Script_sections::release_segments): New method definition.
12259         * gold/script-sections.h (Script_sections::release_segments): New
12260         method declaration.
12261         * gold/target.h (Target::may_relax, Target::relax,
12262         Target::do_may_relax, Target::do_relax): New method definitions.
12263
12264 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12265
12266         * arm.cc (has_signed_unsigned_overflow): New function.
12267         (Arm_relocate_functions::abs8): New function.
12268         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12269         (Target_arm::Scan::global): Likewise.
12270         (Target_arm::relocate::relocate): Likewise.
12271         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12272         Likewise.
12273
12274 2009-09-16  Cary Coutant  <ccoutant@google.com>
12275
12276         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12277         * testsuite/Makefile.in: Regenerate.
12278
12279 2009-09-11  Nick Clifton  <nickc@redhat.com>
12280
12281         * po/gold.pot: Updated by the Translation project.
12282
12283 2009-09-08  Cary Coutant  <ccoutant@google.com>
12284
12285         * output.cc (Output_file::open): Add execute permission to empty file.
12286         * testsuite/Makefile.am (permission_test): New test.
12287         * testsuite/Makefile.in: Regenerate.
12288
12289 2009-09-02  Ian Lance Taylor  <iant@google.com>
12290
12291         * output.cc (Output_file::resize): Call map_no_anonymous rather
12292         than map.
12293
12294 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12295
12296         * gold.cc: Include "incremental.h".
12297         (queue_initial_tasks): Call Incremental_checker methods.
12298         * incremental.cc: Include "output.h".
12299         (Incremental_checker::can_incrementally_link_output_file): New
12300         method.
12301         * incremental.h (Incremental_checker): New class.
12302
12303         * output.cc (Output_file::open_for_modification): New method.
12304         (Output_file::map_anonymous): Changed return type to bool.  Record
12305         map in base_ field.
12306         (Output_file::map_no_anonymous): New method, broken out of map.
12307         (Output_file::map): Use map_no_anonymous and map_anonymous.
12308         * output.h (class Output_file): Update declarations.
12309
12310 2009-08-24  Cary Coutant  <ccoutant@google.com>
12311
12312         * options.h (Command_line::Pre_options): New class.
12313         (Command_line::pre_options): New member.
12314         * options.cc (gold::options::ready_to_register): New variable.
12315         (One_option::register_option): Do nothing if not registering options.
12316         Assert if same short option registered twice.
12317         (General_options::General_options): Turn off option registration when
12318         done constructing.
12319         (Command_line::Pre_options::Pre_options): New constructor.
12320
12321 2009-08-24  Cary Coutant  <ccoutant@google.com>
12322
12323         * options.h (General_options::no_keep_memory): Remove incorrect
12324         short option.
12325
12326 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12327
12328         * Makefile.am (am__skiplex, am__skipyacc): New.
12329         * Makefile.in: Regenerate.
12330
12331 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12332
12333         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12334         (INCLUDES): ... this.
12335         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12336         (AM_CPPFLAGS): Renamed from ...
12337         (INCLUDE): ... this.
12338         * Makefile.in, testsuite/Makefile.in: Regenerate.
12339
12340         * Makefile.in: Regenerate.
12341         * aclocal.m4: Likewise.
12342         * config.in: Likewise.
12343         * configure: Likewise.
12344         * testsuite/Makefile.in: Likewise.
12345
12346         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12347         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12348         * Makefile.in: Regenerate.
12349         * testsuite/Makefile.in: Regenerate.
12350
12351 2009-08-19  Cary Coutant  <ccoutant@google.com>
12352
12353         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12354         symbols in shared libraries overridden by hidden or internal symbols
12355         in the main program.
12356
12357 2009-08-19  Chris Demetriou  <cgd@google.com>
12358
12359         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12360         checking source file names in error messages.
12361
12362 2009-08-18  Doug Kwan  <dougkwan@google.com>
12363
12364         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12365         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12366         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12367         an elfcpp::Ehdr as parameter.
12368         * object.cc (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.  Adjust call to set_target.
12372         (make_elf_sized_object): Find target and ask target to
12373         make an ELF object.
12374         * object.h: (Object::set_target): Remove the version that looks up
12375         a target and sets it.
12376         (Sized_relobj::setup): Take a Target object instead of
12377         an elfcpp:Ehdr as parameter.
12378         * target.cc: Include dynobj.h.
12379         (Target::do_make_elf_object_implementation): New.
12380         (Target::do_make_elf_object): New.
12381         * target.h (Target::make_elf_object): New template declaration.
12382         (Target::do_make_elf_object): New method declarations.
12383         (Target::do_make_elf_object_implementation): New template declaration.
12384
12385 2009-08-14  Ian Lance Taylor  <iant@google.com>
12386
12387         * gold.h (FUNCTION_NAME): Define.
12388         (gold_unreachable): Use FUNCTION_NAME.
12389
12390 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12391
12392         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12393         symbol in the --keep-unique list is not found.
12394
12395 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12396
12397         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12398         been maked as --keep-unique.
12399         (Icf::unfold_section): New function.
12400         * icf.h (Icf::unfold_section): New function.
12401         * options.h (General_options::keep_unique): New option.
12402         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12403         * testsuite/Makefile.in: Regenerate.
12404         * testsuite/icf_keep_unique_test.sh: New file.
12405         * testsuite/icf_keep_unique_test.cc: New file.
12406
12407 2009-08-12  Cary Coutant  <ccoutant@google.com>
12408
12409         PR 10471
12410         * resolve.cc (Symbol_table::resolve): Check for references from
12411         dynamic objects to hidden and internal symbols.
12412         * testsuite/Makefile.am (hidden_test.sh): New test.
12413         * testsuite/Makefile.in: Regenerate.
12414         * testsuite/hidden_test.sh: New script.
12415         * testsuite/hidden_test_1.c: New test source.
12416         * testsuite/hidden_test_main.c: New test source.
12417
12418 2009-08-11  Doug Kwan  <dougkwan@google.com>
12419
12420         * arm.cc: Update comments.
12421         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12422         segment to locate the .ARM.exidx section if present.
12423
12424 2009-08-09  Doug Kwan  <dougkwan@google.com>
12425
12426         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12427         patch.
12428
12429 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12430         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12431         compiler warnings.
12432
12433 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12434
12435         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12436         valid tls_segment only for non-debug-section relocations.
12437         * testsuite/Makefile.am: Add gc_tls_test.
12438         * testsuite/Makefile.in: Regenerate.
12439         * testsuite/gc_tls_test.cc: New file.
12440         * testsuite/gc_tls_test.sh: New file.
12441
12442 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12443
12444         * icf.cc: New file.
12445         * icf.h: New file.
12446         * Makefile.am (CCFILES): Add icf.cc.
12447         (HFILES): Add icf.h
12448         * Makefile.in: Regenerate.
12449         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12450         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12451         section, symbol and addend information for the relocs.
12452         * gold.cc (queue_middle_tasks): Call identical code folding.
12453         * gold.h: Add defines for multimap.
12454         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12455         to the call of finalize_local_symbols.
12456         * main.cc (main): Create object of class Icf.
12457         * object.cc (Sized_relobj::do_layout): Allow this function to be
12458         called twice during icf.
12459         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12460         to sections marked as identical by icf.
12461         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12462         when available.
12463         (Sized_relobj::do_section_entsize): New function.
12464         * object.h (Object::section_entsize): New function.
12465         (Object::do_section_entsize): New pure virtual function.
12466         (Relobj::finalize_local_symbols): Add new parameter.
12467         (Relobj::do_section_entsize): New function.
12468         * options.h (General_options::icf): New option.
12469         (General_options::icf_iterations): New option.
12470         (General_options::print_icf_sections): New option.
12471         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12472         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12473         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12474         icf.
12475         * symtab.cc (Symbol_table::is_section_folded): New function.
12476         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12477         to sections marked as identical by icf.
12478         * symtab.h (Symbol_table::set_icf): New function.
12479         (Symbol_table::icf): New function.
12480         (Symbol_table::is_section_folded): New function.
12481         (Symbol_table::icf_): New data member.
12482         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12483         * testsuite/Makefile.am: Add commands to build icf_test.
12484         * testsuite/Makefile.in: Regenerate.
12485         * testsuite/icf_test.sh: New file.
12486         * testsuite/icf_test.cc: New file.
12487
12488 2009-07-24  Chris Demetriou  <cgd@google.com>
12489
12490         * layout.cc (is_compressible_debug_section): Fix incorrect
12491         comment about compressed section names.
12492
12493 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12494
12495         PR 10419
12496         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12497
12498 2009-07-16  Ian Lance Taylor  <iant@google.com>
12499
12500         PR 10400
12501         * layout.h: #include <map>.
12502         (class Kept_section): Change from struct to class.  Add accessors
12503         and setters.  Add section size to Comdat_group mapping.  Change
12504         Comdat_group to std::map.  Add is_comdat_ field.  Add
12505         linkonce_size field in union.
12506         (class Layout): Update declaration of find_or_add_kept_section.
12507         Don't declare find_kept_object.
12508         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12509         parameter.  Add object, shndx, is_comdat, and is_group_name
12510         parameters.  Change all callers.  Adjust for new Kept_section.
12511         (Layout::find_kept_object): Remove.
12512         * object.cc (Sized_relobj::include_section_group): Update use of
12513         Kept_section.  Rename secnum to shndx.  Only record
12514         Kept_comdat_section if sections are the same size.
12515         (Sized_relobj::include_linkonce_section): Update use of
12516         Kept_section.  Only record Kept_comdat_section if sections are the
12517         same size.  Set size of linkonce section.
12518         (Sized_relobj::map_to_kept_section): Update call to
12519         get_kept_comdat_section.
12520         * object.h (class Sized_relobj): Rename fields in
12521         Kept_comdat_section to drop trailing underscores; change object
12522         field to Relobj*.  Change Kept_comdat_section_table to store
12523         struct rather than pointer.
12524         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12525         Add kept_object and kept_shndx parameters.  Change all callers.
12526         (Sized_relobj::get_kept_comdat_section): Change return type to
12527         bool.  Add kept_object and kept_shndx parameters.  Change all
12528         callers.
12529         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12530         Layout::find_or_add_kept_section.
12531
12532 2009-07-09  Ian Lance Taylor  <iant@google.com>
12533
12534         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12535         Reserve space in the hash table.
12536
12537 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12538
12539         * fileread.cc (File_read::get_mtime): New method.
12540         * fileread.h (Timespec): New structure.
12541         (File_read::get_mtime): New method.
12542         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12543         Renamed from timestamp_nsec.
12544         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12545         Elf_Xword.
12546         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12547         timestamp_nsec.
12548         (Incremental_inputs::report_archive): Save mtime; style fix.
12549         (Incremental_inputs::report_obejct): Save mtime; style fix.
12550         (Incremental_inputs::report_script): Save mtime; style fix.
12551         (Incremental_inputs::finalize_inputs): Style fix.
12552         (Incremental_inputs::finalize): Style fix.
12553         (Incremental_inputs::create_input_section_data): Store inputs
12554         mtime.
12555         * incremental.h (Incremental_inputs::report_script): Add mtime
12556         argument.
12557         (Incremental_inputs::Input_info::Input_info): Intialize only one
12558         union member.
12559         (Incremental_inputs::Input_info::archive): Move to nameless
12560         union.
12561         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12562         (Incremental_inputs::Input_info::script): Move to nameless union.
12563         (Incremental_inputs::mtime): New field.
12564         * script.cc (read_input_script): Pass file mtime to
12565         Incremental_input.
12566         * script.h (Script_info::inputs): Style fix.
12567
12568 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12569
12570         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12571         instead of 32.
12572
12573 2009-06-24  Ian Lance Taylor  <iant@google.com>
12574
12575         PR 10156
12576         * layout.cc (Layout::choose_output_section): If we find an
12577         existing section, update the flags.
12578         (Layout::create_notes): New function, broken out of
12579         Layout::finalize.
12580         (Layout::finalize): Don't create note sections.
12581         (Layout::create_note): Don't crash if linker script discards
12582         section.
12583         (Layout::create_gold_note): Likewise.
12584         (Layout::create_build_id): Likewise.  Don't set
12585         after_input_sections on the section.
12586         (Layout::create_executable_stack_info): Remove target parameter.
12587         Change caller.
12588         * layout.h (class Layout): Declare create_notes.  Update
12589         declaration of create_executable_stack_info.
12590         * gold.cc (queue_middle_tasks): Call create_notes.
12591         * output.cc (Output_section::update_flags_for_input_section): Move
12592         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12593         invalid.
12594         * output.h (Output_data::mark_address_invalid): New function.
12595         (class Output_section): Only declare, not define,
12596         update_flags_for_input_section.  Remove set_flags.
12597
12598 2009-06-24  Ian Lance Taylor  <iant@google.com>
12599
12600         * script-sections.cc (Output_section_definition::
12601         set_section_addresses): Rename shadowing local load_address to
12602         laddr.
12603
12604 2009-06-24  Ian Lance Taylor  <iant@google.com>
12605
12606         PR 10244
12607         * reloc.cc (relocate_sections): Skip empty relocation sections.
12608
12609 2009-06-23  Ian Lance Taylor  <iant@google.com>
12610
12611         PR 10156
12612         * layout.cc (Layout::create_note): Use choose_output_section
12613         rather than make_output_section.
12614
12615 2009-06-23  Ian Lance Taylor  <iant@google.com>
12616
12617         PR 10237
12618         * options.cc (General_options::parse_V): Set printed_version_.
12619         (General_options::General_options): Initialize printed_version_.
12620         * options.h (class General_options): Add printed_version_ field.
12621         * gold.cc (queue_initial_tasks): If there are no input files,
12622         don't give a fatal error if we printed the version information.
12623         (queue_middle_tasks): If using -r with a shared object, give a
12624         fatal error rather than an ordinary error.
12625
12626 2009-06-23  Ian Lance Taylor  <iant@google.com>
12627
12628         PR 10219
12629         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12630         (Layout::make_output_section): Set have_stabstr_section_ if we see
12631         a .stab*str section.
12632         (Layout::finalize): Call link_stabs_sections.
12633         (Layout::link_stabs_sections): New file.
12634         * layout.h (class Layout): Add have_stabstr_section_ field.
12635         Declare link_stabs_sections.
12636
12637 2009-06-23  Doug Kwan  <dougkwan@google.com>
12638
12639         * Makefile.am (libgold_a_LIBADD): New.
12640         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12641         * Makefile.in: Regenerate.
12642         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12643         * configure: Regenerate.
12644         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12645         * fileread.cc: Include sys/state.h
12646         * gold.h: Declare memmem and strndup if found missing.
12647         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12648
12649 2009-06-23  Ian Lance Taylor  <iant@google.com>
12650
12651         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12652         * configure: Rebuild.
12653
12654 2009-06-23  Ian Lance Taylor  <iant@google.com>
12655
12656         PR 10147
12657         * object.cc (Object::section_contents): Don't try to get a view if
12658         the section has length zero.
12659         (Object::handle_gnu_warning_section): If the section is empty, use
12660         the name of the section as the warning.
12661
12662 2009-06-23  Ian Lance Taylor  <iant@google.com>
12663
12664         PR 10133
12665         * stringpool.h (class Stringpool_template): Add optimize_ field.
12666         (Stringpool_template::set_optimize): New function.
12667         * stringpool.cc (Stringpool_template::Stringpool_template):
12668         Initialize optimize_ field.
12669         (Stringpool_template::set_string_offsets): Test local optimize
12670         fild rather than parameter.
12671         * layout.cc (Layout::Layout): Call set_optimize on the section
12672         name stringpool.
12673
12674 2009-06-22  Ian Lance Taylor  <iant@google.com>
12675
12676         PR 10030
12677         * yyscript.y: Parse TARGET.
12678         * script.cc (script_set_target): New function.
12679         * script-c.h (script_set_target): Declare.
12680         * options.cc (General_options::string_to_object_format): Rename
12681         from string_to_object_format in anonymous namespace.  Change
12682         callers.
12683         * options.h (class General_options): Declare
12684         string_to_object_format.
12685
12686 2009-06-22  Ian Lance Taylor  <iant@google.com>
12687
12688         * script-sections.cc (Script_sections::create_segments): Don't put
12689         program headers in a PT_LOAD segment if -n or -N.
12690
12691 2009-06-22  Ian Lance Taylor  <iant@google.com>
12692
12693         PR 10141
12694         * options.h (class General_options): Add -z lazy and -z now.  Sort
12695         -z options into alphabetical order.
12696         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12697
12698 2009-06-21  Ian Lance Taylor  <iant@google.com>
12699
12700         * layout.cc (Layout::make_output_section): Call
12701         Target::new_output_section.
12702         (Layout::attach_allocated_section_to_segment): Put large section
12703         sections in a separate load segment with the large segment flag
12704         set.
12705         (Layout::segment_precedes): Sort large data segments after other
12706         load segments.
12707         (align_file_offset): New static function.
12708         (Layout::set_segment_offsets): Use align_file_offset.
12709         * output.h (class Output_section): Add is_small_section_ and
12710         is_large_section_ fields.
12711         (Output_section::is_small_section): New function.
12712         (Output_section::set_is_small_section):  New function.
12713         (Output_section::is_large_section): New function.
12714         (Output_section::set_is_large_section): New function.
12715         (Output_section::is_large_data_section): New function.
12716         (class Output_segment): Add is_large_data_segment_ field.
12717         (Output_segment::is_large_data_segment): New function.
12718         (Output_segment::set_is_large_data_segment): New function.
12719         * output.cc (Output_section::Output_section): Initialize new
12720         fields.
12721         (Output_segment::Output_segment): Likewise.
12722         (Output_segment::add_output_section): Add assertion that large
12723         data sections always go in large data segments.  Force small data
12724         sections to the end of the list of data sections.  Force small BSS
12725         sections to the start of the list of BSS sections.  For large BSS
12726         sections to the end of the list of BSS sections.
12727         * symtab.h (class Symbol): Declare is_common_shndx.
12728         (Symbol::is_defined): Check Symbol::is_common_shndx.
12729         (Symbol::is_common): Likewise.
12730         (class Symbol_table): Define enum Commons_section_type.  Update
12731         declarations.  Add small_commons_ and large_commons_ fields.
12732         * symtab.cc (Symbol::is_common_shndx): New function.
12733         (Symbol_table::Symbol_table): Initialize new fields.
12734         (Symbol_table::add_from_object): Put small and large common
12735         symbols in the right list.
12736         (Symbol_table::sized_finalized_symbol): Check
12737         Symbol::is_common_shndx.
12738         (Symbol_table::sized_write_globals): Likewise.
12739         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12740         common symbol lists.  Don't call do_allocate_commons_list if the
12741         list is empty.
12742         (Symbol_table::do_allocate_commons_list): Remove is_tls
12743         parameter.  Add comons_section_type parameter.  Change all
12744         callers.  Handle small and large common symbols.
12745         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12746         Symbol::is_common_shndx.
12747         * resolve.cc (symbol_to_bits): Likewise.
12748         * target.h (Target::small_common_shndx): New function.
12749         (Target::small_common_section_flags): New function.
12750         (Target::large_common_shndx): New function.
12751         (Target::large_common_section_flags): New function.
12752         (Target::new_output_section): New function.
12753         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12754         small_common_section_flags, and large_common_section_flags
12755         fields.
12756         (Target::do_new_output_section): New virtual function.
12757         * arm.cc (Target_arm::arm_info): Initialize new fields.
12758         * i386.cc (Target_i386::i386_info): Likewise.
12759         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12760         Likewise.
12761         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12762         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12763         (Target_x86_64::do_new_output_section): New function.
12764         * configure.ac: Define conditional MCMODEL_MEDIUM.
12765         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12766         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12767         (large_LDFLAGS): Define.
12768         * testsuite/large.c: New file.
12769         * testsuite/testfile.cc (Target_test::test_target_info):
12770         Initialize new fields.
12771         * configure, testsuite/Makefile.in: Rebuild.
12772
12773 2009-06-05  Doug Kwan  <dougkwan@google.com>
12774
12775         * Makefile.am (CCFILES): Add target.cc.
12776         * Makefile.in: Regenerate.
12777         * i386.cc (class Target_i386): Define new virtual method to
12778         override do_is_local_label_name in parent.
12779         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12780         local symbols if --discard-locals or -X is given.
12781         * options.h (class General_options): Declare new options
12782         '--discard-locals' and '-X' for discarding locals.
12783         * target.h (class Target): Define new methods is_local_label_name.
12784         Declare new virtual method do_is_local_label_name.
12785         * target.cc: New file.
12786         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12787         (check_SCRIPTS): Add discard_locals_test.sh.
12788         (check_DATA): Add discard_local_tests.syms.
12789         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12790         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12791         * testsuite/Makefile.in: Regenerate.
12792         * testsuite/discard_locals_test.c: New file.
12793         * testsuite/discard_locals_test.sh: Same.
12794
12795 2009-06-05  Doug Kwan  <dougkwan@google.com>
12796
12797         * object.cc (Sized_relobj::Sized_relobj): Initialize
12798         discarded_eh_frame_shndx_ to -1U.
12799         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12800         section.
12801         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12802         a discarded .eh_frame section.
12803         (Sized_relobj::do_finalize_local_symbols): Ditto.
12804         * object.h (class Sized_relobj): Declare new member
12805         discarded_eh_frame_shndx_.
12806         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12807         (local_labels_test.o, local_labels_test): New rules.
12808         * testsuite/Makefile.in: Regenerate.
12809
12810 2009-06-04  Doug Kwan  <dougkwan@google.com>
12811
12812         * layout.cc (Layout::section_name_mapping): Add mapping for
12813         special ARM sections.
12814
12815 2009-06-03  Doug Kwan  <dougkwan@google.com>
12816
12817         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12818         (utils::has_overflow): Same.
12819
12820 2009-06-03  Ian Lance Taylor  <iant@google.com>
12821
12822         * layout.cc (Layout::section_name_mapping): New array, replacing
12823         Layout::linkonce_mapping.
12824         (Layout::section_name_mapping_count): New variable, replacing
12825         Layout::linkonce_mapping_count.
12826         (Layout::linkonce_output_name): Remove.
12827         (Layout::output_section_name): Rewrite.
12828         * layout.h (class Layout): Rename Linkonce_mapping to
12829         Section_name_mapping, linkonce_mapping to section_name_mapping,
12830         linkonce_mapping_count to section_name_mapping_count.  Don't
12831         declare linkonce_output_name.
12832
12833 2009-06-03  Doug Kwan  <dougkwan@google.com>
12834
12835         * gold/arm.cc (namespace utils): New.
12836         (Target_arm::reloc_is_non_pic): Define new method.
12837         (class Arm_relocate_functions): New.
12838         (Target_arm::Relocate::relocate): Handle relocation types used by
12839         Android.
12840
12841 2009-06-03  Ian Lance Taylor  <iant@google.com>
12842
12843         * arm.cc (Target_arm::scan::global): Use || instead of |.
12844
12845 2009-06-02  Doug Kwan  <dougkwan@google.com>
12846
12847         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12848         issued_non_pic_error_.
12849         (class Target_arm::Scan): Declare new method check_non_pic.
12850         Define new method symbol_needs_plt_entry.
12851         Declare new data member issued_non_pic_error_.
12852         (class Target_arm::Relocate): Declare new method
12853         should_apply_static_reloc.
12854         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12855         (Target_arm::Scan::check_non_pic): Define new method.
12856         (Target_arm::Scan::local): Handle a small subset of reloc types used
12857         by Android.
12858         (Target_arm::Scan::local): Same.
12859         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12860
12861 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12862
12863         * incremental.cc (Incremental_inputs::report_command_line): Filter
12864         out --incremental-* options.
12865
12866 2009-05-29  Doug Kwan  <dougkwan@google.com>
12867
12868         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12869         template class.
12870         (class Target_arm): Update comment.
12871         (Target_arm::Target_arm): Initialize new data members GOT_,
12872         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12873         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12874         and Target_arm::rel_dyn_section.
12875         Declare new_enum Target_arm::Got_type.
12876         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12877         and DYNBSS_.
12878         Update commments for member do_dynsym_value.
12879         (Target_arm::got_size, Target_arm::plt_section,
12880         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12881         new methods inside class defintion.
12882         (Target_arm::got_section): Define new method.
12883         (Target_arm::rel_dyn_section): Same.
12884         (Output_data_plt_arm): New template class.
12885         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12886         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12887         (Output_data_plt_arm::add_entry): Same.
12888         (Output_data_plt_arm::first_plt_entry): Define new
12889         static data member for PLT instruction template.
12890         (Output_data_plt_arm::plt_entry): Same.
12891         (Output_data_plt_arm::do_write): Define new method.
12892         (Target_arm::make_plt_entry): Same.
12893         (Target_arm::do_finalize_sections): Same.
12894         (Target_arm::do_dynsym_value): Same.
12895
12896 2009-05-28  Doug Kwan  <dougkwan@google.com>
12897
12898         * Makefile.am (TARGETSOURCES): Add arm.cc.
12899         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12900         * Makefile.in: Regenerate.
12901         * arm.cc: New file.
12902         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12903
12904 2009-05-26  Doug Kwan  <dougkwan@google.com>
12905
12906         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12907         (General_options::check_excluded_libs): Strip off directories in
12908         archive name before matching like GNU ld does.
12909         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12910         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12911         (exclude_libs_test_LDFLAGS): Add linker option
12912         -Wl,--exclude-libs,libexclude_libs_test_3
12913         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12914         an explicit archive without using -l.
12915         (alt/libexclude_libs_test_3.a): New make rule.
12916         * testsuite/Makefile.in: Regenerate.
12917         * testsuite/exclude_libs_test.c : Declare lib3_default().
12918         (main): Call it.
12919         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12920         * exclude_libs_test_3.c: New file.
12921
12922 2009-05-26  Nick Clifton  <nickc@redhat.com>
12923
12924         * po/id.po: New Indonesian translation.
12925         * po/gold.pot: Updated template file.
12926
12927 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12928
12929         * testsuite/Makefile.am: Add -ffunction-sections to compile
12930         gc_comdat_test files.  Add -Wl,--gc-sections to build
12931         gc_comdat_test.
12932         * testsuite/Makefile.in: Regenerate.
12933         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12934
12935 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12936
12937         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12938         kept comdat section was garbage collected.
12939         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12940         * testsuite/Makefile.in: Regenerate.
12941         * testsuite/gc_comdat_test.sh: New file.
12942         * testsuite/gc_comdat_test_1.cc: New file.
12943         * testsuite/gc_comdat_test_2.cc: New file.
12944
12945 2009-05-19  Doug Kwan  <dougkwan@google.com>
12946
12947         * archive.cc (Archive::Archive): Move constructor from archive.h
12948         to here.  Initialize no_export_.
12949         (Archive::get_elf_object_for_member): Set no_export flag of object.
12950         * archive.h (Archive::Archive): Move constructor body to
12951         archive.cc.
12952         (Archive::no_export): New method.
12953         (Archive::no_export_): New field.
12954         * object.h (Object::Object): Initialize no_export_ to false.
12955         (Object::no_export, Object::set_no_export): New methods.
12956         (Object::no_export_): New field.
12957         * options.cc (General_options::parse_exclude_libs): New method.
12958         (General_options::check_excluded_libs) Same.
12959         * options.h (exclude_libs): New option.
12960         (General_options::check_excluded_libs): New method declaration.
12961         (General_options::excluded_libs_): New field.
12962         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12963         default or protected visibility if an object has no-export flag set.
12964         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12965         (check_SCRIPTS): Add exclude_libs_test.sh.
12966         (check_DATA): Add exclude_libs_test.syms.
12967         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12968         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12969         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12970         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12971         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12972         libexclude_libs_test_2.a): New rules.
12973         * testsuite/Makefile.in: Regenerate.
12974         * testsuite/exclude_libs_test.c: New file.
12975         * testsuite/exclude_libs_test.sh: Ditto.
12976         * testsuite/exclude_libs_test_1.c: Ditto.
12977         * testsuite/exclude_libs_test_2.c: Ditto.
12978
12979 2009-05-15  Ian Lance Taylor  <iant@google.com>
12980
12981         * configure.ac: Check for declarations for cases where libiberty.h
12982         checks HAVE_DECL_xxx.
12983         * configure, config.in: Rebuild.
12984
12985 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12986
12987         * gold.h (Incremental_argument_list): Remove (invalid) forward
12988         declaration.
12989         * incremental.cc (Incremental_inputs::report_achive): New method.
12990         (Incremental_inputs::report_object): New method.
12991         (Incremental_inputs::report_script): New method.
12992         (Incremental_inputs::finalize_inputs): New method.
12993         (Incremental_inputs::finalize): Call finalize_inputs().
12994         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12995         Create inputs entries.
12996         * incremental.h (Incremental_input_type): New enum.
12997         (Incremental_inputs::Incremental_input): Initialize new fields.
12998         (Incremental_inputs::report_inputs): New method.
12999         (Incremental_inputs::report_achive): New method.
13000         (Incremental_inputs::report_object): New method.
13001         (Incremental_inputs::report_script): New method.
13002         (Incremental_inputs::finalize_inputs): New method.
13003         (Incremental_inputs::Input_info): New struct.
13004         (Incremental_inputs::Input_info_map): New typedef.
13005         (Incremental_inputs::lock_): New field.
13006         (Incremental_inputs::Inputs_): New field.
13007         (Incremental_inputs::Inputs_map): New field.
13008         * main.cc (main): Call Incremental_input::report_inputs.
13009         * options.h (Input_argument_list): Typedef moved from
13010         Input_arguments.
13011         (Input_file_group::Files): Remove, use ::Input_argument_list.
13012         (Input_file_group::Input_argument_list): Remove, use
13013         ::Input_argument_list.
13014         * plugin.cc (Plugin_manager::add_input_file): Add error in
13015         incremental build.
13016         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13017         functions.
13018         * script.cc (read_input_script): Call
13019         Incremental_input::report_script.
13020         * script.h (Script_info): New class.
13021
13022 2009-04-27  Ian Lance Taylor  <iant@google.com>
13023
13024         * x86_64.cc (do_adjust_output_section): Set entsize to
13025         plt_entry_size.
13026
13027 2009-04-23  Elliott Hughes  <enh@google.com>
13028
13029         * output.cc (Output_file::close): After short writes, continue
13030         writing from the correct offset in the buffer being written.
13031
13032 2009-04-23  Chris Demetriou  <cgd@google.com>
13033
13034         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13035         * configure: Regenerate.
13036         * config.in: Regenerate.
13037         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13038         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13039
13040 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13041
13042         * incremental.cc (Incremental_inputs_header_data): Renamed from
13043         Incremental_input_header_data.
13044         (Incremental_inputs_header_data::data_size): New field.
13045         (Incremental_inputs_header_data::put_input_file_count): Renamed
13046         from input_file_count.
13047         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13048         from command_line_offset.
13049         (Incremental_inputs_header_data::put_reserved): Renamed from
13050         put_reserved.
13051         (Incremental_inputs_entry_data): Renamed from
13052         Incremental_input_entry_data.
13053         (Incremental_inputs_entry_data::data_size): New field.
13054         (Incremental_inputs::report_command_line): New method.
13055         (Incremental_inputs::finalize): New method.
13056         (Incremental_inputs::create_incremental_inputs_data): New method.
13057         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13058         * incremental.h: New file.
13059         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13060         (Layout::finalize): Create incremental inputs section in
13061         incremental builds.
13062         (Layout::create_incremental_info_sections): New method.
13063         * layout.h (Layout::incremental_inputs): New method.
13064         (Layout::create_incremental_info_sections): New method.
13065         (Layout::incremental_inputs_): New field.
13066         * main.cc (main): Notify Incremental_input of the command line.
13067
13068 2009-04-01  Ian Lance Taylor  <iant@google.com>
13069             Mikolaj Zalewski  <mikolajz@google.com>
13070
13071         * gold.h (reserve_unordered_map): Define, three versions, one for
13072         each version of Unordered_map.
13073         * layout.cc (Layout::Layout): Remove options parameter.  Add
13074         number_of_input_files parameter.  Don't initialize options_.
13075         Initialize number_of_input_files_ and resized_signatures_.  Move
13076         sections_are_attached_.
13077         (Layout::layout_group): Reserve space for group_signatures_.
13078         (Layout::find_or_add_kept_section): Change name parameter to be a
13079         reference.  Resize signatures_ map when it gets large enough.
13080         (Layout::layout_eh_frame): Use parameters->options() instead of
13081         this->options_.
13082         (Layout::make_output_section): Likewise.
13083         (Layout::attach_allocated_section_to_segment): Likewise.
13084         (Layout::finalize, Layout::create_executable_stack): Likewise.
13085         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13086         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13087         * layout.h (class Layout): Update declarations.  Remove options_
13088         field.  Add number_of_input_files_ and resized_signatures_
13089         fields.  Move sections_are_attached_ field.
13090         * main.cc (main): Pass number of input files to Layout
13091         constructor.  Don't pass options.
13092
13093 2009-03-30  Ian Lance Taylor  <iant@google.com>
13094
13095         * ffsll.c (ffsll): Correct implementation.
13096
13097 2009-03-27  Ian Lance Taylor  <iant@google.com>
13098
13099         * ffsll.c: New file.
13100         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13101         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13102         * ftruncate.c (ftruncate): Declare before definition.
13103         * mremap.c (mremap): Likewise.
13104         * pread.c (pread): Likewise.
13105         * configure, Makefile.in, config.in: Rebuild.
13106
13107         * mremap.c: New file.
13108         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13109         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13110         (mremap): Declare if HAVE_MREMAP is not defined.
13111         * configure, Makefile.in, config.in: Rebuild.
13112
13113 2009-03-27  Cary Coutant  <ccoutant@google.com>
13114
13115         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13116         position independent.
13117         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13118         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13119
13120 2009-03-24  Cary Coutant  <ccoutant@google.com>
13121
13122         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13123         an executable.
13124         (needs_dynamic_reloc): Likewise.
13125
13126 2009-03-24  Ian Lance Taylor  <iant@google.com>
13127
13128         * yyscript.y (file_cmd): Recognize EXTERN.
13129         (extern_name_list, extern_name_list_body): New nonterminals.
13130         * script.cc (script_add_extern): Define.
13131         * script-c.h (script_add_extern): Declare.
13132
13133 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13134
13135         * object.cc (is_elf_object): Define.
13136         * object.h (is_elf_object): Declare.
13137         * archive.cc (Archive::get_elf_object_for_member): Call
13138         is_elf_object.
13139         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13140
13141 2009-03-24  Elliott Hughes  <enh@google.com>
13142
13143         * output.cc (Output_file::map_anonymous): Define.
13144         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13145         try an anonymous one.  Report the size if the mmap fails.
13146         * output.h (class Output_file): Declare map_anonymous.
13147
13148 2009-03-24  Ian Lance Taylor  <iant@google.com>
13149
13150         * target-select.cc (instantiate_target): Don't acquire the lock if
13151         the instantiated_target_ field has already been set.
13152
13153 2009-03-23  Ian Lance Taylor  <iant@google.com>
13154
13155         * gold-threads.h (class Initialize_lock): Define.
13156         * gold-threads.cc (class Initialize_lock_once): Define.
13157         (initialize_lock_control): New static variable.
13158         (initialize_lock_pointer): New static variable.
13159         (initialize_lock_once): New static function.
13160         (Initialize_lock::Initialize_lock): Define.
13161         (Initialize_lock::initialize): Define.
13162         * target-select.h: Include "gold-threads.h".
13163         (class Target_selector): Add lock_ and initialize_lock_ fields.
13164         Don't define instantiate_target, just declare it.
13165         * target-select.cc (Target_selector::Target_selector): Initialize
13166         new fields.
13167         (Target_selector::instantiate_target): Define.
13168         * descriptors.h: Include "gold-threads.h".
13169         (class Descriptors): Add initialize_lock_ field.
13170         * descriptors.cc (Descriptors::Descriptors): Initialize new
13171         field.
13172         (Descriptors::open): Use initialize_lock_ field
13173         * errors.h (class Errors): Add initialize_lock_ field.
13174         * errors.cc (Errors::Errors): Initialize new field.
13175         (Errors::initialize_lock): Use initialize_lock_ field.
13176         * powerpc.cc (class Target_selector_powerpc): Remove
13177         instantiated_target_ field.  In do_recognize call
13178         instantiate_target rather than do_instantiate_target.  In
13179         do_instantiate_target just allocate a new target.
13180         * sparc.cc (class Target_selector_sparc): Likewise.
13181
13182         * freebsd.h: New file.
13183         * i386.cc: Include "freebsd.h".
13184         (Target_i386): Derive from Target_freebsd rather than
13185         Sized_target.
13186         (Target_selector_i386): Derive from Target_selector_freebsd rather
13187         than Target_selector.
13188         * x86_64.cc: Include "freebsd.h".
13189         (Target_x86_64): Derive from Target_freebsd rather than
13190         Sized_target.
13191         (Target_selector_x86_64): Derive from Target_selector_freebsd
13192         rather than Target_selector.
13193         * target.h (class Target): Add adjust_elf_header and
13194         do_adjust_elf_header.
13195         * output.cc (Output_file_header:: do_sized_write): Call target
13196         adjust_elf_header routine.
13197         * configure.tgt: Set targ_osabi.
13198         * configure.ac: Define GOLD_DEFAULT_OSABI.
13199         * parameters.cc (Parameters::default_target): Pass
13200         GOLD_DEFAULT_OSABI to select_target.
13201         * target-select.h (class Target_selector): Make instantiate_target
13202         protected rather than private.
13203         * Makefile.am (HFILES): Add freebsd.h.
13204         * configure, Makefile.in, config.in: Rebuild.
13205
13206         * merge.cc (do_add_input_section): Correct pend value.  Change
13207         message about last entry not being null terminated from error to
13208         warning.
13209
13210 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13211
13212         * incremental.cc: New file.
13213         * Makefile.am (CCFILES): Add incremental.cc.
13214         * Makefile.in: Rebuild.
13215
13216 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13217
13218         * layout.cc (Layout::output_section_name): Preserve names
13219         of '.note.' sections.
13220
13221 2009-03-19  Ian Lance Taylor  <iant@google.com>
13222
13223         * descriptors.cc (Descriptors::open): Check that the options are
13224         valid before using them.
13225
13226 2009-03-18  Ian Lance Taylor  <iant@google.com>
13227
13228         * script-sections.h: Include <list>.
13229         (class Script_sections): Change Sections_elements from std::vector
13230         to std::list.  Typedef public Elements_iterator.  Add
13231         orphan_section_placement_, data_segment_align_start_, and
13232         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13233         field.
13234         * script-sections.cc (class Orphan_section_placement): New class.
13235         (class Sections_element): Add virtual functions is_relro and
13236         orphan_section_init.  Remove virtual function place_orphan_here.
13237         (class Output_section_definition): Add is_relro and
13238         orphan_section_init.  Remove place_orphan_here.
13239         (class Orphan_output_section): Likewise.
13240         (Script_sections::Script_sections): Update for field changes.
13241         (Script_sections::data_segment_align): Set saw_data_segment_align_
13242         and data_segment_align_start_, not data_segment_align_index.
13243         (Script_sections::data_segment_relro_end): Check
13244         saw_data_segment_align_.  Use data_segment_align_start_ rather
13245         than data_segment_align_index_.
13246         (Script_sections::place_orphan): Rewrite to use
13247         Orphan_section_placement.
13248
13249 2009-03-17  Ian Lance Taylor  <iant@google.com>
13250
13251         * archive.cc (Archive::add_symbols): Check for a version attached
13252         to the symbol name in the archive map.
13253         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13254         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13255         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13256         (ver_test_11.a): New target.
13257         * testsuite/Makefile.in: Rebuild.
13258
13259         * configure.ac: Check for chsize and posix_fallocate.  Replace
13260         ftruncate.
13261         * ftruncate.c: New file, from gnulib.
13262         * output.cc (posix_fallocate): Define dummy version if not
13263         HAVE_POSIX_FALLOCATE.
13264         (Output_file::map): Call posix_fallocate rather than lseek and
13265         write.
13266         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13267         * configure, Makefile.in, config.in: Rebuild.
13268
13269 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13270
13271         * layout.h (Layout::create_note): Add section_name parameter.
13272         * layout.cc (Layout::create_note): Likewise.
13273         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13274
13275 2009-03-17  Ian Lance Taylor  <iant@google.com>
13276
13277         * descriptors.cc: Include "options.h".
13278         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13279         (Descriptors::open): Always use O_CLOEXEC when opening a new
13280         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13281         then set FD_CLOEXEC.
13282
13283         * sparc.cc (class Target_sparc): Add has_got_section.
13284         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13285         make sure we have a GOT section.
13286
13287         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13288         (Target_sparc::Scan::local): Likewise.
13289         (Target_sparc::Scan::global): Likewise.
13290         (Target_sparc::Relocate::relocate): Likewise.
13291         (Target_sparc::Relocate::relocate_tls): Likewise.
13292
13293         * symtab.cc (Symbol_table::define_default_version): New function,
13294         broken out of add_from_object.
13295         (Symbol_table::add_from_object): Call define_default_version.
13296         (Symbol_table::define_special_symbol): Add resolve_oldsym
13297         parameter.  Change all callers.  If the version for a symbol comes
13298         from a version script, resolve it with the symbol with the same
13299         name with no version.  Also add the symbol without a version if
13300         appropriate.
13301         (do_define_in_output_data): If resolving with oldsym, don't delete
13302         sym.
13303         (do_define_in_output_segment): Likewise.
13304         (do_define_as_constant): Likewise.
13305         * symtab.h (class Symbol_table): Update declarations.
13306
13307 2009-03-13  Ian Lance Taylor  <iant@google.com>
13308
13309         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13310         (Read_symbols::requeue): New function.
13311         (Read_symbols::do_read_symbols): If make_elf_object fails because
13312         the target type is not configured, and the file was searched for,
13313         issue a warning and retry with the next directory.
13314         (Add_symbols::run): If the file has an incompatible format, and
13315         it was searched for, requeue the Read_symbols task.  On error,
13316         release the object.
13317         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13318         dirindex parameter to constructor.  Change all callers.  Declare
13319         incompatible_warning and requeue.
13320         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13321         input_argument_ and input_group_ fields.  Add them to
13322         constructor.  Change all callers.
13323         (class Read_script): Add dirindex_ field.  Add it to constructor.
13324         Change all callers.
13325         * archive.cc (Archive::setup): Remove input_objects parameter.
13326         Change all callers.
13327         (Archive::get_file_and_offset): Likewise.
13328         (Archive::read_all_symbols): Likewise.
13329         (Archive::read_symbols): Likewise.
13330         (Archive::get_elf_object_for_member): Remove input_objects
13331         parameter.  Add punconfigured parameter.  Change all callers.
13332         (Archive::add_symbols): Change return type to bool.  Check return
13333         value of include_member.
13334         (Archive::include_all_members): Likewise.
13335         (Archive::include_member): Change return type to bool.  Return
13336         false if first included object has incompatible target.  Set
13337         included_member_ field.
13338         (Add_archive_symbols::run): If add_symbols returns false, requeue
13339         Read_symbols task.
13340         * archive.h (class Archive): Add included_member_ field.
13341         Initialize it in constructor.  Add input_file and searched_for
13342         methods.  Update declarations.
13343         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13344         input_argument_ fields.  Add them to constructor.  Change all
13345         callers.
13346         * script.cc: Include "target-select.h".
13347         (class Parser_closure): Add skip_on_incompatible_target_ and
13348         found_incompatible_target_ fields.  Add
13349         skip_on_incompatible_target parameter to constructor.  Change all
13350         callers.  Add methods skip_on_incompatible_target,
13351         clear_skip_on_incompatible_target, found_incompatible_target, and
13352         set_found_incompatible_target.
13353         (read_input_script): Add dirindex parameter.  Change all callers.
13354         If parser finds an incompatible target, requeue Read_symbols
13355         task.
13356         (script_set_symbol): Clear skip_on_incompatible_target in
13357         closure.
13358         (script_add_assertion, script_parse_option): Likewise.
13359         (script_start_sections, script_add_phdr): Likewise.
13360         (script_check_output_format): New function.
13361         * script.h (read_input_script): Update declaration.
13362         * script-c.h (script_check_output_format): Declare.
13363         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13364         (ignore_cmd): Remove OUTPUT_FORMAT.
13365         * fileread.cc (Input_file::Input_file): Add explicit this.
13366         (Input_file::will_search_for): New function.
13367         (Input_file::open): Add pindex parameter.  Change all callers.
13368         * fileread.h (class Input_file): Add input_file_argument method.
13369         Declare will_search_for.  Update declarations.
13370         * object.cc (make_elf_object): Add punconfigured parameter.
13371         Change all callers.
13372         * object.h (class Object): Make input_file public.  Add
13373         searched_for method.
13374         (make_elf_object): Update declaration.
13375         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13376         restart search.
13377         * dirsearch.h (class Dirsearch): Update declaration.
13378         * options.h (class General_options): Add --warn-search-mismatch.
13379         * parameters.cc (Parameters::is_compatible_target): New function.
13380         * parameters.h (class Parameters): Declare is_compatible_target.
13381         * workqueue.cc (Workqueue::add_blocker): New function.
13382         * workqueue.h (class Workqueue): Declare add_blocker.
13383
13384         * fileread.cc (Input_file::open): Remove options parameter.
13385         Change all callers.
13386         (Input_file::open_binary): Likewise.
13387         * script.cc (read_input_script): Likewise.
13388         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13389         options parameter from constructor.  Change all callers.
13390         (class Read_script): Likewise.
13391         * fileread.h (class Input_file): Update declarations.
13392         * script.h (read_input_script): Update declaration.
13393
13394 2009-03-10  Nick Clifton  <nickc@redhat.com>
13395
13396         * po/es.po: New Spanish translation.
13397
13398 2009-03-06  Cary Coutant  <ccoutant@google.com>
13399
13400         * options.cc (parse_short_option): Keep dash_z from registering itself.
13401
13402 2009-03-03  Ian Lance Taylor  <iant@google.com>
13403
13404         PR 9918
13405         * target-reloc.h (relocate_section): Pass output_section to
13406         relocate.
13407         * i386.cc (Target_i386::should_apply_static_reloc): Add
13408         output_section parameter.  Change all callers.
13409         (Target_i386::Relocate::relocate): Add output_section parameter.
13410         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13411         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13412         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13413         * testsuite/two_file_shared.sh: New script.
13414         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13415         (check_DATA): Add two_file_shared.dbg.
13416         (two_file_shared.dbg): New target.
13417         * testsuite/Makefile.in: Rebuild.
13418
13419 2009-03-01  Ian Lance Taylor  <iant@google.com>
13420
13421         * configure.ac: Check for byteswap.h.
13422         * configure: Rebuild.
13423         * config.in: Rebuild.
13424
13425 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13426
13427         * layout.cc (Layout::find_or_add_kept_section): New function.
13428         (Layout::add_comdat): Removed.
13429         * layout.h (struct Kept_section): Move out of class Layout.
13430         Remove trailing underscores from field names.  Add group_sections
13431         field.  Rename group_ field to is_group.  Change all uses.
13432         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13433         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13434         comdat_groups_ field.
13435         (Sized_relobj::include_section_group): Use
13436         find_or_add_kept_section and Kept_section::group_sections.
13437         (Sized_relobj::include_linkonce_section): Likewise.
13438         * object.cc (class Sized_relobj): Don't define Comdat_group or
13439         Comdat_group_table.  Remove find_comdat_group and
13440         add_comdat_group.  Remove comdat_groups_ field.
13441         * plugin.cc (include_comdat_group): Use
13442         Layout::find_or_add_kept_section.
13443
13444 2009-02-28  Ian Lance Taylor  <iant@google.com>
13445
13446         * README: --gc-sections and map files are now supported.  Document
13447         some build requirements.
13448
13449         PR 6992
13450         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13451         relocatable link set the value of the section symbol to zero.
13452         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13453         relocatable link don't include the section address in the local
13454         symbol value.
13455
13456 2009-02-27  Ian Lance Taylor  <iant@google.com>
13457
13458         PR 6811
13459         * options.h (class Search_directory): Add is_system_directory.
13460         (class General_options): Declare is_in_system_directory.
13461         * options.cc (get_relative_sysroot): Make static.
13462         (get_default_sysroot): Make static.
13463         (General_optoins::is_in_system_directory): New function.
13464         * fileread.cc (Input_file::is_in_system_directory): New function.
13465         * fileread.h (class Input_file): Declare is_in_system_directory.
13466         * object.h (class Object): Add is_in_system_directory.
13467         (class Input_objects): Remove system_library_directory_ field.
13468         * object.cc (Input_objects::add_object): Don't set
13469         system_library_directory_.
13470         (input_objects::found_in_system_library_directory): Remove.
13471         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13472         parameter.  Change all callers.
13473         (Symbol_table::sized_write_globals): Likewise.
13474         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13475         Call Object::is_in_system_directory.
13476         * symtab.h (class Symbol_table): Update declarations.
13477
13478         PR 5990
13479         * descriptors.h (Open_descriptor): Add is_on_stack field.
13480         * descriptors.cc (Descriptors::open): If the descriptor is on the
13481         top of the stack, remove it.  Initialize is_on_stack field.
13482         (Descriptors::release): Only add pod to stack if it is not on the
13483         stack already.
13484         (Descriptors::close_some_descriptor): Clear stack_next and
13485         is_on_stack fields.
13486
13487         PR 7091
13488         * output.cc (Output_section::find_starting_output_address): Rename
13489         from starting_output_address; add PADDR parameter; change return
13490         type.
13491         * output.h (class Output_section): Declare
13492         find_starting_output_address instead of starting_output_address.
13493         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13494         section symbol for which we can't find a merge section.
13495
13496         PR 9836
13497         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13498         hidden or internal, force the symbol to be local.
13499         * resolve.cc (Symbol::override_visibility): Define.
13500         (Symbol::override_base): Use override_visibility.
13501         (Symbol_table::resolve): Likewise.
13502         (Symbol::override_base_with_special): Likewise.
13503         (Symbol_table::override_with_special): If the visibility is hidden
13504         or internal, force the symbol to be local.
13505         * symtab.h (class Symbol): Add set_visibility and
13506         override_visibility.
13507         * testsuite/ver_test_1.sh: New file.
13508         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13509         (check_DATA): Add ver_test_1.syms.
13510         (ver_test_1.syms): New target.
13511         * testsuite/Makefile.in: Rebuild.
13512
13513 2009-02-25  Cary Coutant  <ccoutant@google.com>
13514
13515         * layout.cc (Layout::choose_output_section): Don't rename sections
13516         when using a linker script that has a SECTIONS clause.
13517         * Makefile.in: Regenerate.
13518
13519         * testsuite/Makefile.am (script_test_5.sh): New test case.
13520         * testsuite/Makefile.in: Regenerate.
13521         * testsuite/script_test_5.cc: New file.
13522         * testsuite/script_test_5.sh: New file.
13523         * testsuite/script_test_5.t: New file.
13524
13525 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13526
13527         * archive.cc (Archive::include_member): Update calls to add_symbols.
13528         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13529         the Layout argument.
13530         * dynobj.h (do_add_symbols): Add the Layout argument.
13531         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13532         Layout argument.
13533         * object.h (Object::add_symbols): Add the Layout argument.
13534         (Object::do_add_symbols): Add the Layout argument.
13535         (Sized_relobj::do_add_symbols): Add the Layout argument.
13536         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13537         Unify the two versions.
13538         (Add_plugin_symbols): Remove.
13539         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13540         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13541         (Add_plugin_symbols): Remove.
13542         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13543         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13544         (Add_symbols::run): Make it work with Pulginobj.
13545
13546 2009-02-06  Ian Lance Taylor  <iant@google.com>
13547
13548         * object.cc (Sized_relobj::do_layout): Make info message start
13549         with lower case letter.
13550
13551 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13552
13553         * binary.cc: Fix file comment.
13554
13555         * options.h (enum Incremental_disposition): Define.
13556         (class General_options): Add new options: --incremental,
13557         --incremental_changed, --incremental_unchanged,
13558         --incremental_unknown.  Add incremental_disposition_ and
13559         implicit_incremental_ fields.
13560         (General_options::incremental_disposition): New function.
13561         (class Position_dependent_options): Add incremental_disposition
13562         option.
13563         (Position_dependent_options::copy_from_options): Set incremental
13564         dispositions.
13565         * options.cc (General_options::parse_incremental_changed): New
13566         function.
13567         (General_options::parse_incremental_unchanged): New function.
13568         (General_options::parse_incremental_unknown): New function.
13569         (General_options::General_options): Initialize new fields
13570         incremental_disposition_ and implicit_incremental_.
13571         (General_options::finalize): Check for uasge of --incremental-*
13572         without --incremental.
13573
13574 2009-02-06  Chris Demetriou  <cgd@google.com>
13575
13576         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13577         pointer and to report location as the file name associated with
13578         the symbol.
13579         (gold_undefined_symbol_at_location): New function to replace the
13580         old gold_undefined_symbol functionality.
13581         * target-reloc.h (relocate_section): Update to use
13582         gold_undefined_symbol_at_location.
13583         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13584         Call gold_undefined_symbol function rather than gold_error.
13585         * errors.h (Errors::undefined_symbol): Take location as a
13586         string, rather than calculating it from a relocation.
13587         * errors.cc (Errors::fatal): Print "fatal error:" before the
13588         formatted message.
13589         (Errors::error, Errors::error_at_location): Print "error: "
13590         before the formatted message.
13591         (Errors::undefined_symbol): Take location as a string, rather
13592         than calculating it from a relocation.
13593         (gold_undefined_symbol_at_location): New function akin to
13594         old gold_undefined_symbol, calculates location from relocation.
13595         (gold_undefined_symbol): Change to take only a Symbol pointer
13596         and to report location as the file name associated with the symbol.
13597         * testsuite/debug_msg.sh: Update for changed error messages.
13598         * testsuite/undef_symbol.sh: Likewise.
13599
13600 2009-02-04  Duncan Sands  <baldrick@free.fr>
13601
13602         PR 9812
13603         * reduced_debug_output.h
13604         (Output_reduced_debug_abbrev_section::failed): Use format for
13605         gold_warning.
13606         (Output_reduced_debug_info_section::faild): Likewise.
13607
13608 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13609
13610         * script.cc (Lazy_demangler): New class.
13611         (Version_script_info::get_symbol_version_helper): Demangle a
13612         symbol only once.
13613
13614 2009-01-29  Cary Coutant  <ccoutant@google.com>
13615
13616         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13617         to __tls_get_addr.
13618         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13619
13620 2009-01-28  Ian Lance Taylor  <iant@google.com>
13621
13622         * version.cc (version_string): Bump to 1.9.
13623
13624         * gold.h: Include <cstring> and <stdint.h>.
13625         * version.cc: Include <cstdio>.
13626         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13627         warning.
13628         * reduced_debug_output.cc (insert_into_vector): Rename from
13629         Insert_into_vector; change all callers.  Use Swap_unaligned to
13630         avoid aliasing issue; remove union since it is unnecessary.
13631
13632 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13633
13634         * Makefile.am (CCFILES): Add gc.cc.
13635         (HFILES): Add gc.h.
13636         * Makefile.in: Regenerate.
13637         * gold.cc (Gc_runner): New class.
13638         (queue_initial_tasks): Call garbage collection related tasks
13639         when corresponding options are invoked.
13640         (queue_middle_gc_tasks): New function.
13641         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13642         processed early before laying out sections during garbage collection.
13643         * gold.h (queue_middle_gc_tasks): New function.
13644         (is_prefix_of): Move from "layout.cc".
13645         * i386.cc (Target_i386::gc_process_relocs): New function.
13646         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13647         * main.cc (main): Create object of class "Garbage_collection".
13648         * object.cc (Relobj::copy_symbols_data): New function.
13649         (Relobj::is_section_name_included): New function.
13650         (Sized_relobj::do_layout): Allow this function to be called twice
13651         during garbage collection and defer layout of section during the
13652         first call.
13653         * object.h (Relobj::get_symbols_data): New function.
13654         (Relobj::is_section_name_included): New function.
13655         (Relobj::copy_symbols_data): New function.
13656         (Relobj::set_symbols_data): New function.
13657         (Relobj::get_relocs_data): New function.
13658         (Relobj::set_relocs_data): New function.
13659         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13660         (Relobj::gc_process_relocs): New function.
13661         (Relobj::do_gc_process_relocs): New pure virtual function.
13662         (Relobj::sd_): New data member.
13663         (Sized_relobj::is_output_section_offset_invalid): New function.
13664         (Sized_relobj::do_gc_process_relocs): New function.
13665         * options.h (General_options::gc_sections): Modify to not be a no-op.
13666         (General_options::print_gc_sections): New option.
13667         * plugin.cc (Plugin_finish::run): Remove function call to
13668         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13669         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13670         * reloc.cc (Read_relocs::run): Add task to process relocs and
13671         determine unreferenced sections when doing garbage collection.
13672         (Gc_process_relocs): New class.
13673         (Sized_relobj::do_gc_process_relocs): New function.
13674         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13675         sections that are garbage collected.
13676         * reloc.h (Gc_process_relocs): New class.
13677         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13678         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13679         symbols whose corresponding sections are garbage collected.
13680         (Symbol_table::Symbol_table): Add new parameter for the garbage
13681         collection object.
13682         (Symbol_table::gc_mark_undef_symbols): New function.
13683         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13684         (Symbol_table::gc_mark_dyn_syms): New function.
13685         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13686         as garbage.
13687         (Symbol_table::add_from_object): Likewise.
13688         (Symbol_table::add_from_relobj): When building shared objects, do not
13689         treat externally visible symbols as garbage.
13690         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13691         table information for static and relocatable links.
13692         * symtab.h (Symbol_table::set_gc): New function.
13693         (Symbol_table::gc): New function.
13694         (Symbol_table::gc_mark_undef_symbols): New function.
13695         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13696         (Symbol_table::gc_mark_dyn_syms): New function.
13697         (Symbol_table::gc_): New data member.
13698         * target.h (Sized_target::gc_process_relocs): New pure virtual
13699         function.
13700         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13701         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13702
13703 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13704
13705         * options.h (General_options::gc_sections): Define as a no-op for now.
13706         (General_options::no_keep_memory): Ditto.
13707         (General_options::Bshareable): Define.
13708         * options.cc (General_options::finalize): Honor -Bshareable.
13709
13710 2009-01-20  Andreas Schwab  <schwab@suse.de>
13711
13712         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13713         read the value in the contents, since we don't use it.  Use the
13714         template endianness when writing.
13715         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13716
13717 2009-01-19  Andreas Schwab  <schwab@suse.de>
13718
13719         * configure.tgt (powerpc64-*): Fix targ_obj.
13720
13721 2009-01-15  Ian Lance Taylor  <iant@google.com>
13722
13723         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13724         local symbols when stripping all symbols.
13725
13726 2009-01-14  Cary Coutant  <ccoutant@google.com>
13727
13728         * output.cc (Output_reloc): Add explicit instantiations.
13729
13730 2009-01-14  Cary Coutant  <ccoutant@google.com>
13731
13732         * archive.cc (Archive::get_elf_object_for_member): Remove call
13733         to File_read::claim_for_plugin.
13734         * descriptors.cc (Descriptors::open): Remove reference to
13735         is_claimed.
13736         (Descriptors::claim_for_plugin): Remove.
13737         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13738         (Descriptors::is_claimed): Remove.
13739         (claim_descriptor_for_plugin): Remove.
13740         * fileread.cc (File_read::claim_for_plugin): Remove.
13741         * fileread.h (File_read::claim_for_plugin): Remove.
13742         (File_read::descriptor): Reopen descriptor if necessary.
13743         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13744         (Plugin_manager::all_symbols_read): Add task parameter. Change
13745         all callers.
13746         (Plugin_manager::get_input_file): New function.
13747         (Plugin_manager::release_input_file): New function.
13748         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13749         corresponding data member.
13750         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13751         and pass to base constructor. Change all callers.
13752         (get_input_file, release_input_file): New functions.
13753         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13754         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13755         (Plugin_manager::all_symbols_read): Add task parameter.
13756         (Plugin_manager::get_input_file): New function.
13757         (Plugin_manager::release_input_file): New function.
13758         (Plugin_manager::task_): New data member.
13759         (Pluginobj::Pluginobj): Add filesize parameter.
13760         (Pluginobj::filename): New function.
13761         (Pluginobj::descriptor): New function.
13762         (Pluginobj::filesize): New function.
13763         (Pluginobj::filesize_): New data member.
13764         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13765         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13766         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13767
13768         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13769         with archive libraries.
13770         * testsuite/Makefile.in: Regenerate.
13771         * testsuite/plugin_test.c (struct sym_info): New type.
13772         (get_input_file, release_input_file): New static variables.
13773         (onload): Capture new transfer vector entries.
13774         (claim_file_hook): Stop reading at end of file according to filesize.
13775         Factor out parsing of readelf output into separate function.
13776         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13777         APIs and get the source file name from the symbol table.  Convert
13778         source file name to corresponding object file name.  Print info
13779         message when adding new input files.
13780         (parse_readelf_line): New function.
13781         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13782         * testsuite/plugin_test_2.sh: Likewise.
13783         * testsuite/plugin_test_3.sh: Likewise.
13784         * testsuite/plugin_test_4.sh: New test case.
13785
13786 2009-01-07  Ian Lance Taylor  <iant@google.com>
13787
13788         * version.cc (version_string): Bump to 1.8.
13789
13790 2008-12-23  Cary Coutant  <ccoutant@google.com>
13791
13792         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13793         * plugin.cc (Plugin_manager::finish): Rename as
13794         layout_deferred_objects.  Move cleanup to separate function.
13795         (Plugin_manager::cleanup): New function.
13796         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13797         separately.
13798         * plugin.h (Plugin_manager::finish): Rename as
13799         layout_deferred_objects.
13800         (Plugin_manager::cleanup): New function.
13801         (Plugin_manager::cleanup_done): New field.
13802
13803 2008-12-23  Cary Coutant  <ccoutant@google.com>
13804
13805         * plugin.cc (is_visible_from_outside): New function.
13806         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13807         so we don't return "IR only" status for exported symbols or -r links.
13808
13809         * testsuite/Makefile.am (plugin_test_3): New test case.
13810         * testsuite/Makefile.in: Regenerate.
13811         * testsuite/plugin_test_3.sh: New file.
13812
13813 2008-12-22  Cary Coutant  <ccoutant@google.com>
13814
13815         * object.cc (Sized_relobj::layout_section): New function.
13816         (Sized_relobj::do_layout): Defer layout of input sections until after
13817         plugin has provided replacement files.
13818         (Sized_relobj::do_layout_deferred_sections): New function.
13819         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13820         (Relobj::layout_deferred_sections): New function.
13821         (Relobj::do_layout_deferred_sections): New function.
13822         (Sized_relobj::do_layout_deferred_sections): New function.
13823         (Sized_relobj::layout_section): New function.
13824         (Sized_relobj::Deferred_layout): New structure.
13825         (Sized_relobj::deferred_layout_): New field.
13826         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13827         Change all callers.  Layout deferred sections.
13828         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13829         references.
13830         (Plugin_hook::run): Move code from do_plugin_hook inline.
13831         (Plugin_hook::do_plugin_hook): Remove.
13832         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13833         (Plugin_manager::finish): Renamed, was cleanup.
13834         (Plugin_manager::should_defer_layout): New function.
13835         (Plugin_manager::add_deferred_layout_object): New function.
13836         (Plugin_manager::Deferred_layout_list): New type.
13837         (Plugin_manager::deferred_layout_objects_): New field.
13838         (Plugin_hook::do_plugin_hook): Remove.
13839
13840 2008-12-17  Ian Lance Taylor  <iant@google.com>
13841
13842         * options.h (class General_options): Add --no case for
13843         --export-dynamic.
13844
13845 2008-12-16  Cary Coutant  <ccoutant@google.com>
13846
13847         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13848         vector.
13849         (Plugin_manager::claim_file): Create plugin object even if
13850         plugin did not call the add_symbols callback.
13851         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13852         asking for more symbols than were added.
13853         * testsuite/Makefile.am (plugin_test_1): Add test case with
13854         no global symbols.
13855         (empty.syms): New target.
13856         * testsuite/Makefile.in: Regenerate.
13857         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13858         message. Don't call add_symbols if no globals.
13859         (all_symbols_read_hook): Don't provide replacement for empty
13860         claimed file.
13861
13862 2008-12-12  Ian Lance Taylor  <iant@google.com>
13863
13864         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13865         r_type == 0 for a local symbol with r_sym == 0.
13866         (scan_relocatable_relocs): Pass r_sym to
13867         local_non_section_strategy.
13868         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13869         r_sym parameter.
13870
13871         * configure.ac: Update test for TLS descriptors: they are
13872         supported as of glibc 2.9.
13873         * configure: Rebuild.
13874
13875 2008-12-11  Ian Lance Taylor  <iant@google.com>
13876
13877         PR 7091
13878         * target-reloc.h (Default_scan_relocatable_relocs): For each
13879         function, map r_type == 0 to RELOC_DISCARD.
13880
13881 2008-12-10  Cary Coutant  <ccoutant@google.com>
13882
13883         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13884         object to override a kept COMDAT group from a plugin object.
13885
13886 2008-12-09  Ian Lance Taylor  <iant@google.com>
13887
13888         PR 7088
13889         * yyscript.y (file_cmd): Handle INPUT.
13890
13891         * testsuite/initpri1.c: Change all declarations to be full
13892         prototypes by adding void, to avoid compiler warnings.
13893
13894 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13895
13896         * options.cc (General_options::parse_plugin_opt): New.
13897         (General_options::add_plugin): The argument now is just the filename.
13898         (General_options::add_plugin_option): New.
13899         * options.h (plugin_opt): New.
13900         (add_plugin): Change argument name.
13901         (add_plugin_option): New.
13902         * plugin.cc (Plugin::load): Don't parse the plugin option.
13903         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13904         (Plugin::add_option): New.
13905         (Plugin::args_): Change type.
13906         (Plugin::filename_): New.
13907         (Plugin_manager::add_plugin_option): New.
13908         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13909         * testsuite/Makefile.in: Regenerate.
13910
13911 2008-12-05  Cary Coutant  <ccoutant@google.com>
13912
13913         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13914         Handle --strip-lto-sections option.
13915         * options.h (strip_lto_sections): New option.
13916
13917 2008-12-01  Cary Coutant  <ccoutant@google.com>
13918
13919         * plugin.cc (ld_plugin_message): Change format parameter to const.
13920         Fix mismatch between new[] and delete.
13921
13922 2008-11-14  Cary Coutant  <ccoutant@google.com>
13923
13924         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13925         instead of -1U.
13926
13927 2008-11-05  Craig Silverstein  <csilvers@google.com>
13928
13929         * options.cc (General_options::parse_dynamic_list): New function.
13930         * options.h (General_options): New flags dynamic_list,
13931         dynamic_list_data, dynamic_list_cpp_new, and
13932         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13933         (General_options::in_dynamic_list): New function.
13934         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13935         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13936         (Lex::can_continue_name): Likewise.
13937         (yylex): Likewise.
13938         (read_script_file): New parameter script_options.
13939         (read_dynamic_list): New function.
13940         (Script_options::define_dynamic_list): New function.
13941         (dynamic_list_keyword_parsecodes): New variable.
13942         (dynamic_list_keywords): New variable.
13943         * script.h (Script_options::define_dynamic_list): New function
13944         prototype.
13945         (read_dynamic_list): New function prototype.
13946         * symtab.cc (strprefix): New macro.
13947         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13948         dynamic_list_data, dynamic_list_cpp_new, and
13949         dynamic_list_cpp_typeinfo.
13950         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13951         (dynamic_list_expr): New rule.
13952         (dynamic_list_nodes): Likewise.
13953         (dynamic_list_node): Likewise.
13954         * testsuite/Makefile.am (dynamic_list): New test.
13955         * testsuite/Makefile.in: Regenerated.
13956         * testsuite/dynamic_list.t: New file.
13957         * testsuite/dynamic_list.sh: New file.
13958
13959 2008-11-05  Craig Silverstein  <csilvers@google.com>
13960
13961         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13962         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13963         (t11_last): Likewise.
13964         * testsuite/ver_test_6.c (main): Likewise.
13965
13966 2008-10-07  Cary Coutant  <ccoutant@google.com>
13967
13968         * options.c (General_options::finalize): Add check for -static and
13969         -shared.
13970         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13971         is not empty.
13972
13973 2008-10-02  Cary Coutant  <ccoutant@google.com>
13974
13975         * plugin.cc (make_sized_plugin_object): Fix conditional
13976         compilation to work when not all targets are enabled.
13977
13978 2008-09-29  Cary Coutant  <ccoutant@google.com>
13979
13980         * archive.cc (Archive::get_file_and_offset): Use filename instead
13981         of name to get library path.
13982         (Archive::include_member): Unlock external member of a thin archive.
13983
13984         * testsuite/Makefile.am (TEST_AR): New variable.
13985         (thin_archive_test_1): New test.
13986         (thin_archive_test_2): New test.
13987         * testsuite/Makefile.in: Regenerate.
13988         * testsuite/thin_archive_main.cc: New file.
13989         * testsuite/thin_archive_test_1.cc: New file.
13990         * testsuite/thin_archive_test_2.cc: New file.
13991         * testsuite/thin_archive_test_3.cc: New file.
13992         * testsuite/thin_archive_test_4.cc: New file.
13993
13994 2008-09-29  Cary Coutant  <ccoutant@google.com>
13995
13996         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13997         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13998         instead of -1U.
13999         (Sized_relobj::do_finalize_local_symbols): Likewise.
14000         (Sized_relobj::map_to_kept_section): Likewise.
14001         * object.h (Sized_relobj::invalid_address): New constant.
14002         (Sized_relobj::do_output_section_offset): Check for invalid_address
14003         and return -1ULL.
14004         * output.cc (Output_reloc::local_section_offset): Use constant
14005         invalid_address instead of -1U.
14006         (Output_reloc::get_address): Likewise.
14007         (Output_section::output_address): Change -1U to -1ULL.
14008         * output.h (Output_reloc::invalid_address): New constant.
14009         * reloc.cc (Sized_relobj::write_sections): Use constant
14010         invalid_address instead of -1U.
14011         (Sized_relobj::relocate_sections): Likewise.
14012         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14013         values for merge sections.
14014         * target-reloc.h (relocate_for_relocatable): Use constant
14015         invalid_address instead of -1U.
14016
14017 2008-09-19  Cary Coutant  <ccoutant@google.com>
14018
14019         Add plugin functionality for link-time optimization (LTO).
14020         * configure.ac (plugins): Add --enable-plugins option.
14021         * configure: Regenerate.
14022         * config.in: Regenerate.
14023         * Makefile.am (LIBDL): New variable.
14024         (CCFILES): Add plugin.cc.
14025         (HFILES): Add plugin.h.
14026         (ldadd_var): Add LIBDL.
14027         * Makefile.in: Regenerate.
14028
14029         * archive.cc: Include "plugin.h".
14030         (Archive::setup): Don't preread archive symbols when using a plugin.
14031         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14032         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14033         files.
14034         (Archive::include_member): Add symbols from plugin objects.
14035         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14036         * descriptors.cc (Descriptors::open): Check for file descriptors
14037         abandoned by plugins.
14038         (Descriptors::claim_for_plugin): New function.
14039         * descriptors.h (Descriptors::claim_for_plugin): New function.
14040         (Open_descriptor::is_claimed): New field.
14041         (claim_descriptor_for_plugin): New function.
14042         * fileread.cc (File_read::claim_for_plugin): New function.
14043         * fileread.h (File_read::claim_for_plugin): New function.
14044         (File_read::descriptor): New function.
14045         * gold.cc: Include "plugin.h".
14046         (queue_initial_tasks): Add task to call plugin hooks for generating
14047         new object files.
14048         * main.cc: Include "plugin.h".
14049         (main): Load plugin libraries.
14050         * object.h (Pluginobj): Declare.
14051         (Object::pluginobj): New function.
14052         (Object::do_pluginobj): New function.
14053         (Object::set_target): New function.
14054         * options.cc: Include "plugin.h".
14055         (General_options::parse_plugin): New function.
14056         (General_options::General_options): Initialize plugins_ field.
14057         (General_options::add_plugin): New function.
14058         * options.h (Plugin_manager): Declare.
14059         (General_options): Add --plugin option.
14060         (General_options::has_plugins): New function.
14061         (General_options::plugins): New function.
14062         (General_options::add_plugin): New function.
14063         (General_options::plugins_): New field.
14064         * plugin.cc: New file.
14065         * plugin.h: New file.
14066         * readsyms.cc: Include "plugin.h".
14067         (Read_symbols::do_read_symbols): Check for archive before checking
14068         for ELF file.  Call plugin hooks to claim files.
14069         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14070         from a real object file; force override when processing replacement
14071         files.
14072         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14073         (Symbol::init_base_object): Likewise.
14074         (Symbol::init_base_output_data): Likewise.
14075         (Symbol::init_base_output_segment): Likewise.
14076         (Symbol::init_base_constant): Likewise.
14077         (Symbol::init_base_undefined): Likewise.
14078         (Symbol::output_section): Assert that object is not a plugin.
14079         (Symbol_table::add_from_pluginobj): New function.
14080         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14081         undefined.
14082         (Symbol_table::sized_write_globals): Likewise.
14083         (Symbol_table::add_from_pluginobj): Instantiate template.
14084         * symtab.h (Sized_pluginobj): Declare.
14085         (Symbol::in_real_elf): New function.
14086         (Symbol::set_in_real_elf): New function.
14087         (Symbol::in_real_elf_): New field.
14088         (Symbol_table::add_from_pluginobj): New function.
14089
14090         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14091         (LIBDL): New variable.
14092         (LDADD): Add LIBDL.
14093         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14094         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14095         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14096         (MOSTLYCLEANFILES): Likewise.
14097         * testsuite/Makefile.in: Regenerate.
14098         * testsuite/plugin_test.c: New file.
14099         * testsuite/plugin_test_1.sh: New file.
14100         * testsuite/plugin_test_2.sh: New file.
14101
14102 2008-09-16  Ian Lance Taylor  <iant@google.com>
14103
14104         * target-reloc.h (relocate_section): Check whether a symbol is
14105         defined by the ABI before reporting an undefined symbol error.
14106         * target.h (Target::is_defined_by_abi): Make parameter const.
14107         (Target::do_is_defined_by_abi): Likewise.
14108         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14109         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14110         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14111         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14112         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14113         * testsuite/Makefile.in: Rebuild.
14114
14115         * fileread.cc (make_view): Add casts to avoid warning.
14116
14117 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14118
14119         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14120         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14121
14122 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14123
14124         * options.h (General_options::output_is_executable): New.
14125         (General_options::output_is_pie): New.
14126         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14127         for shared libraries.
14128         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14129
14130 2008-09-11  Chris Demetriou  <cgd@google.com>
14131
14132         * options.h (origin): New -z option.
14133         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14134         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14135         in DT_FLAGS_1.
14136
14137 2008-09-05  Cary Coutant  <ccoutant@google.com>
14138
14139         * fileread.cc (File_read::make_view): Add check for attempt to map
14140         beyond end of file.
14141
14142 2008-09-05  Cary Coutant  <ccoutant@google.com>
14143
14144         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14145         explicit instantiations.
14146
14147 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14148
14149         PR gold/6858
14150         * options.cc (General_options::finalize): Allow undefined symbols
14151         in shlibs if linking -shared.
14152
14153         PR gold/6859
14154         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14155         symbols as not needing a dynsym entry.
14156
14157 2008-08-20  Craig Silverstein  <csilvers@google.com>
14158
14159         * fileread.cc (File_read::open): Do not lock the file unless it
14160         was successfully opened.
14161
14162 2008-08-14  Cary Coutant  <ccoutant@google.com>
14163
14164         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14165         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14166         * testsuite/tls_test.cc (struct int128): 128-bit struct
14167         for testing TLS relocs with non-zero addend.
14168         (v12): New TLS variable.
14169         (t12): New test.
14170         (t_last): Add check for v12.
14171         * testsuite/tls_test.h (t12): New function.
14172         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14173
14174 2008-08-13  Ian Lance Taylor  <iant@google.com>
14175
14176         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14177         set tls_segment_ or relro_segment_.
14178         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14179         when appropriate.
14180         * output.h (Output_section::clear_is_relro): New function.
14181         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14182         sections specially even when output_data_ is empty.
14183         (Output_segment::maximum_alignment): When first section is relro,
14184         only force alignment for PT_LOAD segments.
14185         * script.cc (script_data_segment_align): New function.
14186         (script_data_segment_relro_end): New function.
14187         * script-c.h (script_data_segment_align): Declare.
14188         (script_data_segment_relro_end): Declare.
14189         * script-sections.h (class Script_sections): Declare
14190         data_segment_align and data_segment_relro_end.  Add fields
14191         segment_align_index_ and saw_relro_end_.
14192         * script-sections.cc (class Sections_element): Add set_is_relro
14193         virtual function.  Add new bool* parameter to place_orphan_here.
14194         Add get_output_section virtual function.
14195         (class Output_section_definition): Add set_is_relro.  Add new
14196         bool* parameter to place_orphan_here.  Add get_output_section.
14197         Add is_relro_ field.
14198         (Output_section_definition::Output_section_definition): Initialize
14199         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14200         and is_relro_ fields.
14201         (Output_section_definition::place_orphan_here): Add is_relro
14202         parameter.
14203         (Output_section_definition::set_section_addresses): Set relro for
14204         output section.
14205         (Output_section_definition::alternate_constraint): Likewise.
14206         (class Orphan_output_section): Add new bool* parameter to
14207         place_orphan_here.  Add get_output_section.
14208         (Orphan_output_section::place_orphan_here): Add is_relro
14209         parameter.
14210         (Script_sections::Script_sections): Initialize
14211         data_segment_align_index_ and saw_relro_end_.
14212         (Script_sections::data_segment_align): New function.
14213         (Script_sections::data_segment_relro_end): New function.
14214         (Script_sections::place_orphan): Set or clear is_relro.
14215         (Script_sections::set_section_addresses): Force alignment of first
14216         TLS section.
14217         * yyscript.y (exp): Call script_data_segment_align and
14218         script_data_segment_relro_end.
14219         * testsuite/relro_script_test.t: New file.
14220         * testsuite/relro_test.cc (using_script): Declare.
14221         (t1, t2): Test using_script.
14222         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14223         (relro_script_test_SOURCES): Define.
14224         (relro_script_test_DEPENDENCIES): Define.
14225         (relro_script_test_LDFLAGS): Define.
14226         (relro_script_test_LDADD): Define.
14227         (relro_script_test.so): New target.
14228         * testsuite/Makefile.in: Rebuild.
14229
14230 2008-08-06  Cary Coutant <ccoutant@google.com>
14231
14232         * archive.cc (Archive::total_archives, Archive::total_members)
14233         (Archive::total_members_loaded): New variables.
14234         (Archive::setup): Add parameter.  Add option to preread
14235         archive symbols.
14236         (Archive::read_armap): Add counter.
14237         (Archive::get_file_and_offset): New function.
14238         (Archive::get_elf_object_for_member): New function.
14239         (Archive::read_all_symbols): New function.
14240         (Archive::read_symbols): New function.
14241         (Archive::add_symbols): Add counters.
14242         (Archive::include_all_members): Use armap to find members if it's
14243         already built.
14244         (Archive::include_member): Skip reading symbols if already read.
14245         Factored code into Archive::get_file_and_offset and
14246         Archive::get_elf_object_for_member.  Changed call to
14247         Mapfile::report_include_archive_member.
14248         (Archive::print_stats): New function.
14249         * archive.h: Declare Object and Read_symbols_data classes.
14250         (Archive::Archive): Add initializers for new members.
14251         (Archive::setup): Add parameter.
14252         (Archive::print_stats): New function.
14253         (Archive::total_archives, Archive::total_members)
14254         (Archive::total_members_loaded): New variables.
14255         (Archive::get_file_and_offset): New function.
14256         (Archive::get_elf_object_for_member): New function.
14257         (Archive::read_all_symbols): New function.
14258         (Archive::read_symbols): New function.
14259         (Archive::Archive_member): New class.
14260         (Archive::members_): New member.
14261         (Archive::num_members_): New member.
14262         * main.cc: Include archive.h.
14263         (main): Call Archive::print_stats.
14264         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14265         archive parameter; member_name is now the fully-decorated name.
14266         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14267         * options.h: (General_options): Add --preread-archive-symbols option.
14268         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14269         Archive::setup.
14270
14271 2008-08-04  Ian Lance Taylor  <iant@google.com>
14272
14273         * symtab.h (Symbol::use_plt_offset): New function.
14274         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14275         * powerpc.cc (Relocate::relocate): Likewise.
14276         * sparc.cc (Relocate::relocate): Likewise.
14277         * x86_64.cc (Relocate::relocate): Likewise.
14278         * testsuite/weak_plt.sh: New test.
14279         * testsuite/weak_plt_main.cc: New test.
14280         * testsuite/weak_plt_shared.cc: New test.
14281         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14282         (check_PROGRAMS): Add weak_plt.
14283         (check_DATA): Add weak_plt_shared.so.
14284         (weak_plt_main_pic.o, weak_plt): New targets.
14285         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14286         * testsuite/Makefile.in: Rebuild.
14287
14288         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14289         gcctestdir/ld.
14290         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14291         * testsuite/Makefile.in: Rebuild.
14292
14293 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14294
14295         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14296         * Makefile.in: Regenerate.
14297         * po/POTFILES.in: Regenerate.
14298
14299 2008-07-29  Ian Lance Taylor  <iant@google.com>
14300
14301         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14302         symbols before other symbols.
14303         * testsuite/script_test_2.cc (test_addr): Declare.
14304         (test_addr_alias): Declare.
14305         (main): Check that test_addr and test_addr_alias have the right
14306         values.
14307         * testsuite/script_test_2.t: Define test_addr_alias and
14308         test_addr.
14309
14310 2008-07-24  Ian Lance Taylor  <iant@google.com>
14311
14312         PR 5990
14313         * descriptors.cc: New file.
14314         * descriptors.h: New file.
14315         * gold-threads.h (class Hold_optional_lock): New class.
14316         * fileread.cc: Include "descriptors.h".
14317         (File_read::~File_read): Release descriptor rather than closing
14318         it.
14319         (File_read::open) [file]: Call open_descriptor rather than open.
14320         Set is_descriptor_opened_.
14321         (File_read::open) [memory]: Assert that descriptor is not open.
14322         (File_read::reopen_descriptor): New function.
14323         (File_read::release): Release descriptor.
14324         (File_read::do_read): Make non-const.  Reopen descriptor.
14325         (File_read::read): Make non-const.
14326         (File_read::make_view): Reopen descriptor.
14327         (File_read::do_readv): Likewise.
14328         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14329         Update declarations.
14330         * layout.cc: Include "descriptors.h".
14331         (Layout::create_build_id): Use open_descriptor rather than open.
14332         * output.cc: Include "descriptors.h".
14333         (Output_file::open): Use open_descriptor rather than open.
14334         * archive.cc (Archive::const_iterator): Change Archive to be
14335         non-const.
14336         (Archive::begin, Archive::end): Make non-const.
14337         (Archive::count_members): Likewise.
14338         * archive.h (class Archive): Update declarations.
14339         * object.h (Object::read): Make non-const.
14340         * Makefile.am (CCFILES): Add descriptors.cc.
14341         (HFILES): Add descriptors.h.
14342         * Makefile.in: Rebuild.
14343
14344         PR 6716
14345         * gold.h: Always include <clocale>.  Add Solaris workarounds
14346         following code in binutils/sysdep.h.
14347
14348         PR 6048
14349         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14350         this->eh_frame_hdr_ is NULL before using it.
14351
14352         * dynobj.cc (Versions::Versions): Update comment.
14353
14354         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14355         the base version name.
14356
14357         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14358         array size plus one.
14359         (Stringpool_template::set_string_offsets): Subtract one from key
14360         before using it as an array index.
14361         (Stringpool_template::get_offset_with_length): Likewise.
14362         (Stringpool_template::write_to_buffer): Likewise.
14363         * stringpool.h (Stringpool_template::get_offset_from_key):
14364         Likewise.
14365
14366 2008-07-23  Ian Lance Taylor  <iant@google.com>
14367
14368         PR 6658
14369         * object.h (Merged_symbol_value::value): Do our best to handle a
14370         negative addend.
14371
14372         PR 6647
14373         * script.cc (Version_script_info::get_versions): Don't add empty
14374         version tag to return value.
14375         (Version_script_info::get_symbol_version_helper): Change return
14376         type to bool.  Add pversion parameter.  Change all callers.
14377         (script_register_vers_node): Don't require a non-NULL tag.
14378         * script.h (class Version_script_info): Update declarations.
14379         (Version_script_info::get_symbol_version): Change return type to
14380         bool.  Add version parameter.  Change all callers.
14381         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14382         handling.  Handle an empty version from a version script.
14383         (Symbol_table::define_special_symbol): Likewise.
14384         * testsuite/ver_test_10.script: New file.
14385         * testsuite/ver_test_10.sh: New file.
14386         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14387         (check_DATA): Add ver_test_10.syms.
14388         (ver_test_10.syms, ver_test_10.so): New target.
14389         * testsuite/Makefile.in: Rebuild.
14390
14391 2008-07-23  Simon Baldwin  <simonb@google.com>
14392
14393         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14394         to zero for undefined symbols from dynamic libraries.
14395
14396 2008-07-23  Ian Lance Taylor  <iant@google.com>
14397
14398         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14399         Change all callers.
14400         * symtab.h (class Symbol_table): Update declaration.
14401         * testsuite/ver_test_9.cc: New file.
14402         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14403         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14404         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14405         (ver_test_9.so, ver_test_9.o): New targets.
14406         * testsuite/Makefile.in: Rebuild.
14407
14408 2008-07-22  Ian Lance Taylor  <iant@google.com>
14409
14410         * options.h (class General_options): Define --check-sections.
14411         * layout.cc (Layout::set_segment_offsets): Handle
14412         --check-sections.
14413
14414         * options.h (class General_options): Define -n/--nmagic and
14415         -N/--omagic.
14416         * options.cc (General_options::finalize): For -n/--nmagic or
14417         -N/--omagic, set -static.
14418         * layout.cc (Layout::attach_allocated_section_to_segment): If
14419         -N/--omagic, don't put read-only and read-write sections in
14420         different segments.
14421         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14422         finding a read-only segment.
14423         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14424         don't set the minimum segment alignment to the common page size,
14425         and don't set the file offset to the address modulo the page size.
14426         * script-sections.cc (Script_sections::create_segments): If
14427         -n/--omagic, don't put read-only and read-write sections in
14428         different segments.
14429
14430         * cref.cc: New file.
14431         * cref.h: New file.
14432         * options.h (class General_options): Add --print-symbol-counts.
14433         * main.cc (main): Issue defined symbol report if requested.
14434         * archive.cc (Archive::interpret_header): Make into a const member
14435         function.
14436         (Archive::add_symbols): Call Input_objects::archive_start and
14437         archive_stop.
14438         (Archive::const_iterator): Define new class.
14439         (Archive::begin, Archive::end): New functions.
14440         (Archive::include_all_members): Rewrite to use iterator.
14441         (Archive::count_members): New function.
14442         * archive.h (class Archive): Update declarations.
14443         (Archive::filename): New function.
14444         * object.cc: Include "cref.h".
14445         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14446         (Sized_relobj::do_get_global_symbol_counts): New function.
14447         (Input_objects::add_object): Add object to cross-referencer.
14448         (Input_objects::archive_start): New function.
14449         (Input_objects::archive_stop): New function.
14450         (Input_objects::print_symbol_counts): New function.
14451         * object.h: Declare Cref and Archive.
14452         (Object::get_global_symbol_counts): New function.
14453         (Object::do_get_global_symbol_counts): New pure virtual function.
14454         (class Sized_relobj): Add defined_count_ field.  Update
14455         declarations.
14456         (class Input_objects): Add cref_ field.  Update constructor.
14457         Update declarations.
14458         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14459         defined_count_.
14460         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14461         symbol counts.
14462         (Sized_dynobj::do_get_global_symbol_counts): New function.
14463         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14464         defined_count_.  Update declarations.  Define Symbols typedef.
14465         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14466         parameter.  Change all callers.
14467         (Symbol_table::add_from_dynobj): Add sympointers and defined
14468         parameters.  Change all callers.
14469         * symtab.h (class Symbol_table): Update declarations.
14470         * Makefile.am (CCFILES): Add cref.cc.
14471         (HFILES): Add cref.h.
14472         * Makefile.in: Rebuild.
14473
14474 2008-07-22  Simon Baldwin  <simonb@google.com>
14475
14476         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14477         to zero when writing undefined symbols.
14478
14479 2008-07-22  Ian Lance Taylor  <iant@google.com>
14480
14481         * output.cc (Output_section::add_input_section): Don't try to
14482         merge empty merge sections.
14483
14484 2008-07-21  Craig Silverstein  <csilvers@google.com>
14485
14486         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14487         Include symbol version in error message.
14488
14489 2008-07-20  Chris Demetriou  <cgd@google.com>
14490
14491         * configure.ac (gold_cv_c_random_seed): New configured variable.
14492         (RANDOM_SEED_CFLAGS): New substituted variable.
14493         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14494         * configure: Rebuild.
14495         * Makefile.in: Likewise.
14496         * testsuite/Makefile.in: Likewise.
14497
14498 2008-07-18  Ian Lance Taylor  <iant@google.com>
14499
14500         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14501         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14502         * testsuite/ver_test_main.cc (main): Call t4.
14503         (t4, t4_2a): Define.
14504         * testsuite/ver_test_2.cc (t4_2): Define.
14505         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14506         * testsuite/ver_test_4.cc (t4_2a): Define.
14507         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14508         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14509
14510 2008-07-17  Ian Lance Taylor  <iant@google.com>
14511
14512         * dynobj.cc (Versions::add_def): If we give an error about a
14513         missing version, go ahead and create the version anyhow.
14514
14515 2008-07-10  Ian Lance Taylor  <iant@google.com>
14516
14517         Handle output sections with more than 0x7fffffff bytes.
14518         * object.h (class Relobj): Change map_to_output_ to
14519         output_sections_, and just keep a section pointer.  Change all
14520         uses.  Move comdat group support to Sized_relobj.
14521         (Relobj::is_section_specially_mapped): Remove.
14522         (Relobj::output_section): Remove poff parameter.  Change all
14523         callers.
14524         (Relobj::output_section_offset): New function.
14525         (Relobj::set_section_offset): Rewrite.
14526         (Relobj::map_to_output): Remove.
14527         (Relobj::output_sections): New function.
14528         (Relobj::do_output_section_offset): New pure virtual function.
14529         (Relobj::do_set_section_offset): Likewise.
14530         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14531         group support from Relobj.  Update declarations.
14532         (Sized_relobj::get_output_section_offset): New function.
14533         (Sized_relobj::do_output_section_offset): New function.
14534         (Sized_relobj::do_set_section_offset): New function.
14535         * object.cc (Relobj::output_section_address): Remove.
14536         (Sized_relobj::Sized_relobj): Initialize new fields.
14537         (Sized_relobj::include_section_group): Cast find_kept_object to
14538         Sized_relobj.
14539         (Sized_relobj::include_linkonce_section): Likewise.
14540         (Sized_relobj::do_layout): Use separate arrays for output section
14541         and output offset.
14542         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14543         output_sections.
14544         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14545         output_sections and section_offsets.
14546         (Sized_relobj::write_local_symbols): Likewise.
14547         (map_to_kept_section): Compute output address directly.
14548         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14549         output_sections and section_offsets.
14550         (Sized_relobj::write_sections): Likewise.
14551         (Sized_relobj::relocate_sections): Likewise.
14552         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14553         * output.h (class Output_reloc): Update declarations.  Change
14554         u2_.relobj to Sized_relobj*.
14555         (class Output_data_reloc): Change add functions to use
14556         Sized_relobj*.
14557         * output.cc (Output_reloc::Output_reloc): Change relobj to
14558         Sized_relobj*.
14559         (Output_reloc::local_section_offset): Change return type to
14560         Elf_Addr.  Use get_output_section_offset.
14561         (Output_reloc::get_address): Likewise.
14562         (Output_section::is_input_address_mapped): Don't call
14563         is_section_specially_mapped.
14564         (Output_section::output_offset): Likewise.
14565         (Output_section::output_address): Likewise.
14566         (Output_section::starting_output_address): Likewise.
14567         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14568         parameter to Sized_relobj*.
14569         (Copy_relocs::need_copy_reloc): Likewise.
14570         (Copy_relocs::save): Likewise.
14571         * copy-relocs.h (class Copy_relocs): Update declarations.
14572         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14573         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14574         * target-reloc.h (relocate_for_relocatable): Change
14575         offset_in_output_section type to Elf_Addr.  Change code that uses
14576         it as well.
14577         * layout.cc (Layout::layout): Always set *off.
14578         * mapfile.cc (Mapfile::print_input_section): Use
14579         output_section_offset.
14580         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14581         Sized_relobj*.
14582         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14583         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14584         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14585
14586 2008-07-03  Ian Lance Taylor  <iant@google.com>
14587
14588         * layout.cc (Layout::include_section): Do not discard unrecognized
14589         SHT_STRTAB sections.
14590
14591 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14592
14593         * script.cc (Lex::can_continue_name): Make '?' allowable in
14594         version-script names.
14595         * testsuite/version_script.map: Change glob pattern to use '?'
14596
14597 2008-06-30  Manish Singh  <yosh@gimp.org>
14598
14599         PR 6585
14600         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14601         Correct typo.
14602
14603 2008-06-30  Ian Lance Taylor  <iant@google.com>
14604
14605         PR 6660
14606         PR 6682
14607         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14608         versions]: Don't try to read the value in the contents, since we
14609         don't use it.  Use the template endianness when writing.
14610
14611 2008-06-25  Cary Coutant  <ccoutant@google.com>
14612
14613         * fileread.cc (File_read::make_view): Assert on zero-length view.
14614         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14615         symbol table when there are no symbols to read.
14616
14617 2008-06-23  Craig Silverstein  <csilvers@google.com>
14618
14619         * version.cc (version_string): Bump to 1.7
14620
14621 2008-06-18  Craig Silverstein  <csilvers@google.com>
14622
14623         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14624         constant 0xFFFF to type Valtype.
14625         (Powerpc_relocate_functions::rel16_ha): Likewise.
14626
14627 2008-06-17  Ian Lance Taylor  <iant@google.com>
14628
14629         * output.h (Output_section::Input_section): Initialize p2align_ to
14630         zero for Output_section_data constructors.
14631         (Output_section::Input_section::addralign): If not an input
14632         section, return the alignment of the Output_section_data.
14633         * testsuite/copy_test.cc: New file.
14634         * testsuite/copy_test_1.cc: New file.
14635         * testsuite/copy_test_2.cc: New file.
14636         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14637         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14638         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14639         (copy_test_1_pic.o, copy_test_1.so): New targets.
14640         (copy_test_2_pic.o, copy_test_2.so): New targets.
14641         * testsuite/Makefile.in: Rebuild.
14642
14643         * script-sections.cc (Script_sections::place_orphan): Initialize
14644         local variable exact.
14645
14646 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14647
14648         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14649
14650 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14651             David S. Miller  <davem@davemloft.net>
14652
14653         * powerpc.cc: New file.
14654         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14655         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14656         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14657         * Makefile.in: Rebuild.
14658
14659 2008-06-09  Ian Lance Taylor  <iant@google.com>
14660
14661         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14662         <exception>.
14663         (throwing, orig_terminate): New static variables.
14664         (terminate_handler): New static function.
14665         (t2): Set terminate handler.
14666
14667 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14668
14669         PR 6584
14670         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14671         alignment.
14672
14673 2008-05-30  Cary Coutant  <ccoutant@google.com>
14674
14675         * archive.cc (Archive::include_all_members) Correct to step
14676         over symbol table and extended name table in thin archives.
14677
14678 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14679
14680         PR 6407
14681         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14682         calculation.
14683
14684 2008-05-28  Caleb Howe  <cshowe@google.com>
14685
14686         * reduced_debug_output.cc: New file.
14687         * reduced_debug_output.h: New file.
14688         * options.h (class General_options): Add --strip-debug-non-line.
14689         * options.cc (General_options::finalize): Add strip_debug_non_line
14690         to the strip heirarchy.
14691         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14692         fields.
14693         * layout.cc: Include "reduced_debug_output.h".
14694         (Layout::Layout): Initialize new fields.
14695         (line_only_debug_sections): New static array.
14696         (is_lines_only_debug_sections): New static inline function.
14697         (Layout::include_section): Handle --strip-debug-non-line.
14698         (Layout::make_output_section): If --strip-debug-non-line, build
14699         new output sections for .debug_abbrev and .debug_info.
14700         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14701         gold.  Warn about possible overflow.
14702         (read_signed_LEB_128): Likewise.
14703         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14704         (read_signed_LEB_128): Declare.
14705         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14706         (HFILES): Add reduced_debug_output.h.
14707         * Makefile.in: Rebuild.
14708
14709 2008-05-21  Ian Lance Taylor  <iant@google.com>
14710
14711         * mapfile.cc: New file.
14712         * mapfile.h: New file.
14713         * options.h (class General_options): Add -M/--print-map and -Map.
14714         * options.cc (General_options::finalize): Make -M equivalent to
14715         -Map -.
14716         * main.cc: Include <cstdio> and "mapfile.h".
14717         (main): Open mapfile if requested.
14718         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14719         constructor.  Change caller.
14720         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14721         (queue_middle_tasks): Likewise.
14722         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14723         declarations.
14724         * archive.cc: Include "mapfile.h".
14725         (Archive::add_symbols): Add mapfile parameter.  Change all
14726         callers.  Pass mapfile, symbol, and reason to include_member.
14727         (Archive::include_all_members): Add mapfile parameter.  Change all
14728         callers.
14729         (Archive::include_member): Add mapfile, sym, and why parameters.
14730         Change all callers.  Report inclusion to map file.
14731         * archive.h: Include "fileread.h".
14732         (class Archive): Update declarations.
14733         (Archive::file): New const method.
14734         (class Add_archive_symbols): Add mapfile_ field.  Update
14735         constructor.  Change all callers.
14736         * readsyms.h (class Read_symbols): Likewise.
14737         (class Finish_group): Likewise.
14738         (class Read_script): Likewise.
14739         * common.cc: Include "mapfile.h".
14740         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14741         all callers.
14742         (Symbol_table::do_allocate_commons): Likewise.
14743         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14744         symbol allocation to mapfile.
14745         * common.h (class Allocate_commons_task): Add mapfile_ field.
14746         Update constructor.  Change all callers.
14747         * symtab.h (class Symbol_table): Update declarations.
14748         * layout.cc: Include "mapfile.h".
14749         (Layout_task_runner::run): Print information to mapfile.
14750         (Layout::create_gold_note): Change Output_data_fixed_space to
14751         Output_data_zero_fill.
14752         (Layout::create_build_id): Likewise.
14753         (Layout::print_to_mapfile): New function.
14754         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14755         constructor.  Change caller.
14756         (class Layout): Declare print_to_mapfile.
14757         * output.cc (Output_section::Input_section::print_to_mapfile): New
14758         function.
14759         (Output_section::add_input_section): If producing a map, always
14760         add to input_sections_ list.
14761         (Output_section::do_print_to_mapfile): New function.
14762         (Output_segment::print_sections_to_mapfile): New function.
14763         (Output_segment::print_section_list_to_mapfile): New function.
14764         * output.h: Include "mapfile.h".
14765         (Output_data::print_to_mapfile): New function.
14766         (Output_data::do_print_to_mapfile): New virtual function.
14767         (Output_segment_headers::do_print_to_mapfile): New function.
14768         (Output_file_header::do_print_to_mapfile): New function.
14769         (Output_data_const::do_print_to_mapfile): New function.
14770         (class Output_data_const_buffer): Add map_name_ field.  Update
14771         constructor.  Change all callers.  Add do_print_to_mapfile
14772         function.
14773         (class Output_data_fixed_space): Likewise.
14774         (class Output_data_space): Likewise.
14775         (class Output_data_zero_fill): New class.
14776         (Output_data_strtab::do_print_to_mapfile): New function.
14777         (Output_data_reloc_base::do_print_to_mapfile): New function.
14778         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14779         (Output_data_group::do_print_to_mapfile): New function.
14780         (Output_data_got::do_print_to_mapfile): New function.
14781         (Output_data_dynamic::do_print_to_mapfile): New function.
14782         (Output_symtab_xindex::do_print_to_mapfile): New function.
14783         (class Output_section): Declare do_print_to_mapflie.  Declare
14784         print_to_mapfile in Input_section.
14785         (class Output_segment): Declare new functions.
14786         * object.h (Sized_relobj::symbol_count): New function.
14787         * script-sections.cc
14788         (Output_section_element_dot_assignment::set_section_addresses):
14789         Change Output_data_fixed_space to Output_data_zero_fill.
14790         (Output_data_expression::do_print_to_mapfile): New function.
14791         * script.cc (read_input_script): Add mapfile parameter.  Change
14792         all callers.
14793         * script.h (read_input_script): Update declaration.
14794         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14795         (Eh_frame::do_print_to_mapfile): New function.
14796         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14797         (Output_merge_string::do_print_to_mapfile): New function.
14798         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14799         function.
14800         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14801         function.
14802         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14803         function.
14804         * Makefile.am (CCFILES): Add mapfile.cc.
14805         (HFILES): Add mapfile.h.
14806         * Makefile.in: Rebuild.
14807
14808 2008-05-19  Ian Lance Taylor  <iant@google.com>
14809
14810         * options.h (class General_options): Add -z relro.
14811         * layout.cc (Layout::Layout): Initialize relro_segment_.
14812         (Layout::add_output_section_data): Return the output section.
14813         (Layout::make_output_section): Rcognize relro sections and mark
14814         them appropriately.
14815         (Layout::attach_allocated_section_to_segment): Put relro sections
14816         in a PT_GNU_RELRO segment.
14817         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14818         section as relro.
14819         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14820         PT_TLS segments.
14821         (Layout::linkonce_mapping): Map d.rel.ro.local to
14822         .data.rel.ro.local.
14823         (Layout::output_section_name): Us .data.rel.ro.local for any
14824         section which begins with that.
14825         * layout.h (class Layout): Update add_output_section_data
14826         declaration.  Add relro_segment_ field.
14827         * output.cc (Output_section::Output_section): Initialize is_relro_
14828         and is_relro_local_ fields.
14829         (Output_segment::add_output_section): Group relro sections.
14830         (Output_segment::is_first_section_relro): New function.
14831         (Output_segment::maximum_alignment): If there is a relro section,
14832         align the segment to the common page size.
14833         (Output_segment::set_section_addresses): Track whether we are
14834         looking at relro sections.  If the last section is a relro
14835         section, align to the common page size.
14836         (Output_segment::set_section_list_addresses): Add in_relro
14837         parameter.  Change all callers.  Align to the page size when
14838         moving from relro to non-relro section.
14839         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14840         segment.
14841         * output.h (class Output_section): Add is_relro_ and
14842         is_relro_local_ fields.
14843         (Output_section::is_relro): New function.
14844         (Output_section::set_is_relro): New function.
14845         (Output_section::is_relro_local): New function.
14846         (Output_section::set_is_relro_local): New function.
14847         (class Output_segment): Update declarations.
14848         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14849         * sparc.cc (Target_sparc::got_section): Likewise.
14850         * x86_64.cc (Target_x86_64::got_section): Likewise.
14851         * testsuite/relro_test_main.cc: New file.
14852         * testsuite/relro_test.cc: New file.
14853         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14854         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14855         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14856         (relro_test.so, relro_test_pic.o): New targets.
14857         * testsuite/Makefile.in: Rebuild.
14858
14859 2008-05-16  Ian Lance Taylor  <iant@google.com>
14860
14861         * output.cc (Output_segment::add_output_section): Remove front
14862         parameter.
14863         * output.h (class Output_segment): Remove
14864         add_initial_output_section and overloaded add_output_section.
14865         Update declaration of remaining add_output_section.
14866         * layout.cc (Layout::create_interp): Call add_output_section
14867         rather than add_initial_output_section.
14868         (Layout::finish_dynamic_section): Likewise.
14869
14870         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14871         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14872         know the dynamic type.
14873         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14874         field.  Initialize it in constructor.
14875         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14876         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14877         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14878         reloc.
14879
14880         * output.cc (Output_reloc::get_address): Change return type to
14881         Elf_Addr.
14882         * output.h (class Output_reloc): Update get_address declaration.
14883         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14884         for section addresses.
14885
14886 2008-05-09  Ian Lance Taylor  <iant@google.com>
14887
14888         PR 6493
14889         * gold.cc (gold_nomem): Use return value of write.
14890
14891 2008-05-08  Ian Lance Taylor  <iant@google.com>
14892
14893         * symtab.c (Symbol::init_base_output_data): Add version
14894         parameter.  Change all callers.
14895         (Symbol::init_base_output_segment): Likewise.
14896         (Symbol::init_base_constant): Likewise.
14897         (Symbol::init_base_undefined): Likewise.
14898         (Sized_symbol::init_output_data): Likewise.
14899         (Sized_symbol::init_output_segment): Likewise.
14900         (Sized_symbol::init_constant): Likewise.
14901         (Sized_symbol::init_undefined): Likewise.
14902         (Symbol_table::do_define_in_output_data): If the new symbol has a
14903         version, mark it as the default.
14904         (Symbol_table::do_define_in_output_segment): Likewise.
14905         (Symbol_table::do_define_as_constant): Likewise.
14906         * symtab.h (class Symbol): Update declarations.
14907         (class Sized_symbol): Likewise.
14908         * resolve.cc (Symbol::override_version): New function.
14909         (Symbol::override_base): Call override_version.
14910         (Symbol::override_base_with_special): Likewise.
14911         * testsuite/ver_script_8.script: New file.
14912         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14913         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14914         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14915         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14916
14917 2008-05-06  Ian Lance Taylor  <iant@google.com>
14918
14919         PR 6049
14920         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14921         functions.
14922         (class General_options): Remove existing --undefined, and add
14923         --no-undefined instead.  Add new --undefined as synonym for -u.
14924         * archive.cc (Archive::add_symbols): Check whether symbol was
14925         named with -u.
14926         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14927         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14928         all uses.  Add IS_UNDEFINED.  Update declarations to split
14929         different versions of init_base.  Declare init_base_undefined.
14930         (Symbol::is_defined): Handle IS_UNDEFINED.
14931         (Symbol::is_undefined): Likewise.
14932         (Symbol::is_weak_undefined): Call is_undefined.
14933         (Symbol::is_absolute): Handle IS_CONSTANT.
14934         (class Sized_symbol): Update declarations to split different
14935         versions of init.  Declare init_undefined.
14936         (class Symbol_table): Declare new functions.
14937         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14938         Change all callers.
14939         (Symbol::init_base_output_data): Likewise.
14940         (Symbol::init_base_output_segment): Likewise.
14941         (Symbol::init_base_constant): Likewise.
14942         (Symbol::init_base_undefined): New function.
14943         (Sized_symbol::init_object): Rename from init.  Change all
14944         callers.
14945         (Sized_symbol::init_output_data): Likewise.
14946         (Sized_symbol::init_output_segment): Likewise.
14947         (Sized_symbol::init_constant): Likewise.
14948         (Sized_symbol::init_undefined): New function.
14949         (Symbol_table::add_undefined_symbols_from_command_line): New
14950         function.
14951         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14952         function.
14953         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14954         (Symbol::output_section): Likewise.
14955         (Symbol::set_output_section): Likewise.
14956         (Symbol_table::sized_finalize_symbol): Likewise.
14957         (Symbol_table::sized_write_globals): Likewise.
14958         * resolve.cc (Symbol_table::should_override): Likewise.
14959         (Symbol::override_base_with_special): Likewise.
14960
14961         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14962         symbol, change it to have default visibility.
14963         * testsuite/protected_1.cc: New file.
14964         * testsuite/protected_2.cc: New file.
14965         * testsuite/protected_3.cc: New file.
14966         * testsuite/protected_main_1.cc: New file.
14967         * testsuite/protected_main_2.cc: New file.
14968         * testsuite/protected_main_3.cc: New file.
14969         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14970         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14971         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14972         (protected_1.so): New target.
14973         (protected_1_pic.o, protected_2_pic.o): New targets.
14974         (protected_3_pic.o): New target.
14975         (check_PROGRAMS): Add protected_2.
14976         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14977         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14978         * testsuite/Makefile.in: Rebuild.
14979
14980         * options.h (DEFINE_var): Add set_user_set_##varname__.
14981         (DEFINE_bool_alias): New macro.
14982         (class General_options): Define -Bstatic using DEFINE_bool_alias
14983         rather than DEFINE_special.  Add --undefined as an alias for -z
14984         defs.
14985         * options.cc (General_options::parse_Bstatic): Remove.
14986
14987         * options.h (class General_options): Add --fatal-warnings.
14988         * main.cc (main): Implement --fatal-warnings.
14989         * errors.h (Errors::warning_count): New function.
14990
14991         * options.h (class General_options): Add -Bsymbolic-functions.
14992         * symtab.h (Symbol::is_preemptible): Check for
14993         -Bsymbolic-functions.
14994
14995 2008-05-05  Ian Lance Taylor  <iant@google.com>
14996
14997         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14998         as noVARNAME rather than no-VARNAME.
14999         (class General_options): Add option -z combreloc.
15000         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15001         get_address.
15002         (Output_reloc::sort_before) [SHT_REL]: New function.
15003         (Output_reloc::sort_before) [SHT_RELA]: New function.
15004         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15005         Sort_relocs_comparison.
15006         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15007         parameter.  Change all callers.
15008         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15009         sort_relocs parameter.  Change all callers.
15010         * output.cc (Output_reloc::get_address): New function, broken out
15011         of write_rel.
15012         (Output_reloc::write_rel): Call it.
15013         (Output_reloc::compare): New function.
15014         (Output_data_reloc_base::do_write): Optionally sort relocs.
15015
15016         * configure.ac: If targ_extra_obj is set, link it in.
15017         * configure.tgt: Initialize all variables.
15018         (x86_64*): Set targ_extra_obj and targ_extra_size.
15019         * configure: Rebuild.
15020
15021         * object.cc (Sized_relobj::include_section_group): Adjust section
15022         indexes read from group data.  Build vector to pass to
15023         layout_group.
15024         * layout.cc (Layout::layout_group): Add flags and shndxes
15025         parameters.  Remove contents parameter.  Change caller.  Update
15026         explicit instantiations.
15027         * layout.h (class Layout): Update layout_group declaration.
15028         * output.cc (Output_data_group::Output_data_group): Add flags and
15029         input_shndxes parameters.  Remove contents parameter.  Change
15030         caller.
15031         (Output_data_group::do_write): Change input_sections_ to
15032         input_shndxes_.
15033         * output.h (class Output_data_group): Update constructor
15034         declaration.  Rename input_sections_ to input_shndxes_.
15035         * testsuite/many_sections_test.cc: Add template.
15036
15037 2008-04-30  Cary Coutant  <ccoutant@google.com>
15038
15039         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15040
15041         * layout.cc (Layout::include_section): Refactored check for debug
15042         info section.
15043         (Layout::add_comdat): Add new parameters.  Change type
15044         of signature parameter.  Add object and shndx to signatures table.
15045         (Layout::find_kept_object): New function.
15046         * layout.h: Include <cstring>.
15047         (Layout::is_debug_info_section): New function.
15048         (Layout::add_comdat): Add new parameters.
15049         (Layout::find_kept_object): New function.
15050         (Layout::Kept_section): New struct.
15051         (Layout::Signatures): Change type of map range.
15052         * object.cc (Relobj::output_section_address): New function.
15053         (Sized_relobj::include_section_group): Add new parameters.  Change
15054         calls to Layout::add_comdat.  Change to build table of kept comdat
15055         groups and table mapping discarded sections to kept sections.
15056         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15057         (Sized_relobj::do_layout): Change calls to include_section_group and
15058         include_linkonce_section.
15059         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15060         value to zero when section is discarded.
15061         (Sized_relobj::map_to_kept_section): New function.
15062         * object.h (Relobj::output_section_address): New function.
15063         (Relobj::Comdat_group): New type.
15064         (Relobj::find_comdat_group): New function.
15065         (Relobj::Comdat_group_table): New type.
15066         (Relobj::Kept_comdat_section): New type.
15067         (Relobj::Kept_comdat_section_table): New type.
15068         (Relobj::add_comdat_group): New function.
15069         (Relobj::set_kept_comdat_section): New function.
15070         (Relobj::get_kept_comdat_section): New function.
15071         (Relobj::comdat_groups_): New field.
15072         (Relobj::kept_comdat_sections_): New field.
15073         (Symbol_value::input_value): Update comment.
15074         (Sized_relobj::map_to_kept_section) New function.
15075         (Sized_relobj::include_linkonce_section): Add new parameter.
15076         * target-reloc.h (Comdat_behavior): New type.
15077         (get_comdat_behavior): New function.
15078         (relocate_section): Add code to map a discarded section to the
15079         corresponding kept section when applying a relocation.
15080
15081 2008-04-30  Craig Silverstein  <csilvers@google.com>
15082
15083         * dwarf_reader.cc (next_generation_count): New static var.
15084         (Addr2line_cache_entry): New struct.
15085         (addr2line_cache): New static var.
15086         (Dwarf_line_info::one_addr2line): Added caching.
15087         (Dwarf_line_info::clear_addr2line_cache): New function.
15088         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15089         cache-size parameter.
15090         (Dwarf_line_info::one_addr2line_cache): New function.
15091         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15092         new cache-size argument to one_addr2line(), and clear cache.
15093
15094 2008-04-28  Cary Coutant  <ccoutant@google.com>
15095
15096         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15097         R_386_PC8 relocations.
15098
15099 2008-04-23  Ian Lance Taylor  <iant@google.com>
15100
15101         * object.cc (Sized_relobj::include_section_group): Check for
15102         invalid section group.
15103
15104         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15105         header size.
15106
15107         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15108         than read for file header.
15109         * archive.cc (Archive::include_member): Likewise.
15110
15111 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15112
15113         * aclocal.m4: Regenerate.
15114         * configure: Regenerate.
15115
15116 2008-04-19  Ian Lance Taylor  <iant@google.com>
15117
15118         * version.cc (version_string): Bump to 1.6.
15119
15120         * testsuite/Makefile.am (many_sections_r_test): New target.
15121         (many_sections_r_test_SOURCES): Remove.
15122         (many_sections_r_test_DEPENDENCIES): Remove.
15123         (many_sections_r_test_LDFLAGS): Remove.
15124         (many_sections_r_test_LDADD): Remove.
15125
15126         * object.cc (Sized_relobj::do_add_symbols): Always pass
15127         local_symbol_count_ to add_from_relobj.
15128
15129         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15130         every thousand variables.
15131         * testsuite/Makefile.in: Rebuild.
15132
15133         * object.cc (Xindex::initialize_symtab_xindex): New function.
15134         (Xindex::read_symtab_xindex): New function.
15135         (Xindex::sym_xindex_to_shndx): New function.
15136         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15137         available.
15138         (Sized_relobj::do_initialize_xindex): New function.
15139         (Sized_relobj::do_read_symbols): Adjust section links.
15140         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15141         parameter.  Change all callers.
15142         (Sized_relobj::include_section_group): Adjust section links and
15143         symbol section indexes.
15144         (Sized_relobj::do_layout): Adjust section links.
15145         (Sized_relobj::do_count_local_symbols): Adjust section links and
15146         symbol section indexes.
15147         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15148         ordinary and special symbols.
15149         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15150         dynsym_xindex parameters.  Change all callers.  Adjust section
15151         links.  Use SHN_XINDEX when needed.
15152         (Sized_relobj::get_symbol_location_info): Adjust section links.
15153         Don't get fooled by special symbols.
15154         * object.h (class Xindex): Define.
15155         (class Object): Add xindex_ parameter.  Declare virtual functoin
15156         do_initialize_xindex.
15157         (Object::adjust_sym_shndx): New function.
15158         (Object::set_xindex): New protected function.
15159         (class Symbol_value): Add is_ordinary_shndx_ field.
15160         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15161         (Symbol_value::value): Assert ordinary section.
15162         (Symbol_value::initialize_input_to_output_map): Likewise.
15163         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15164         Change all callers.
15165         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15166         all callers.
15167         (class Sized_relobj): Update declarations.
15168         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15169         parameter.  Change all callers.
15170         (Sized_relobj::adjust_shndx): New function.
15171         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15172         field.
15173         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15174         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15175         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15176         (Sized_dynobj::read_dynsym_section): Adjust section links.
15177         (Sized_dynobj::read_dynamic): Likewise.
15178         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15179         section links.
15180         (Sized_dynobj::do_initialize_xindex): New function.
15181         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15182         do_initialize_xindex.
15183         (Sized_dynobj::adjust_shndx): New function.
15184         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15185         dynsym_xindex_ fields.
15186         (Layout::finalize): Add a call to set_section_indexes before
15187         creating the symtab sections.
15188         (Layout::set_section_indexes): Don't do anything if the section
15189         already has a section index.
15190         (Layout::create_symtab_sections): Add shnum parameter.  Change
15191         caller.  Create .symtab_shndx section if needed.
15192         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15193         caller.
15194         (Layout::allocated_output_section_count): New function.
15195         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15196         needed.
15197         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15198         fields.  Update declarations.
15199         (Layout::symtab_xindex): New function.
15200         (Layout::dynsym_xindex): New function.
15201         (class Write_symbols_task): Add layout_ field.
15202         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15203         Change caller.
15204         * output.cc (Output_section_headers::Output_section_headers): Add
15205         shstrtab_section parameter.  Change all callers.
15206         (Output_section_headers::do_sized_write): Store overflow values
15207         for section count and section string table section index in
15208         section header zero.
15209         (Output_file_header::do_sized_write): Check for overflow of
15210         section count and section string table section index.
15211         (Output_symtab_xindex::do_write): New function.
15212         (Output_symtab_xindex::endian_do_write): New function.
15213         * output.h (class Output_section_headers): Add shstrtab_section_.
15214         Update declarations.
15215         (class Output_symtab_xindex): Define.
15216         (Output_section::has_out_shndx): New function.
15217         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15218         field.
15219         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15220         Change all callers.
15221         (Sized_symbol::init): Likewise.
15222         (Symbol::output_section): Check for ordinary symbol.
15223         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15224         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15225         callers.
15226         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15227         Change all callers.  Simplify handling of symbols from sections
15228         not included in the link.
15229         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15230         distinction.
15231         (Weak_alias_sorter::operator()): Assert that symbols are
15232         ordinary.
15233         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15234         distinction.
15235         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15236         parameters.  Change all callers.
15237         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15238         symbol distinction.  Use SHN_XINDEX when needed.
15239         (Symbol_table::write_section_symbol): Add symtab_xindex
15240         parameter.  Change all callers.
15241         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15242         SHN_XINDEX when needed.
15243         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15244         declarations.
15245         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15246         (Symbol::is_defined): Check is_ordinary.
15247         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15248         (Symbol::is_absolute, Symbol::is_common): Likewise.
15249         (class Sized_symbol): Update declarations.
15250         (class Symbol_table): Update declarations.
15251         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15252         parameters.  Change all callers.
15253         (Sized_symbol::override): Likewise.
15254         (Symbol_table::override): Likewise.
15255         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15256         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15257         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15258         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15259         to be in an ordinary section.
15260         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15261         object and is_ordinary parameters.  Change all callers.
15262         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15263         Change all callers.  Don't add undefined or non-ordinary symbols
15264         to reloc_map_.
15265         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15266         Change all callers.
15267         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15268         declarations.
15269         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15270         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15271         (Sized_relobj::relocate_sections): Likewise.
15272         * target-reloc.h (scan_relocs): Adjust section symbol index.
15273         (scan_relocatable_relocs): Likewise.
15274         * i386.cc (Scan::local): Check for ordinary symbols.
15275         * sparc.cc (Scan::local): Likewise.
15276         * x86_64.cc (Scan::local): Likewise.
15277         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15278         to symbol_section_and_value.
15279         * testsuite/many_sections_test.cc: New file.
15280         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15281         (check_PROGRAMS): Add many_sections_test.
15282         (many_sections_test_SOURCES): Define.
15283         (many_sections_test_DEPENDENCIES): Define.
15284         (many_sections_test_LDFLAGS): Define.
15285         (BUILT_SOURCES): Add many_sections_define.h.
15286         (many_sections_define.h): New target.
15287         (BUILT_SOURCES): Add many_sections_check.h.
15288         (many_sections_check.h): New target.
15289         (check_PROGRAMS): Add many_sections_r_test.
15290         (many_sections_r_test_SOURCES): Define.
15291         (many_sections_r_test_DEPENDENCIES): Define.
15292         (many_sections_r_test_LDFLAGS): Define.
15293         (many_sections_r_test_LDADD): Define.
15294         (many_sections_r_test.o): New target.
15295         * testsuite/Makefile.in: Rebuild.
15296
15297 2008-04-17  Cary Coutant  <ccoutant@google.com>
15298
15299         * errors.cc (Errors::info): New function.
15300         (gold_info): New function.
15301         * errors.h (Errors::info): New function.
15302         * gold.h (gold_info): New function.
15303         * object.cc (Input_objects::add_object): Print trace output.
15304         * options.cc (options::parse_set): New function.
15305         (General_options::parse_wrap): Deleted.
15306         (General_options::General_options): Deleted initializer.
15307         * options.h (options::String_set): New typedef.
15308         (options::parse_set): New function.
15309         (DEFINE_set): New macro.
15310         (General_options::wrap): Changed to use DEFINE_set. Changed
15311         callers of any_wrap_symbols and is_wrap_symbol.
15312         (General_options::trace, General_options::trace_symbol):
15313         New options.
15314         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15315         (General_options::wrap_symbols_): Deleted.
15316         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15317
15318 2008-04-17  David S. Miller  <davem@davemloft.net>
15319
15320         * options.cc (General_options::parse_V): New function.
15321         * options.h: Add entries for -V and -Qy.
15322
15323 2008-04-17  Ian Lance Taylor  <iant@google.com>
15324
15325         * common.cc (Symbol_table::allocate_commons): Remove options
15326         parameter.  Change caller.
15327         (Symbol_table::do_allocate_commons): Remove options parameter.
15328         Change caller.  Just call do_allocate_commons_list twice.
15329         (Symbol_table::do_allocate_commons_list): New function, broken out
15330         of do_allocate_commons.
15331         * common.h (class Allocate_commons_task): Remove options_ field.
15332         Update constructor.
15333         * symtab.cc (Symbol_table::Symbol_table): Initialize
15334         tls_commons_.
15335         (Symbol_table::add_from_object): Put TLS common symbols on
15336         tls_commons_ list.
15337         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15338         which are IN_OUTPUT_DATA.
15339         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15340         allocate_commons and do_allocate_commons declarations.  Declare
15341         do_allocate_commons_list.
15342         * gold.cc (queue_middle_tasks): Update creation of
15343         Allocate_commons_task to not pass options.
15344         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15345         (TLS_TEST_C_FLAGS): New variable.
15346         (tls_test_c_pic.o): New target.
15347         (tls_test_shared.so): Link in tls_test_c_pic.o.
15348         (tls_test_c_pic_ie.o): New target.
15349         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15350         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15351         (tls_test_c.o): New target.
15352         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15353         (tls_pic_test_LDADD): Likewise.
15354         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15355         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15356         (tls_test_c_gnu2.o): New target.
15357         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15358         tls_test_c_gnu2.o.
15359         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15360         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15361         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15362         * testsuite/tls_test.cc: Include "config.h".
15363         (t_last): Call t11_last.
15364         * testsuite/tls_test.h (t11, t11_last): Declare.
15365         * testsuite/tls_test_c.c: New file.
15366         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15367         * configure.ac: Check for OpenMP support.
15368         * configure, config.in, Makefile.in: Rebuild.
15369         * testsuite/Makefile.in: Rebuild.
15370
15371 2008-04-16  Cary Coutant  <ccoutant@google.com>
15372
15373         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15374         (Target_i386::tls_base_symbol_defined_): New field.
15375         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15376         (Target_i386::Scan::global): Likewise.
15377         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15378         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15379         (Target_x86_64::tls_base_symbol_defined_): New field.
15380         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15381         (Target_x86_64::Scan::global): Likewise.
15382
15383 2008-04-16  Cary Coutant  <ccoutant@google.com>
15384
15385         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15386         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15387         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15388         building shared libraries.
15389         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15390         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15391         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15392         * testsuite/Makefile.in: Rebuild.
15393         * testsuite/weak_undef.h: New file.
15394         * testsuite/weak_undef_file1.cc: Add extra test cases.
15395         * testsuite/weak_undef_file2.cc: Likewise.
15396         * testsuite/weak_undef_test.cc: Likewise.
15397
15398 2008-04-16  David S. Miller  <davem@davemloft.net>
15399
15400         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15401         Add issued_non_pic_error_ field.  Declare check_non_pic.
15402         (Target_sparc::Scan::check_non_pic): New function.
15403         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15404         (Target_sparc::Scan::global): Likewise.
15405
15406         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15407         * configure: Rebuild.
15408
15409         * options.h (DEFINE_enable): New macro.
15410         (new_dtags): New enable option.
15411         (initfirst, interpose, loadfltr, nodefaultlib,
15412         nodelete, nodlopen, nodump): New -z options.
15413         * layout.cc (Layout:finish_dynamic_section): If new
15414         dtags enabled, emit DT_RUNPATH.  Also, emit a
15415         DT_FLAGS_1 containing any specified -z flags.
15416
15417 2008-04-16  Ian Lance Taylor  <iant@google.com>
15418
15419         * copy-relocs.cc: New file.
15420         * copy-relocs.h: New file.
15421         * reloc.cc: Remove Copy_relocs code.
15422         * reloc.h: Likewise.
15423         * reloc-types.h (struct Reloc_types) [both versions]: Add
15424         get_reloc_addend_noerror.
15425         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15426         variants of add_global which take an addend which must be zero.
15427         * i386.cc: Include "copy-relocs.h".
15428         (class Target_i386): Change type of copy_relocs_ to variable,
15429         update initializer.
15430         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15431         Change all callers.
15432         (Target_i386::do_finalize_sections): Change handling of
15433         copy_relocs_.
15434         * sparc.cc: Include "copy-relocs.h".
15435         (class Target_sparc): Change type of copy_relocs_ to variable,
15436         update initializer.
15437         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15438         Change all callers.
15439         (Target_sparc::do_finalize_sections): Change handling of
15440         copy_relocs_.
15441         * x86_64.cc: Include "copy-relocs.h".
15442         (class Target_x86_64): Change type of copy_relocs_ to variable,
15443         update initializer.
15444         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15445         class.  Change all callers.
15446         (Target_x86_64::do_finalize_sections): Change handling of
15447         copy_relocs_.
15448         * Makefile.am (CCFILES): Add copy-relocs.cc.
15449         (HFILES): Add copy-relocs.h.
15450
15451         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15452
15453         * testsuite/script_test_4.sh: Permit leading zeroes.
15454
15455 2008-04-15  Ian Lance Taylor  <iant@google.com>
15456
15457         * script-sections.cc (Script_sections::create_segments): Use
15458         header_size_adjustment even when there is enough room for the
15459         headers.
15460         * testsuite/script_test_4.sh: New file.
15461         * testsuite/script_test_4.t: New file.
15462         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15463         (check_DATA): Add script_test_4.stdout.
15464         (MOSTLYCLEANFILES): Likewise.
15465         (script_test_4): New target.
15466         (script_test_4.stdout): New target.
15467         * testsuite/Makefile.in: Rebuild.
15468
15469         * sparc.cc: Add definitions for Output_data_plt_sparc class
15470         constants.
15471
15472 2008-04-14  David S. Miller  <davem@davemloft.net>
15473
15474         * sparc.cc: New file.
15475         * Makefile.am (TARGETSOURCES): Add sparc.cc
15476         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15477         * configure.tgt: Document targ_extra_size and
15478         targ_extra_big_endian.  Add entries for sparc-* and
15479         sparc64-*.
15480         * configure.ac: Handle targ_extra_size and
15481         targ_extra_big_endian.
15482         * Makefile.in: Rebuild.
15483         * configure: Likewise.
15484         * po/POTFILES.in: Likewise.
15485         * po/gold.pot: Likewise.
15486
15487 2008-04-14  Ian Lance Taylor  <iant@google.com>
15488
15489         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15490         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15491         in the name/type/flags to section mapping.  Don't call
15492         allocate_output_section.
15493         (Layout::choose_output_section): Change parameter from adjust_name
15494         to is_input_section.  Don't permit input sections after sections
15495         are attached to segments.  Don't call allocate_output_section.
15496         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15497         not write_enable_output_section.
15498         (Layout::make_output_section): Don't push to
15499         unattached_section_list_ nor call attach_to_segment.  Call
15500         attach_section_to_segment if sections are attached.
15501         (Layout::attach_sections_to_segments): New function.
15502         (Layout::attach_section_to_segment): New function.
15503         (Layout::attach_allocated_section_to_segment): Rename from
15504         attach_to_segment.  Remove flags parameter.
15505         (Layout::allocate_output_section): Remove function.
15506         (Layout::write_enable_output_section): Remove function.
15507         * layout.h (class Layout): Update for above changes.  Add new
15508         field sections_are_attached_.
15509         * output.h (Output_section::update_flags_for_input_section): New
15510         function.
15511         * output.cc (Output_section::add_input_section): Call
15512         update_flags_for_input_section.
15513         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15514
15515 2008-04-11  Cary Coutant  <ccoutant@google.com>
15516
15517         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15518         thought unnecessary.
15519         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15520
15521 2008-04-11  Ian Lance Taylor  <iant@google.com>
15522
15523         * output.h (class Output_section_data): Remove inline definition
15524         of set_addralign.
15525         * output.cc (Output_section_data::set_addralign): New function.
15526
15527 2008-04-11  Cary Coutant  <ccoutant@google.com>
15528
15529         Add support for TLS descriptors for i386 and x86_64.
15530         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15531         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15532         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15533         GOT_TYPE_TLS_DESC.
15534         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15535         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15536         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15537         relocations.
15538         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15539         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15540         Fix problem with initial-exec relocations.
15541         (Target_i386::Relocate::relocate_tls): Likewise.
15542         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15543         relaxation.
15544         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15545         support for section-plus-offset dynamic table entries.
15546         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15547         (Output_data_dynamic::Dynamic_entry): Add support for
15548         section-plus-offset dynamic table entries.
15549         (Output_data_dynamic::Classification): Likewise.
15550         (Output_data_dynamic::classification_): Renamed offset_.
15551         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15552         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15553         (Target_x86_64::make_plt_section): New function.
15554         (Target_x86_64::reserve_tlsdesc_entries): New function.
15555         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15556         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15557         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15558         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15559         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15560         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15561         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15562         add extra PLT entry for TLS descriptors.
15563         (Output_data_plt_x86_64::got_): New field.
15564         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15565         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15566         fields.
15567         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15568         descriptors.
15569         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15570         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15571         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15572         R_386_TLS_DESC_CALL relocations.
15573         (Target_x86_64::Scan::global): Likewise.
15574         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15575         for TLS descriptors.
15576         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15577         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15578         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15579         GD-to-IE relaxation.
15580         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15581         and TLS_DESCRIPTORS.
15582         * Makefile.in: Rebuild.
15583         * configure: Rebuild.
15584         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15585         (tls_test_shared2.so): New target.
15586         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15587         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15588         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15589         (tls_shared_gd_to_ie_test_LDADD): New variable.
15590         (tls_shared_gnu2_gd_to_ie_test): New target.
15591         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15592         New targets.
15593         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15594         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15595         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15596         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15597         (tls_shared_gnu2_test): New target.
15598         (tls_test_gnu2_shared.so): New target.
15599         (tls_shared_gnu2_test_SOURCES): New variable.
15600         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15601         (tls_shared_gnu2_test_LDFLAGS): New variable.
15602         (tls_shared_gnu2_test_LDADD): New variable.
15603         * testsuite/Makefile.in: Rebuild.
15604         * testsuite/Makefile.
15605
15606 2008-04-11  Ian Lance Taylor  <iant@google.com>
15607
15608         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15609         justsyms.t.
15610         * testsuite/Makefile.in: Rebuild.
15611
15612         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15613         long.
15614         * testsuite/script_test_2.cc (main): Adjust test.
15615
15616 2008-04-11  David S. Miller  <davem@davemloft.net>
15617             Ian Lance Taylor  <iant@google.com>
15618
15619         * options.h (General_options): Add entries for '-Y' and
15620         '-relax'.
15621         * options.cc (General_options:finalize): If -Y was used, add those
15622         entries to the library path instead of the default "/lib" and
15623         "/usr/lib".
15624
15625 2008-04-11  David S. Miller  <davem@davemloft.net>
15626
15627         * testsuite/justsyms.t: Start at 0x100.
15628         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15629         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15630         long.
15631         * testsuite/script_test_2.cc: Adjust string and section length
15632         checks.
15633
15634 2008-04-09  Ian Lance Taylor  <iant@google.com>
15635
15636         PR gold/5996
15637         * script-sections.cc (Sections_element::allocate_to_segment): Add
15638         orphan parameter.
15639         (Output_section_definition::allocate_to_segment): Likewise.
15640         (Orphan_output_section::allocate_to_segment): Likewise.
15641         (Script_sections::attach_sections_using_phdrs_clause): Don't
15642         propagate non-PT_LOAD segments to orphan sections.
15643         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15644         readelf rather than objdump.
15645         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15646         .interp section and PT_INTERP segment are the same size.
15647         * testsuite/Makefile.in: Rebuild.
15648
15649         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15650         aliases for symbols defined in the same object.
15651         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15652         (weak_alias_test_SOURCES): New variable.
15653         (weak_alias_test_DEPENDENCIES): New variable.
15654         (weak_alias_test_LDFLAGS): New variable.
15655         (weak_alias_test_LDADD): New variable.
15656         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15657         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15658         (weak_alias_test_3.o): New target.
15659         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15660         * testsuite/weak_alias_test_main.cc: New file.
15661         * testsuite/weak_alias_test_1.cc: New file.
15662         * testsuite/weak_alias_test_2.cc: New file.
15663         * testsuite/weak_alias_test_3.cc: New file.
15664
15665 2008-04-08  Ian Lance Taylor  <iant@google.com>
15666
15667         * options.h (class General_options): Add --noinhibit-exec option.
15668         * main.cc (main): Check --noinhibit-exec.
15669
15670         * options.h (class General_options): Define --wrap as a special
15671         option.  Add wrap_symbols_ field.
15672         (General_options::any_wrap_symbols): New function.
15673         (General_options::is_wrap_symbol): New function.
15674         * options.cc (General_options::parse_wrap): New function.
15675         (General_options::General_options): Initialize wrap_symbols_.
15676         * symtab.cc (Symbol_table::wrap_symbol): New function.
15677         (Symbol_table::add_from_object): Handle --wrap.
15678         * symtab.h (class Symbol_table): Declare wrap_symbol.
15679         * target.h (Target::wrap_char): New function.
15680         (Target::Target_info): Add wrap_char field.
15681         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15682         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15683         * testsuite/testfile.cc (Target_test::test_target_info):
15684         Likewise.
15685
15686         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15687         there is one.
15688
15689         * layout.h (class Layout): Add added_eh_frame_data_ field.
15690         * layout.cc (Layout::Layout): Initialize new field.
15691         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15692         output section until we find a section we merged successfully.
15693         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15694         that the size be non-zero.
15695
15696         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15697         qualifier.
15698
15699 2008-04-08  Craig Silverstein  <csilvers@google.com>
15700
15701         * configure.ac: Export new conditional variable HAVE_ZLIB.
15702         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15703         on HAVE_ZLIB.
15704         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15705         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15706
15707 2008-04-07  Ian Lance Taylor  <iant@google.com>
15708
15709         * version.cc (version_string): Set to "1.5".
15710
15711         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15712         Add issued_non_pic_error_ field.  Declare check_non_pic.
15713         (Target_x86_64::Scan::check_non_pic): New function.
15714         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15715         (Target_x86_64::Scan::global): Likewise.
15716
15717         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15718         addend parameter.  Change caller.  Handle merge sections.
15719         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15720         Address to Addend.  Don't add in the result of
15721         local_section_offset, pass down the addend and use the returned
15722         value.
15723         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15724         Update declarations of local_section_offset and symbol_value.
15725         * testsuite/two_file_test_1.cc (t18): New function.
15726         * testsuite/two_file_test_2.cc (f18): New function.
15727         * testsuite/two_file_test_main.cc (main): Call t18.
15728         * testsuite/two_file_test.h (t18, f18): Declare.
15729
15730         * configure.ac: Don't test for objdump, c++filt, or readelf.
15731         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15732         conditionals.
15733         (TEST_READELF): New variable.
15734         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15735         (check_PROGRAMS): Add two_file_strip_test.
15736         (two_file_strip_test): New target.
15737         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15738         (two_file_same_shared_strip_test_SOURCES): New variable.
15739         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15740         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15741         (two_file_same_shared_strip_test_LDADD): New variable.
15742         (two_file_shared_strip.so): New target.
15743         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15744         (ver_test_5.syms, ver_test_7.syms): Likewise.
15745         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15746         (strip_test_3.stdout): Use TEST_OBJDUMP.
15747         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15748
15749 2008-04-04  Cary Coutant  <ccoutant@google.com>
15750
15751         * symtab.h (Symbol::is_weak_undefined): New function.
15752         (Symbol::is_strong_undefined): New function.
15753         (Symbol::is_absolute): New function.
15754         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15755         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15756         absolute symbols.
15757         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15758         (weak_undef_test): New target.
15759         * testsuite/Makefile.in: Rebuild.
15760         * testsuite/weak_undef_file1.cc: New file.
15761         * testsuite/weak_undef_file2.cc: New file.
15762         * testsuite/weak_undef_test.cc: New file.
15763
15764 2008-04-03  Craig Silverstein  <csilvers@google.com>
15765
15766         * compressed_output.h (class Output_compressed_section): Use
15767         unsigned buffer.
15768         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15769         add zlib header.
15770         (zlib_compressed_suffix): Removed.
15771         (Output_compressed_section::set_final_data_size): Use unsigned
15772         buffers.
15773         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15774         Fix linker invocation.
15775         (flagstest_o_specialfile_and_compress_debug_sections):
15776         Likewise.
15777         * testsuite/Makefile.in: Regenerated.
15778
15779 2008-04-02  David S. Miller  <davem@davemloft.net>
15780
15781         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15782         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15783
15784 2008-04-02  Craig Silverstein  <csilvers@google.com>
15785
15786         * TODO: New file.
15787
15788 2008-04-02  Ian Lance Taylor  <iant@google.com>
15789
15790         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15791         parameters.  Update for new key type to views_.  Change all
15792         callers.
15793         (File_read::read): Adjust for byteshift in returned view.
15794         (File_read::add_view): New function, broken out of
15795         find_and_make_view.
15796         (File_read::make_view): New function, broken out of
15797         find_and_make_view.
15798         (File_read::find_or_make_view): Add offset and aligned
15799         parameters.  Rewrite accordingly.  Change all callers.
15800         (File_read::get_view): Add offset and aligned parameters.  Adjust
15801         for byteshift in return value.
15802         (File_read::get_lasting_view): Likewise.
15803         * fileread.h (class File_read): Update declarations.
15804         (class File_read::View): Add byteshift_ field.  Add byteshift to
15805         constructor.  Add byteshift method.
15806         * archive.h (Archive::clear_uncached_views): New function.
15807         (Archive::get_view): Add aligned parameter.  Change all callers.
15808         * object.h (Object::get_view): Add aligned parameter.  Change all
15809         callers.
15810         (Object::get_lasting_view): Likewise.
15811
15812         * fileread.cc (File_read::release): Don't call clear_views if
15813         there are multiple objects.
15814         * fileread.h (File_read::clear_uncached_views): New function.
15815         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15816         on the archive.
15817
15818 2008-03-31  Cary Coutant  <ccoutant@google.com>
15819
15820         Add thin archive support.
15821         * archive.cc (Archive::armagt): New const.
15822         (Archive::setup): Remove task parameter and calls to unlock.
15823         (Archive::unlock_nested_archives): New function.
15824         (Archive::read_header): Add nested_off parameter. Change
15825         all callers.
15826         (Archive::interpret_header): Likewise.
15827         (Archive::include_all_members): Change to handle thin
15828         archives.
15829         (Archive::include_member): Likewise.
15830         * archive.h (Archive::Archive): Add new parameters and
15831         initializers.
15832         (Archive::armagt): New const.
15833         (Archive::setup): Remove task parameter.
15834         (Archive::unlock_nested_archives): New function.
15835         (Archive::read_header): Add nested_off parameter.
15836         (Archive::interpret_header): Likewise.
15837         (Archive::Nested_archive_table): New typedef.
15838         (Archive::is_thin_archive_): New field.
15839         (Archive::nested_archives_): New field.
15840         (Archive::options_): New field.
15841         (Archive::dirpath_): New field.
15842         (Archive::task_): New field.
15843         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15844         for thin archives.  Pass additional parameters to
15845         Archive::Archive.  Unlock the archive file after calling
15846         Archive::setup.
15847
15848 2008-03-29  Ian Lance Taylor  <iant@google.com>
15849
15850         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15851         version symbol to be local.
15852         * testsuite/ver_test_4.sh: New file.
15853         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15854         (check_DATA): Add ver_test_4.syms.
15855         (ver_test_4.syms): New target.
15856         * testsuite/Makefile.in: Rebuild.
15857
15858         * output.cc
15859         (Output_section::Input_section_sort_entry::has_priority): New
15860         function.
15861         (Output_section::Input_section_sort_entry::match_file_name): New
15862         function.
15863         (Output_section::Input_section_sort_entry::match_section_name):
15864         Remove.
15865         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15866         Remove.
15867         (Output_section::Input_section_sort_entry::match_section_file):
15868         Remove.
15869         (Output_section::Input_section_sort_compare::operator()): Rewrite
15870         using new Input_section_sort_entry functions.  Sort crtbegin and
15871         crtend first.  Sort sections with no priority before sections with
15872         a priority.
15873         * testsuite/initpri1.c (d3): Check j != 4.
15874         (cd5): New constructor/destructor function.
15875         (main): Check j != 2.
15876
15877         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15878         new symbol when resolving, don't call set_is_default.
15879         * testsuite/ver_test_7.cc: New file.
15880         * testsuite/ver_test_7.sh: New file.
15881         * testsuite/Makefile.am (ver_test_7.so): New target.
15882         (ver_test_7.o): New target.
15883         (check_SCRIPTS): Add ver_test_7.sh.
15884         (check_DATA): Add ver_test_7.syms.
15885         (ver_test_7.syms): New target.
15886
15887 2008-03-28  Ian Lance Taylor  <iant@google.com>
15888
15889         * layout.cc (Layout::layout): If we see an input section with a
15890         name that needs sorting, set the must_sort flag for the output
15891         section.
15892         (Layout::make_output_section): If the name of the output section
15893         indicates that it might require sorting, set the may_sort flag.
15894         * output.h (Output_section::may_sort_attached_input_sections): New
15895         function.
15896         (Output_section::set_may_sort_attached_input_sections): New
15897         function.
15898         (Output_section::must_sort_attached_input_sections): New
15899         function.
15900         (Output_section::set_must_sort_attached_input_sections): New
15901         function.
15902         (class Output_section): Declare Input_section_sort_entry.  Define
15903         Input_section_sort_compare.  Declare
15904         sort_attached_input_sections.  Add new fields:
15905         may_sort_attached_input_sections_,
15906         must_sort_attached_input_sections_,
15907         attached_input_sections_are_sorted_.
15908         * output.cc (Output_section::Output_section): Initialize new
15909         fields.
15910         (Output_section::add_input_section): Add an entry to
15911         input_sections_ if may_sort or must_sort are true.
15912         (Output_section::set_final_data_size): Call
15913         sort_attached_input_sections if necessary.
15914         (Output_section::Input_section_sort_entry): Define new class.
15915         (Output_section::Input_section_sort_compare::operator()): New
15916         function.
15917         (Output_section::sort_attached_input_sections): New function.
15918         * configure.ac: Check whether the compiler supports constructor
15919         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15920         * testsuite/initpri1.c: New file.
15921         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15922         CONSTRUCTOR_PRIORITY.
15923         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15924         (initpri1_LDFLAGS): New variable.
15925         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15926
15927 2008-03-27  Ian Lance Taylor  <iant@google.com>
15928
15929         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15930         * testsuite/common_test_1.c: New file.
15931         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15932         (common_test_1_SOURCES): New variable.
15933         (common_test_1_DEPENDENCIES): New variable.
15934         (common_test_1_LDFLAGS): New variable.
15935
15936         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15937         and commons_ correctly when NAME/VERSION does not override
15938         NAME/NULL.
15939         * testsuite/ver_test_6.c: New file.
15940         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15941         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15942         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15943
15944 2008-03-26  Ian Lance Taylor  <iant@google.com>
15945
15946         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15947         of an undefined symbol from a version script.
15948         * testsuite/Makefile.am (ver_test_5.so): New target.
15949         (ver_test_5.o): New target.
15950         (check_SCRIPTS): Add ver_test_5.sh.
15951         (check_DATA): Add ver_test_5.syms.
15952         (ver_test_5.syms): New target.
15953         * testsuite/ver_test_5.cc: New file.
15954         * testsuite/ver_test_5.script: New file.
15955         * testsuite/ver_test_5.sh: New file.
15956         * Makefile.in, testsuite/Makefile.in: Rebuild.
15957
15958         PR gold/5986
15959         Fix problems building gold with gcc 4.3.0.
15960         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15961         (gold_error_at_location, gold_warning_at_location): Use it.
15962         * configure.ac: Check whether we can compile and use a template
15963         function with a printf attribute.
15964         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15965         when jumping over bytes.
15966         * object.cc: Instantiate Object::read_section_data.
15967         * debug.h: Include <cstring>
15968         * dwarf_reader.cc: Include <algorithm>
15969         * main.cc: Include <cstring>.
15970         * options.cc: Include <cstring>.
15971         * output.cc: Include <cstring>.
15972         * script.cc: Include <cstring>.
15973         * script.h: Include <string>.
15974         * symtab.cc: Include <cstring> and <algorithm>.
15975         * target-select.cc: Include <cstring>.
15976         * version.cc: Include <string>.
15977         * testsuite/testmain.cc: Include <cstdlib>.
15978         * configure, config.in: Rebuild.
15979
15980 2008-03-25  Ian Lance Taylor  <iant@google.com>
15981
15982         * options.cc: Include "../bfd/bfdver.h".
15983         (options::help): Print bug reporting address.
15984
15985         * version.cc (print_version): Adjust output for current value of
15986         BFD_VERSION_STRING.
15987
15988         * NEWS: New file.
15989
15990         * options.cc (options::help): Print list of supported targets.
15991         * target-select.h: Include <vector>.
15992         (class Target_selector): Make machine_, size_, and is_big_endian_
15993         fields const.  Add bfd_name_ and instantiated_target_ fields.
15994         (Target_selector::Target_selector): Add bfd_name parameter.
15995         (Target_selector::recognize): Make non-virtual, call
15996         do_recognize.
15997         (Target_selector::recognize_by_name): Make non-virtual, call
15998         do_recognize_by_name.
15999         (Target_selector::supported_names): New function.
16000         (Target_selector::bfd_name): New function.
16001         (Target_selector::do_instantiate_target): New pure virtual
16002         function.
16003         (Target_selector::do_recognize): New virtual function.
16004         (Target_selector::do_recognize_by_name): New virtual function.
16005         (Target_selector::instantiate_target): New private function.
16006         (supported_target_names): Declare.
16007         * target-select.cc (Target_selector::Target_selector): Update for
16008         new parameter and fields.
16009         (select_target_by_name): Check that the name matches before
16010         calling recognize_by_name.
16011         (supported_target_names): New function.
16012         * i386.cc (class Target_selector_i386): Update Target_selector
16013         constructor call.  Remove recognize and recognize_by_name.  Add
16014         do_instantiate_target.
16015         * x86_64.cc (class Target_selector_x86_64): Likewise.
16016         * testsuite/testfile.cc (class Target_selector_test): Update for
16017         changes to Target_selector.
16018
16019         * README: Rewrite, with some notes on unsupported features.
16020
16021 2008-03-24  Cary Coutant  <ccoutant@google.com>
16022
16023         * i386.cc (Target_i386::Got_type): New enum declaration.
16024         (Target_i386::Scan::local): Updated callers of Output_data_got
16025         member functions.
16026         (Target_i386::Scan::global): Likewise.
16027         (Target_i386::Relocate::relocate): Likewise.
16028         (Target_i386::Relocate::relocate_tls): Likewise.
16029         * object.h (Got_offset_list): New class.
16030         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16031         (Sized_relobj::local_got_offset): Likewise.
16032         (Sized_relobj::set_local_got_offset): Likewise.
16033         (Sized_relobj::local_has_tls_got_offset): Removed.
16034         (Sized_relobj::local_tls_got_offset): Removed.
16035         (Sized_relobj::set_local_tls_got_offset): Removed.
16036         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16037         * output.cc (Output_data_got::add_global): Added got_type parameter.
16038         (Output_data_got::add_global_with_rel): Likewise.
16039         (Output_data_got::add_global_with_rela): Likewise.
16040         (Output_data_got::add_global_pair_with_rel): New function.
16041         (Output_data_got::add_global_pair_with_rela): New function.
16042         (Output_data_got::add_local): Added got_type parameter.
16043         (Output_data_got::add_local_with_rel): Likewise.
16044         (Output_data_got::add_local_with_rela): Likewise.
16045         (Output_data_got::add_local_pair_with_rel): New function.
16046         (Output_data_got::add_local_pair_with_rela): New function.
16047         (Output_data_got::add_global_tls): Removed.
16048         (Output_data_got::add_global_tls_with_rel): Removed.
16049         (Output_data_got::add_global_tls_with_rela): Removed.
16050         (Output_data_got::add_local_tls): Removed.
16051         (Output_data_got::add_local_tls_with_rel): Removed.
16052         (Output_data_got::add_local_tls_with_rela): Removed.
16053         * output.h (Output_data_got::add_global): Added got_type parameter.
16054         (Output_data_got::add_global_with_rel): Likewise.
16055         (Output_data_got::add_global_with_rela): Likewise.
16056         (Output_data_got::add_global_pair_with_rel): New function.
16057         (Output_data_got::add_global_pair_with_rela): New function.
16058         (Output_data_got::add_local): Added got_type parameter.
16059         (Output_data_got::add_local_with_rel): Likewise.
16060         (Output_data_got::add_local_with_rela): Likewise.
16061         (Output_data_got::add_local_pair_with_rel): New function.
16062         (Output_data_got::add_local_pair_with_rela): New function.
16063         (Output_data_got::add_global_tls): Removed.
16064         (Output_data_got::add_global_tls_with_rel): Removed.
16065         (Output_data_got::add_global_tls_with_rela): Removed.
16066         (Output_data_got::add_local_tls): Removed.
16067         (Output_data_got::add_local_tls_with_rel): Removed.
16068         (Output_data_got::add_local_tls_with_rela): Removed.
16069         * resolve.cc (Symbol::override_base_with_special): Removed
16070         reference to has_got_offset_ field.
16071         * symtab.cc (Symbol::init_fields): Replaced initialization
16072         of got_offset_ with got_offsets_.  Removed initialization
16073         of has_got_offset_
16074         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16075         (Symbol::got_offset): Likewise.
16076         (Symbol::set_got_offset): Likewise.
16077         (Symbol::has_tls_got_offset): Removed.
16078         (Symbol::tls_got_offset): Removed.
16079         (Symbol::set_tls_got_offset): Removed.
16080         (Symbol::got_offset_): Removed.
16081         (Symbol::tls_mod_got_offset_): Removed.
16082         (Symbol::tls_pair_got_offset_): Removed.
16083         (Symbol::got_offsets_): New field.
16084         (Symbol::has_got_offset): Removed.
16085         (Symbol::has_tls_mod_got_offset): Removed.
16086         (Symbol::has_tls_pair_got_offset): Removed.
16087         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16088         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16089         member functions.
16090         (Target_x86_64::Scan::global): Likewise.
16091         (Target_x86_64::Relocate::relocate): Likewise.
16092         (Target_x86_64::Relocate::relocate_tls): Likewise.
16093
16094 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16095
16096         * yyscript.y: Fix spelling error in comment.
16097
16098 2008-03-24  Ian Lance Taylor  <iant@google.com>
16099
16100         * options.h (class General_options): Define build_id option.
16101         * layout.h (class Layout): Declare write_build_id, create_note,
16102         create_build_id.  Add build_id_note_ member.
16103         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16104         "libiberty.h", "md5.h", "sha1.h".
16105         (Layout::Layout): Initialize eh_frame_data_,
16106         eh_frame_hdr_section_, and build_id_note_.
16107         (Layout::finalize): Call create_build_id.
16108         (Layout::create_note): New function, broken out of
16109         Layout::create_gold_note.
16110         (Layout::create_gold_note): Call create_note.
16111         (Layout::create_build_id): New function.
16112         (Layout::write_build_id): New function.
16113         (Close_task_runner::run): Call write_build_id.
16114
16115         * x86_64.cc: Correct license to GPLv3.
16116
16117 2008-03-23  Ian Lance Taylor  <iant@google.com>
16118
16119         * options.cc: Include "demangle.h".
16120         (parse_optional_string): New function.
16121         (parse_long_option): Handle takes_optional_argument.
16122         (parse_short_option): Update dash_z initializer.  Handle
16123         takes_optional_argument.
16124         (General_options::General_options): Initialize do_demangle_.
16125         (General_options::finalize): Set do_demangle_.  Handle demangling
16126         style.
16127         * options.h (parse_optional_string): Declare.
16128         (struct One_option): Add optional_arg field.  Update constructor.
16129         Update call constructor calls.  Add takes_optional_argument
16130         function.
16131         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16132         (DEFINE_optional_string): Define.
16133         (General_options::demangle): Change from DEFINE_bool to
16134         DEFINE_optional_string.
16135         (General_options::no_demangle): New function.
16136         (General_options::do_demangle): New function.
16137         (General_options::set_do_demangle): New function.
16138         (General_options::execstack_status_): Move definition to end of
16139         class definition.
16140         (General_options::static_): Likewise.
16141         (General_options::do_demangle_): New field.
16142         * object.cc (big_endian>::get_symbol_location_info): Call
16143         Options::do_demangle, not Options::demangle.
16144         * symtab.cc (demangle): Likewise.
16145
16146 2008-03-22  Ian Lance Taylor  <iant@google.com>
16147
16148         * gold.h: Include <cstddef> and <sys/types.h>
16149         * options.h: Include <cstring>.
16150
16151 2008-03-21  Ian Lance Taylor  <iant@google.com>
16152
16153         * Added source code to GNU binutils.
16154 \f
16155 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16156
16157 Copying and distribution of this file, with or without modification,
16158 are permitted in any medium without royalty provided the copyright
16159 notice and this notice are preserved.
16160
16161 Local Variables:
16162 mode: change-log
16163 left-margin: 8
16164 fill-column: 74
16165 version-control: never
16166 End: