Fix problem where TLS common symbols are not allocated properly during LTO.
[external/binutils.git] / gold / ChangeLog
1 2014-09-25  Cary Coutant  <ccoutant@google.com>
2
3         PR gold/17432
4         * resolve.cc (Symbol_table::resolve): Override common placeholder
5         symbols, but adjust sizes.
6         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
7         symbols to common lists.
8
9 2014-09-24  Alan Modra  <amodra@gmail.com>
10
11         * po/POTFILES.in: Regenerate.
12
13 2014-09-23  Taiju Tsuiki  <tzik@google.com>
14             Cary Coutant  <ccoutant@google.com>
15
16         PR gold/14860
17         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
18         on input_sections_blocker.
19         * layout.cc (Write_sections_task::locks): Unblock
20         input_sections_blocker_.
21         * layout.h (Write_sections_task::Write_sections_task): Add
22         input_sections_blocker.
23         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
24         to DEPENDENCIES.
25         * testsuite/Makefile.in: Regenerate.
26
27 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
28
29         * testsuite/Makefile.am (plugin_test_10): New test.
30         * testsuite/Makefile.in: Regenerate
31         * testsuite/plugin_common_test_2.c (c1): Align to 8.
32         * testsuite/plugin_test_10.sh: New file.
33
34 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
35
36         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
37         * resolve.cc (Symbol_table::resolve): Don't override common symbols
38         during the replacement phase.
39
40 2014-09-17  Han Shen  <shenhan@google.com>
41             Jing Yu  <jingyu@google.com>
42
43         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
44         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
45         * aarch64.cc (Target_aarch64): Add data members
46         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
47         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
48         constructor.
49         (Target_aarch64::do_reloc_symbol_index): New method.
50         (Target_aarch64::do_reloc_addend): New method.
51         (Target_aarch64::add_tlsdesc_info): New method.
52         (Target_aarch64::do_dynsym_value): New method.
53         (Target_aarch64::do_make_data_plt): Add new parameters: got,
54         got_irelative. Pass them to Output_data_plt_aarch64_standard.
55         (Target_aarch64::make_data_plt): Add new parameters: got,
56         got_irelative. Pass them to do_make_data_plt.
57         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
58         (Target_aarch64::Relocate:tls_gd_to_le): New method.
59         (Target_aarch64::Relocate:tls_ie_to_le): New method.
60         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
61         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
62         (Target_aarch64::got_tlsdesc_section): New method.
63         (Target_aarch64::make_local_ifunc_plt_entry): New method.
64         (Target_aarch64::define_tls_base_symbol): New method.
65         (Target_aarch64::reserve_tlsdesc_entries): New method.
66         (Target_aarch64::got_mod_index_entry): New method.
67         (Target_aarch64::rela_tlsdesc_section): New method.
68         (Target_aarch64::rela_irelative_section): New method.
69         (Target_aarch64::Tlsdesc_info): New struct.
70         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
71         relocations and tlsdesc relocations.
72         (Target_aarch64::optimize_tls_reloc): Implement method.
73         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
74         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
75         in constructor.
76         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
77         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
78         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
79         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
80         (Output_data_plt_aarch64::rela_tlsdesc): New method.
81         (Output_data_plt_aarch64::rela_irelative): New method.
82         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
83         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
84         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
85         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
86         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
87         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
88         (Output_data_plt_aarch64_standard): New member variables:
89         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
90         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
91         New parameter: got, got_irelative.
92         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
93         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
94         (Output_data_plt_aarch64::do_write): Replace got_address with
95         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
96         (AArch64_relocate_functions::update_movnz): New method.
97         (AArch64_relocate_functions): Correct format.
98         (AArch64_relocate_functions::movnz): New method.
99         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
100         before the switch. Add new cases to switch.
101         Check ie_to_le relaxation on tlsie relocations. Add code handling
102         tlsgd tlsdesc cases.
103         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
104         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
105         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
106         Call reloc_name_in_error_message to print unsupported reloc.
107         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
108         make_data_plt.
109         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
110         relocs. Fill in some more dynamic tags.
111         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
112         Skip call tls_get_addr when tlsgd is relaxed.
113         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
114         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
115         tlsdesc->ie relaxation.
116
117 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
118
119         * mips.cc (Target_mips_nacl): New class.
120         (Target_selector_mips_nacl): New class.
121         (target_selector_mips32): Rename from target_selector_mips32be and use
122         Target_selector_mips_nacl instead of Target_selector_mips.
123         (target_selector_mips32el): Rename from target_selector_mips32 and use
124         Target_selector_mips_nacl instead of Target_selector_mips.
125         (target_selector_mips64): Rename from target_selector_mips64be and use
126         Target_selector_mips_nacl instead of Target_selector_mips.
127         (target_selector_mips64el): Rename from target_selector_mips64 and use
128         Target_selector_mips_nacl instead of Target_selector_mips.
129         (Target_mips::mips_info): Add const attribute.
130
131 2014-09-02  Cary Coutant  <ccoutant@google.com>
132
133         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
134         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
135         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
136         (Sized_incr_dynobj::do_section_name): Likewise.
137         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
138         (Sized_incr_dynobj::do_section_name): Likewise.
139         * object.h (Object::section_name): Likewise.
140         (Object::do_section_name): Likewise.
141         (Sized_relobj_file::do_section_name): Likewise.
142         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
143         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
144
145 2014-09-02  Cary Coutant  <ccoutant@google.com>
146
147         PR gold/17005
148         * ehframe.cc (Fde::write): Add output_offset parameter.
149         (Cie::write): Likewise.
150         (Eh_frame::set_final_data_size): Account for offset within output
151         section.
152         (Eh_frame::do_sized_write): Likewise.
153         * ehframe.h (Fde::write): Add output_offset parameter.
154         (Cie::write): Likewise.
155         * output.cc (Output_section::Input_section_sort_entry): Remove
156         section_has_name_; add output_section_name parameter. Use
157         output section name for non-input sections.
158         (Output_section::Input_section_sort_entry::section_has_name): Remove.
159         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
160         (Output_section::Input_section_sort_compare): Remove logic for
161         sections without names.
162         (Output_section::Input_section_sort_init_fini_compare): Likewise.
163         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
164         Likewise.
165         (Output_section::Input_section_sort_section_name_compare): Likewise.
166
167 2014-08-29 Han Shen <shenhan@google.com>
168            Jing Yu <jingyu@google.com>
169
170         * aarch64-reloc-property.cc
171         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
172         reference reloc property in the table.
173         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
174         3 other entries.
175         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
176         2 new overloaded methods.
177         (Output_data_got_aarch64::do_write): Add code to write out
178         static relocs.
179         (class Output_data_got_aarch64::Static_reloc): New class to wrap
180         static relocs.
181         (Output_data_got_aarch64::static_relocs): New vector to
182         hold static relocs.
183         (Target_aarch64::TCB_SIZE): New const static memeber.
184         (Target_aarch64::tcb_size): New method.
185         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
186         (Target_aarch64::Relocate::relocate_tls): New method.
187         (Target_aarch64::Scan::local): Add code handling new reloc types.
188         (Target_aarch64::Scan::global): Add code handling new reloc types.
189
190 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
191
192         * options.h (-no-pie): Add option.
193
194 2014-08-08  Jing Yu  <jingyu@google.com>
195             Han Shen  <shenhan@google.com>
196
197         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
198         (DEFFILES): add aarch64-reloc.def.
199         (TARGETSOURCES): Add aarch64-reloc-property.cc.
200         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
201         * Makefile.in: Regenerate.
202         * aarch64-reloc-property.cc: New file.
203         * aarch64-reloc-property.h: New file.
204         * aarch64-reloc.def: New file.
205         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
206         with tab to make the format consistent.
207         (Output_data_got_aarch64::symbol_table_): New method.
208         (Target_aarch64::do_plt_address_for_global): New method.
209         (Target_aarch64::do_plt_address_for_local): New method.
210         (Target_aarch64::do_select_as_default_target): New method.
211         (Target_aarch64::do_make_data_plt): New method.
212         (Target_aarch64::make_data_plt): New method.
213         (Output_data_plt_aarch64::has_irelative_section): New method.
214         (Output_data_plt_aarch64::address_for_global): New method.
215         (Output_data_plt_aarch64::address_for_local): New method.
216         (Output_data_plt_aarch64::irelative_rel_): New parameter.
217         (Output_data_plt_aarch64::add_entry): Implement contents.
218         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
219         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
220         the got_pov entry to plt0.
221         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
222         Implement contents.
223         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
224         (AArch64_howto): New struct.
225         (aarch64_howto[]): New static const array.
226         (AArch64_relocate_functions): New class.
227         (Target_aarch64::Scan::get_reference_flags): Remove method.
228         (Target_aarch64::Scan::local): Implement to support a few relocations.
229         (Target_aarch64::Scan::global): Implement to support a few relocations.
230         (Target_aarch64::make_plt_section): Implement contents.
231         (Target_aarch64::make_plt_entry): Implement contents.
232         (Target_aarch64::do_finalize_sections): Implement contents.
233         (Target_aarch64::Relocate::relocate): Implement a few relocations.
234         (Target_aarch64::relocate_section): Implement contents.
235
236 2014-08-06  Alan Modra  <amodra@gmail.com>
237
238         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
239
240 2014-08-06  Alan Modra  <amodra@gmail.com>
241
242         PR 13227
243         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
244
245 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
246
247         * object.cc (Relobj::is_section_name_included): Add
248         ".rodata.nptl_version" to not garbage collect this section.
249
250 2014-07-08  Cary Coutant  <ccoutant@google.com>
251
252         * expression.cc (struct Expression::Expression_eval_info): Add
253         new fields type_pointer, vis_pointer, and nonvis_pointer.
254         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
255         nonvis_pointer parameters. Adjust all calls.
256         (Symbol_expression::value): Update type, visibility, and nonvis bits
257         in caller.
258         * script.cc (Symbol_assignment::sized_finalize): Update type,
259         visibility, and remaining st_other bits for new symbol.
260         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
261         vis_pointer, and nonvis_pointer parameters.
262         * symtab.h (Symbol::set_type): New method.
263
264         * testsuite/Makefile.am (defsym_test): New test.
265         * testsuite/Makefile.in: Regenerate.
266         * testsuite/defsym_test.c: New file.
267         * testsuite/defsym_test.sh: New file.
268
269 2014-07-08  Cary Coutant  <ccoutant@google.com>
270
271         PR gold/15639
272         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
273         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
274         (Sized_dynobj::base_read_symbols): ...new method.
275         * object.h (Sized_relobj_file::base_read_symbols): New method.
276         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
277         (Sized_relobj_file::base_read_symbols): ...new method.
278         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
279         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
280         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
281
282 2014-07-04  Alan Modra  <amodra@gmail.com>
283
284         * po/POTFILES.in: Regenerate.
285
286 2014-07-02  Jing Yu  <jingyu@google.com>
287
288         * aarch64.cc: New file
289         * Makefile.am (TARGETSOURCES): Add aarch64.cc
290         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
291         * Makefile.in: Regenerate.
292         * configure.tgt: Add entries for aarch64*.
293         * configure.ac:  Likewise.
294         * configure: Likewise.
295
296 2014-06-27  Alan Modra  <amodra@gmail.com>
297
298         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
299
300 2014-06-24  Cary Coutant  <ccoutant@google.com>
301
302         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
303         sections.
304         (Dwo_file::sized_read_unit_index): Likewise.
305
306 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
307
308         * mips.cc: New file.
309         * Makefile.am (TARGETSOURCES): Add mips.cc
310         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
311         * configure.tgt: Add entries for mips*.
312         * configure.ac: Likewise.
313         * Makefile.in: Regenerate.
314         * configure: Likewise.
315
316 2014-06-09  Cary Coutant  <ccoutant@google.com>
317
318         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
319         unit_length is within section bounds.
320
321 2014-06-09  Cary Coutant  <ccoutant@google.com>
322
323         PR gold/16980
324         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
325         map.
326
327 2014-06-07  Alan Modra  <amodra@gmail.com>
328
329         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
330
331 2014-06-06  Cary Coutant  <ccoutant@google.com>
332
333         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
334         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
335         (Dwarf_pubnames_table::read_header): Likewise.
336         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
337         .debug_gnu_pubtypes.
338
339 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
340
341         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
342         * Makefile.in, configure: Regenerate.
343
344 2014-06-03  Alan Modra  <amodra@gmail.com>
345
346         * powerpc.cc (addis_12_2): Define.
347         (Stub_table::do_write): Support fusion on ELFv2 stubs.
348
349 2014-06-03  Alan Modra  <amodra@gmail.com>
350
351         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
352         st_other output.
353
354 2014-06-02  Alan Modra  <amodra@gmail.com>
355
356         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
357         Only ignore relocs on ELFv1.
358         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
359
360 2014-05-30  Cary Coutant  <ccoutant@google.com>
361
362         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
363         * testsuite/Makefile.in: Regenerate.
364         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
365
366 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
367
368         PR gold/16945
369         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
370         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
371
372 2014-05-15  Alan Modra  <amodra@gmail.com>
373
374         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
375         Compare FDE contents with DW_CFA_nop rather than 0.
376
377 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
378
379         * symtab.h (may_need_copy_reloc): Remove check for position independent
380         code.
381         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
382         position independence before pc absolute may_need_copy_reloc call.
383         Add check for executable output befor pc relative may_need_copy_reloc
384         call.
385         * i386.cc: Ditto.
386         * arm.cc: Ditto.
387         * sparc.cc: Ditto.
388         * tilegx.cc: Ditto.
389         * powerpc.cc: Add check for no position independence before
390         may_need_copy_reloc calls.
391         * testsuite/pie_copyrelocs_test.cc: New file.
392         * testsuite/pie_copyrelocs_shared_test.cc: New file.
393         * Makefile.am (pie_copyrelocs_test): New test.
394         * Makefile.in: Regenerate.
395
396 2014-05-08  Martin Liška  <mliska@suse.cz>
397
398         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
399
400 2014-05-06  Cary Coutant  <ccoutant@google.com>
401
402         PR gold/16900
403         * i386.cc (Output_data_got_plt_i386): New class.
404         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
405         parameter. Change all callers.
406         (Output_data_plt_i386::layout_): Remove.
407         (Output_data_plt_i386::got_plt_): Change type.
408         (Target_i386::got_plt_): Change type. Change all references.
409         (Target_i386::got_section): Create instance of new class.
410         (Output_data_got_plt_i386::do_write): New function.
411         * x86_64.cc (Output_data_got_plt_x86_64): New class.
412         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
413         parameter. Change all callers.
414         (Output_data_plt_x86_64::layout_): Remove.
415         (Output_data_plt_x86_64::got_plt_): Change type.
416         (Target_x86_64::got_plt_): Change type. Change all references.
417         (Target_x86_64::got_section): Create instance of new class.
418         (Output_data_got_plt_x86_64::do_write): New function.
419         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
420         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
421         class.
422
423 2014-05-05  Cary Coutant  <ccoutant@google.com>
424
425         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
426         if we have pubnames/pubtypes.
427
428 2014-05-02  Cary Coutant  <ccoutant@google.com>
429
430         * defstd.cc (in_segment): Define __ehdr_start here...
431         * layout.cc (Layout::finalize): ...Instead of here.  Set the
432         output segment when known.
433         * resolve.cc (Symbol::override_base_with_special): Remember
434         the original binding.
435         * symtab.cc (Symbol::set_output_segment): New function.
436         (Symbol::set_undefined): New function.
437         * symtab.h (Symbol::is_weak_undefined): Check original undef
438         binding.
439         (Symbol::is_strong_undefined): New function.
440         (Symbol::set_output_segment): New function.
441         (Symbol::set_undefined): New function.
442         * target-reloc.h (is_strong_undefined): Remove.
443         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
444         Check for hidden undefs.
445         (relocate_section): Call Symbol::is_strong_undefined.
446
447         * testsuite/Makefile.am (ehdr_start_test_1)
448         (ehdr_start_test_2, ehdr_start_test_3)
449         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
450         * testsuite/Makefile.in: Regenerate.
451         * testsuite/ehdr_start_def.cc: New source file.
452         * testsuite/ehdr_start_test.cc: New source file.
453         * testsuite/ehdr_start_test.t: New linker script.
454         * testsuite/ehdr_start_test_4.sh: New shell script.
455
456 2014-04-23  Cary Coutant  <ccoutant@google.com>
457
458         PR gold/16870
459         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
460
461 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
462
463         * layout.cc (Layout::include_section): Allow a target to decide
464         whether to include a section.
465         * target.h (Target::should_include_section): New function.
466         (Target::do_should_include_section): New function.
467
468 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
469
470         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
471         inline into ...
472         (Copy_relocs::emit): ... here.
473         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
474         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
475         (Copy_reloc_entry::entries_): Change from private to protected.
476
477 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
478
479         * icf.cc (get_section_contents): Replace copies of reloc
480         vectors with const references.
481
482 2014-04-02  Cary Coutant  <ccoutant@google.com>
483
484         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
485         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
486         * configure: Regenerate.
487         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
488         -fno-use-linker-plugin.
489         (LINK1, CXXLINK1): Add it to the link command.
490         * testsuite/Makefile.in: Regenerate.
491
492 2014-03-12  Alan Modra  <amodra@gmail.com>
493
494         * Makefile.in: Regenerate.
495
496 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
497
498         * symtab.h (Symbol::set_nonvis): New function.
499
500 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
501
502         * symtab.cc (Sized_symbol<32>::init_output_data):
503         Instantiate the template.
504         (Sized_symbol<64>::init_output_data): Likewise.
505
506 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
507
508         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
509         adjust dynamic symbol value.
510         * target.h (Target::adjust_dyn_symbol): New function.
511         (Target::do_adjust_dyn_symbol): New function.
512
513 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
514
515         * output.cc (Output_data_dynamic::Dynamic_entry::write):
516         Get the value of DYNAMIC_CUSTOM dynamic entry.
517         * output.h (Output_data_dynamic::add_custom): New function.
518         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
519         dynamic entry.
520         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
521         * target.h (Target::dynamic_tag_custom_value): New function.
522         (Target::do_dynamic_tag_custom_value): New function.
523
524 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
525
526         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
527         dynsym indexes.
528         * target.h (Target::has_custom_set_dynsym_indexes): New function.
529         (Target::do_has_custom_set_dynsym_indexes): New function.
530         (Target::set_dynsym_indexes): New function.
531         (Target::do_set_dynsym_indexes): New function.
532
533 2014-03-07  Alan Modra  <amodra@gmail.com>
534
535         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
536         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
537         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
538         (Powerpc_relocate_functions::has_overflow_bitfield,
539         overflowed): Use the above.
540         (Target_powerpc::Relocate::relocate): Correct overflow checking
541         for a number of relocations.  Modify overflow test for 16-bit
542         fields in instructions to signed/unsigned according to whether
543         the field takes a signed or unsigned value.
544
545 2014-03-05  Alan Modra  <amodra@gmail.com>
546
547         Update copyright years.
548
549 2014-03-05  Alan Modra  <amodra@gmail.com>
550
551         * powerpc.cc (Target_powerpc::Scan::local, global): Support
552         R_PPC64_ADDR64_LOCAL.
553         (Target_powerpc::Relocate::relocate): Likewise.
554
555 2014-03-03  Alan Modra  <amodra@gmail.com>
556
557         * dwp.cc (print_version): Update copyright year to current.
558
559 2014-02-10  Alan Modra  <amodra@gmail.com>
560
561         * po/gold.pot: Regenerate.
562
563 2014-02-06  Cary Coutant  <ccoutant@google.com>
564
565         Fix problem where -u is ignored when a weak undef is seen.
566
567         * archive.cc (Library_base::should_include_member): Reorder
568         code to check for -u option if a weak undef has already been seen.
569         * testsuite/Makefile.am (weak_undef_test_2): New test case.
570         * testsuite/Makefile.in: Regenerate.
571         * testsuite/weak_undef_file3.cc: New file.
572         * testsuite/weak_undef_file4.cc: New file.
573         * testsuite/weak_undef_test_2.cc: New file.
574
575 2014-02-05  Cary Coutant  <ccoutant@google.com>
576
577         Fix issues with gold undefined symbol diagnostics.
578
579         PR binutils/15435
580         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
581         check to here.
582         * target-reloc.h (is_strong_undefined): New function.
583         (relocate_section): Move undef vtable symbol check from here.
584         Check for is_strong_undefined.
585
586 2014-02-05  Cary Coutant  <ccoutant@google.com>
587
588         Fix problems with the --dynamic-list option.
589
590         PR gold/13577
591         * options.cc (General_options::parse_dynamic_list):
592         Set have_dynamic_list_.
593         (General_options::General_options): Initialize have_dynamic_list_.
594         (General_options::finalize): Turn off -Bsymbolic and
595         -Bsymbolic-functions if --dynamic-list provided.
596         * options.h (General_options::have_dynamic_list): New function.
597         (General_options::have_dynamic_list_): New data member.
598         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
599         correctly.
600
601         PR gold/16530
602         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
603         in --dynamic-list, mark it.
604
605         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
606         (dynamic_list_2): New test case.
607         * testsuite/Makefile.in: Regenerate.
608         * testsuite/dynamic_list_2.cc: New file.
609         * testsuite/dynamic_list_2.t: New file.
610         * testsuite/dynamic_list_lib1.cc: New file.
611         * testsuite/dynamic_list_lib2.cc: New file.
612         * testsuite/gc_dynamic_list_test.c: New file.
613         * testsuite/gc_dynamic_list_test.sh: New file.
614         * testsuite/gc_dynamic_list_test.t: New file.
615
616 2014-01-28  Cary Coutant  <ccoutant@google.com>
617
618         Add .gdb_index version 7 support.
619
620         * gold/dwarf_reader.cc: include <utility> (for make_pair).
621         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
622         debug sections.
623         (Dwarf_ranges_table::read_ranges_table): Likewise.
624         (Dwarf_pubnames_table::read_section): Check for GNU-style
625         sections, and for compressed debug sections.
626         (Dwarf_pubnames_table::read_header): Compute end address of table.
627         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
628         for end of list by offset, not by offset == 0.
629         (Dwarf_info_reader::do_read_string_table): Check for compressed
630         debug sections.
631         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
632         Initialize new data members.
633         (Dwarf_pubnames_table::next_name): return flag_byte.
634         (Dwarf_pubnames_table::end_of_table_): New data member.
635         (Dwarf_pubnames_table::is_gnu_style_): New data member.
636         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
637         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
638         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
639         read skeleton type unit DIEs.
640         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
641         (Gdb_index::do_write): Write flag_byte.
642         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
643         (Gdb_index::Cu_vector): Store flags along with cu indexes.
644         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
645         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
646
647 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
648
649         * version.cc (print_version): Update copyright year to 2014.
650
651 2013-12-19  Dimitry Andric  <dimitry@andric.com>
652
653         * stringpool.cc (Stringpool_template::reserve): Add
654         HAVE_UNORDERED_MAP case.
655         * stringpool.cc (Stringpool_template::print_stats): Likewise.
656
657 2013-12-18  Cary Coutant  <ccoutant@google.com>
658
659         * configure.ac: Check for <unordered_set> and <unordered_map>.
660         * config.in: Regenerate.
661         * configure: Regenerate.
662         * system.h: Use <unordered_set> and <unordered_map> if available.
663
664 2013-12-10  Roland McGrath  <mcgrathr@google.com>
665
666         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
667         with $(INSTALL_PROGRAM_ENV).
668         * Makefile.in: Regenerate.
669
670 2013-11-22  Cary Coutant  <ccoutant@google.com>
671
672         * configure.ac: Add check for which library is needed for
673         dlopen.
674         * configure: Regenerate.
675
676 2013-11-22  Cary Coutant  <ccoutant@google.com>
677
678         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
679         assembler.
680         * testsuite/Makefile.in: Regenerate.
681
682 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
683
684         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
685         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
686         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
687         (Target_x86_64<size>::Scan::local): Likewise.
688         (Target_x86_64<size>::Scan::global): Likewise.
689         (Target_x86_64<size>::Relocate::relocate): Likewise.
690         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
691         Likewise.
692         (Target_x86_64<size>::Scan::check_non_pic(): Handle
693         R_X86_64_PC32_BND.
694
695         * testsuite/Makefile.am (check_PROGRAMS): Add
696         exception_x86_64_bnd_test.
697         (exception_x86_64_bnd_test_SOURCES): New macro.
698         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
699         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
700         (exception_x86_64_bnd_test_LDADD): Likewise.
701         (exception_x86_64_bnd_1.o): New rule.
702         (exception_x86_64_bnd_2.o): Likewise.
703         * testsuite/Makefile.in: Regenerated.
704
705 2013-11-15  Alan Modra  <amodra@gmail.com>
706
707         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
708         accessor.
709         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
710         Only call ppc64_local_entry_offset for 64-bit.  Restrict
711         symval_for_branch lookup to ELFv1.
712         (Stub_table::add_plt_call_entry): Use unsigned int off.
713         (Output_data_glink::Address, invalid_address): New.
714         (Output_data_glink::add_eh_frame): Move out of line.  Add
715         support for ELFv2.
716         (Output_data_glink::add_global_entry, find_global_entry,
717         global_entry_address): New functions.
718         (Output_data_glink::global_entry_stubs_, end_branch_table_,
719         ge_size): New variables.
720         (Output_data_glink::set_final_data_size): Add global entry
721         stub sizing.
722         (Output_data_glink::do_write): Write global entry stubs.
723         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
724         parameter.  Return true for ELFv2.  Adjust callers.
725         (Target_powerpc::Scan::local, global): Restrict opd lookup to
726         ELFv1.  Similarly for ifunc and dynamic relocation processing
727         specific to ELFv1.  Recognize that symbols are defined on
728         their plt entries for ELFv2.
729         (Target_powerpc::symval_for_branch): Assert if called for
730         ELFv2 or ppc32.
731         (Target_powerpc::Relocate::relocate): Use global entry plt
732         stub for symbol value if such exists on ELFv2.
733         (Target_powerpc::Relocate::relocate): Don't call
734         symval_for_branch when ELFv2.  Do adjust for local entry
735         offset when ELFv2.
736         (Target_powerpc::do_dynsym_value): Set symbols to global entry
737         plt stub for ELFv2.
738         (Target_powerpc::do_plt_address_for_global): Similarly.
739
740 2013-11-14  Cary Coutant  <ccoutant@google.com>
741
742         Revert patch -- this did not fix the problem, and there is
743         no race there.
744
745         2013-11-14  Cary Coutant  <ccoutant@google.com>
746
747             PR gold/14860
748             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
749             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
750             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
751             updating fde_offsets_.
752             (Eh_frame_hdr::lock_): New data member.
753
754 2013-11-14  Cary Coutant  <ccoutant@google.com>
755
756         * dwp.cc (Dwo_file_entry): New type.
757         (File_list): Use Dwo_file_entry.
758         (Dwo_file::verify): New function.
759         (Dwo_file::verify_dwo_list): New function.
760         (Dwo_file::sized_verify_dwo_list): New function.
761         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
762         list.
763         (Dwp_options): New enum type.
764         (dwp_options): Add --verify-only.
765         (usage): Likewise.
766         (main): Likewise.
767         * dwp.h (gold_info): Add declaration.
768
769 2013-11-14  Cary Coutant  <ccoutant@google.com>
770
771         PR gold/14860
772         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
773         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
774         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
775         updating fde_offsets_.
776         (Eh_frame_hdr::lock_): New data member.
777
778 2013-11-06  Cary Coutant  <ccoutant@google.com>
779
780         PR gold/15758
781         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
782         before reloc sections.
783
784 2013-11-04  Alan Modra  <amodra@gmail.com>
785
786         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
787         (Symbol::needs_dynamic_reloc): Test new flag.
788         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
789         (Target_powerpc::Scan::get_reference_flags): Add target param.
790         Return FUNC_DESC_ABI for 64-bit ELFv1.
791         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
792         call.
793         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
794         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
795
796 2013-10-31  Cary Coutant  <ccoutant@google.com>
797
798         Restore support for dwp v2 DWARF package file format.
799
800         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
801         tu_length parameter.  Adjust all callers.
802         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
803         * dwp.cc: Include dwarf.h.
804         (Section_bounds): New struct type.
805         (Unit_set): New struct type.
806         (Dwo_file::Dwo_file): Initialize new data member.
807         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
808         Combine and rename to...
809         (Dwo_file::read_unit_index): ...this.
810         (Dwo_file::sized_read_compunit_index)
811         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
812         (Dwo_file::sized_read_unit_index): ...this.
813         (Dwo_file::copy_section): Remove section_name, is_str_offsets
814         parameters; add section_id parameter.
815         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
816         (Dwo_file::add_unit_set): ...this.
817         (Dwo_file::shndx_map_): Remove.
818         (Dwo_file::sect_offsets_): New data member.
819         (Dwp_output_file::Dwp_output_file): Initialize new data members.
820         (Dwp_output_file::add_section): Rename to...
821         (Dwp_output_file::add_contribution): ...this.
822         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
823         (Dwp_output_file::add_tu_set): Likewise.
824         (Dwp_output_file::Contribution): New type.
825         (Dwp_output_file::Section::contributions): New data member.
826         (Dwp_output_file::Cu_or_tu_set): Remove.
827         (Dwp_output_file::Section::Section): New ctor.
828         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
829         (Dwp_output_file::Dwp_index::Section_table): New type.
830         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
831         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
832         parameter.
833         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
834         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
835         (Dwp_output_file::Dwp_index::section_table): New member function.
836         (Dwp_output_file::Dwp_index::section_table_end): New member function.
837         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
838         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
839         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
840         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
841         (Dwp_output_file::Dwp_index::section_table_): New data member.
842         (Dwp_output_file::Dwp_index::section_mask_): New data member.
843         (Dwp_output_file::add_output_section): New member function.
844         (Dwp_output_file::write_new_section): New member function.
845         (Dwp_output_file::write_contributions): New member function.
846         (Dwp_output_file::section_id_map_): New data member.
847         (class Dwo_id_info_reader): Remove.
848         (class Unit_reader): New class.
849         (get_dwarf_section_name): New function.
850         (Dwo_file::read_executable): Adjust initializations of class data.
851         (Dwo_file::read): Add support for v2 package file format.
852         (Dwo_file::read_unit_index): Likewise.
853         (Dwo_file::sized_read_unit_index): Likewise.
854         (Dwo_file::copy_section): Likewise.
855         (Dwo_file::add_unit_set): Likewise.
856         (Dwp_output_file::add_output_section): Likewise.
857         (Dwp_output_file::add_contribution): Likewise.
858         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
859         for empty slot.
860         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
861         file format.
862         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
863         slot.
864         (Dwp_output_file::initialize): Remove unused function.
865         (Dwp_output_file::finalize): Add support for v2 package file format.
866         (Dwp_output_file::write_index): Likewise.
867         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
868         function prototype.
869
870 2013-10-31  Cary Coutant  <ccoutant@google.com>
871
872         * configure.ac: Fix check for -fmerge-constants.
873         * configure.ac: Regenerate.
874
875 2013-10-30  Roland McGrath  <mcgrathr@google.com>
876
877         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
878         Correct 9-byte nop sequence to match what the assembler generates.
879
880 2013-10-30  Alan Modra  <amodra@gmail.com>
881
882         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
883         ppc64_local_entry_offset, ppc64_local_entry_offset,
884         do_read_symbols): New functions.
885         (Powerpc_relobj::e_flags_, st_other_): New vars.
886         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
887         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
888         (Powerpc_relobj::e_flags_): New var.
889         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
890         and adjust for ELFv2.
891         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
892         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
893         (Powerpc_dynobj::do_find_special_sections): Likewise.
894         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
895         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
896         to ELFv2 local entry.
897         (Target_powerpc::do_relax): No thread safe barriers needed for
898         ELFv2.
899         (Output_data_plt_powerpc::initial_plt_entry_size_,
900         plt_entry_size): Delete.  Replace all uses with
901         first_plt_entry_offset() and plt_entry_size().
902         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
903         reserved_size parm.  Update callers.
904         (Output_data_plt_powerpc::entry_count): Update.
905         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
906         and use Target_powerpc::first_plt_entry_offset().
907         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
908         rename to plt_entry_size.
909         (Output_data_plt_powerpc::add_ifunc_entry,
910         add_local_ifunc_entry): Adjust reloc for ELFv2.
911         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
912         (glink_eh_frame_fde_64v2): New.
913         (Stub_table::plt_call_size): Support ELFv2 sizing.
914         (Output_data_glink::add_eh_frame): Use the new FDE.
915         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
916         (Stub_table::do_write): Write ELFv2 stubs and glink.
917         (Target_powerpc::Relocate::relocate): Replaces nop after call
918         with ld 2,24(1) and adjust local offset destination for ELFv2.
919
920 2013-10-30  Alan Modra  <amodra@gmail.com>
921
922         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
923         (Target_powerpc::Scan::global, local): Likewise.
924         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
925         on all ppc64 @h and @ha relocs.
926
927 2013-10-14  Alan Modra  <amodra@gmail.com>
928
929         * output.h (Output_data_got::add_constant): Tidy.
930         (Output_data_got::add_constant_pair): New function.
931         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
932         methods used so as to first call reserve_ent().
933
934 2013-10-11  Roland McGrath  <mcgrathr@google.com>
935
936         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
937         add_got_entry and add_got_entry_pair.
938
939         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
940         (HAVE_PUBNAMES): Likewise.
941         * configure: Regenerate.
942
943         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
944         * testsuite/Makefile.in: Regenerate.
945
946         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
947         Remove const from declaration.
948         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
949         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
950         * output.h (Output_file_header): Remove const from member target_
951         and corresponding constructor argument.
952         * output.cc (Output_file_header::Output_file_header): Update prototype.
953         (Output_file_header::do_sized_write): Use this->target_ in place
954         of parameters()->target().
955
956         * testsuite/undef_symbol.cc (Foo::get_a): New method.
957
958         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
959         * configure: Regenerate.
960         * Makefile.in: Regenerate.
961         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
962         * testsuite/merge_string_literals_2.c: Likewise.
963         * testsuite/Makefile.am
964         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
965         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
966         literal -fmerge-constants.
967         * testsuite/Makefile.in: Regenerate.
968
969         * i386.cc (Target_i386): Remove unused member dynbss_.
970         * arm.cc (Target_arm): Likewise.
971         * powerpc.cc (Target_powerpc): Likewise.
972         * sparc.cc (Target_sparc): Likewise.
973         * tilegx.cc (Target_tilegx): Likewise.
974         * x86_64.cc (Target_x86_64): Likewise.
975         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
976         type_signature_, type_offset_.
977         * plugin.h (Plugin_hook): Remove unused member layout_.
978         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
979         mapfile_.
980         (Read_member): Remove unused members input_objects_, symtab_,
981         mapfile_, layout_.
982         (Check_library): Remove unused member symtab_.
983         * archive.h (Lib_group): Remove unused member lib_.
984         * archive.cc (Lib_group::Lib_group): Update initializer.
985         * incremental.h (Incremental_binary): Remove unused member target_.
986         (Incremental_script_entry): Removed unused member script_.
987         * layout.h (Write_symbols_task): Remove unused member input_objects_.
988         * icf.h (Icf): Remove unused member num_tracked_relocs.
989
990         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
991         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
992         its only use.
993         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
994
995         * archive.h: Use struct rather than class for forward declaration
996         of Read_symbols_data.
997
998 2013-10-07  Cary Coutant  <ccoutant@google.com>
999
1000         PR gold/16010
1001         * testsuite/Makefile.am (icf_test): Fix dependencies.
1002         (icf_safe_test): Likewise.
1003         (icf_safe_so_test): Likewise.
1004         (large_symbol_alignment): Add empty _LDADD rule.
1005         * testsuite/Makefile.in: Regenerate.
1006
1007 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1008
1009         PR gold/15927
1010         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1011         relocation for R_X86_64_32 on x32.
1012
1013 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1014
1015         * output.cc (Output_segment::set_section_addresses): Take new
1016         Target* argument.  If target->isolate_execinstr() and the segment
1017         is executable and starts at a target->abi_pagesize() boundary,
1018         pad its end out to a target->abi_pagesize() boundary with code fill.
1019         * output.h (Output_segment::set_section_addresses): Update decl.
1020         * layout.h (Layout::check_output_data_for_reset_values): Take new
1021         argument RELAX_OUTPUTS.
1022         (Layout): New member relax_output_list_.
1023         (Layout::add_relax_output): New method.
1024         * layout.cc (Layout::Layout): Update constructor.
1025         (Layout::reset_relax_output): New method.
1026         (Layout::clean_up_after_relaxation): Call it.
1027         (Layout::prepare_for_relaxation): Update caller.
1028         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1029         Call reset_relax_output before re-processing segments for
1030         isolate_execinstr case.
1031         (Layout::write_data): Handle relax_output_list_.
1032         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1033         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1034
1035 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1036
1037         PR binutils/15834
1038         * object.h: Fix typos.
1039
1040 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1041
1042         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1043         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1044
1045 2013-08-07  Cary Coutant  <ccoutant@google.com>
1046
1047         Revert support for v2 DWP files:
1048
1049         2013-03-01  Cary Coutant  <ccoutant@google.com>
1050
1051             Add dwp support for v2 DWARF package file format.
1052             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1053             tu_length parameter.  Adjust all callers.
1054             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1055             * dwp.cc: Include dwarf.h.
1056             (Section_bounds): New struct type.
1057             (Unit_set): New struct type.
1058             (Dwo_file::Dwo_file): Initialize new data member.
1059             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1060             Combine and rename to...
1061             (Dwo_file::read_unit_index): ...this.
1062             (Dwo_file::sized_read_compunit_index)
1063             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1064             (Dwo_file::sized_read_unit_index): ...this.
1065             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1066             parameters; add section_id parameter.
1067             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1068             (Dwo_file::add_unit_set): ...this.
1069             (Dwo_file::shndx_map_): Remove.
1070             (Dwo_file::sect_offsets_): New data member.
1071             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1072             (Dwp_output_file::add_section): Rename to...
1073             (Dwp_output_file::add_contribution): ...this.
1074             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1075             (Dwp_output_file::add_tu_set): Likewise.
1076             (Dwp_output_file::Contribution): New type.
1077             (Dwp_output_file::Section::contributions): New data member.
1078             (Dwp_output_file::Cu_or_tu_set): Remove.
1079             (Dwp_output_file::Section::Section): New ctor.
1080             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1081             (Dwp_output_file::Dwp_index::Section_table): New type.
1082             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1083             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1084             parameter.
1085             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1086             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1087             (Dwp_output_file::Dwp_index::section_table): New member function.
1088             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1089             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1090             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1091             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1092             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1093             (Dwp_output_file::Dwp_index::section_table_): New data member.
1094             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1095             (Dwp_output_file::add_output_section): New member function.
1096             (Dwp_output_file::write_new_section): New member function.
1097             (Dwp_output_file::write_contributions): New member function.
1098             (Dwp_output_file::section_id_map_): New data member.
1099             (class Dwo_id_info_reader): Remove.
1100             (class Unit_reader): New class.
1101             (get_dwarf_section_name): New function.
1102             (Dwo_file::read_executable): Adjust initializations of class data.
1103             (Dwo_file::read): Add support for v2 package file format.
1104             (Dwo_file::read_unit_index): Likewise.
1105             (Dwo_file::sized_read_unit_index): Likewise.
1106             (Dwo_file::copy_section): Likewise.
1107             (Dwo_file::add_unit_set): Likewise.
1108             (Dwp_output_file::add_output_section): Likewise.
1109             (Dwp_output_file::add_contribution): Likewise.
1110             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1111             for empty slot.
1112             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1113             file format.
1114             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1115             slot.
1116             (Dwp_output_file::initialize): Remove unused function.
1117             (Dwp_output_file::finalize): Add support for v2 package file format.
1118             (Dwp_output_file::write_index): Likewise.
1119             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1120             function prototype.
1121
1122 2013-07-31  Cary Coutant  <ccoutant@google.com>
1123
1124         * object.cc (Sized_relobj::do_output_section_address): New function.
1125         (Sized_relobj): Instantiate explicitly.
1126         * object.h (Object::output_section_address): New function.
1127         (Object::do_output_section_address): New function.
1128         (Sized_relobj::do_output_section_address): New function.
1129         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1130
1131 2013-07-30  Cary Coutant  <ccoutant@google.com>
1132             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1133
1134         * parameters.cc (Parameters::entry): Return target-specific entry
1135         symbol name.
1136         * target.h (Target::entry_symbol_name): New function.
1137         (Target_info::entry_symbol_name): New data member.
1138
1139         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1140         * i386.cc (Target_i386::i386_info): Likewise.
1141         (Target_i386_nacl::i386_nacl_info): Likewise.
1142         * sparc.cc (Target_sparc::sparc_info): Likewise.
1143         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1144         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1145         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1146         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1147
1148 2013-07-22  Sterling Augustine  <saugustine@google.com>
1149
1150         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1151         Convert parameter shndx to local variable. Add parameters symtab
1152         and symtab_size.  Scan over section names.  Find relocation
1153         section corresponding to current section.  Create and initialize
1154         reloc_mapper_ and reloc_type_.
1155         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1156         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1157         cu_offset_.
1158         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1159         Initialize new fields unit_length_ and cu_offset_.
1160         (Dwarf_pubnames_table::read_section): Update prototype.
1161         (Dwarf_pubnames_table::cu_offset): New member function.
1162         (Dwarf_pubnames_table::subsection_size): Likewise.
1163         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1164         New fields.
1165         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1166         member functions public.
1167         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1168         Update comment.  Rework logic.  Move repeated parts to...
1169         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1170         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1171         pubtypes_table_, and stmt_list_offset.
1172         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1173         Gdb_index::find_pubtype_offset,
1174         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1175         (Gdb_index::pubnames_read): Update prototype and rework logic.
1176         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1177         Forward declare.
1178         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1179         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1180         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1181         Gdb_index::map_pubtable_to_dies):
1182         Declare functions.
1183         (Gdb_index::pubnames_read): Update declaration.
1184         (Gdb_index::Pubname_offset_map): New type.
1185         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1186         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1187         Gdb_index::stmt_list_offset): Declare.
1188         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1189         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1190         Gdb_index::pubtypes_offset_): Remove.
1191
1192 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1193
1194         * options.h (General_options): Add -Trodata-segment option.
1195         * parameters.cc (Parameters::check_rodata_segment): New function.
1196         (Parameters::set_target_once): Call it.
1197         * parameters.h (Parameters): Declare it (private member function).
1198         * layout.cc (load_seg_unusable_for_headers): New function, broken
1199         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1200         then validate rodata segment rather than text segment.
1201         (relaxation_loop_body): Call that.
1202         (is_text_segment): New function.  Don't admit a non-executable
1203         segment if TARGET->isolate_execinstr().
1204         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1205
1206 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1207
1208         PR gold/15070
1209         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1210         * nacl.h (Sniff_file::View::View): Request aligned view.
1211
1212 2013-07-11  Cary Coutant  <ccoutant@google.com>
1213
1214         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1215         correct BRLT entry size.
1216
1217 2013-07-03  Alan Modra  <amodra@gmail.com>
1218
1219         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1220         comment.
1221
1222 2013-07-01  Cary Coutant  <ccoutant@google.com>
1223
1224         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1225         reloc_type_.
1226         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1227         (Dwarf_ranges_table::lookup_reloc): New function.
1228         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1229         reloc_type_.
1230         (Dwarf_ranges_table::lookup_reloc): New function.
1231         (Dwarf_ranges_table::reloc_type_): New data member.
1232
1233 2013-06-27  Jing Yu  <jingyu@google.com>
1234
1235         PR gold/15662
1236         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1237         function.
1238         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1239         (Target_powerpc::do_relax): Call the above.
1240
1241 2013-06-27  Cary Coutant  <ccoutant@google.com>
1242
1243         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1244         on garbage collected .opd section.
1245
1246 2013-06-27  Alan Modra  <amodra@gmail.com>
1247
1248         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1249         is non-zero.
1250         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1251         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1252
1253 2013-06-14  Cary Coutant  <ccoutant@google.com>
1254
1255         * resolve.cc (Symbol::override_base): Don't override st_type
1256         from plugin placeholder symbols.
1257         (Symbol_table::resolve): Likewise.
1258         (Symbol_table::should_override): Don't complain about TLS mismatch
1259         if the TO symbol is a plugin placeholder.
1260         * testsuite/Makefile.am (plugin_test_tls): New test.
1261         * testsuite/Makefile.in: Regenerate.
1262         * testsuite/plugin_test_tls.sh: New test script.
1263         * testsuite/two_file_test_2_tls.cc: New test source.
1264         * testsuite/two_file_test_tls.cc: New test source.
1265
1266 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1267
1268         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1269         the maximum segment alignment is larger than the page size.
1270         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1271         correctly aligns the symbols with large alignemnt.
1272         * testsuite/Makefile.in: Regenerate.
1273         * testsuite/large_symbol_alignment.cc: New file.
1274
1275 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1276             Sriraman Tallam  <tmsriram@google.com>
1277
1278         * options.h (sort_section): New option.
1279         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1280         Rename from Input_section_sort_section_name_special_ordering_compare.
1281         (Input_section_sort_section_name_compare): New struct.
1282         * output.cc (Output_section::Input_section_sort_section_name_compare::
1283         operator()): New function.
1284         (Output_section::sort_attached_input_sections): Use new sort function
1285         for .text if --sort-section=name is specified.
1286         * layout.cc (Layout::make_output_section):
1287         Add sorting by name when --sort-section=name is specified.
1288         * testsuite/Makefile.am (text_section_grouping): Test option
1289         --sort-section=name.
1290         * testsuite/Makefile.in: Regenerate.
1291         * testsuite/section_sorting_name.cc: New file.
1292         * testsuite/section_sorting_name.sh: New file.
1293
1294 2013-05-21  Cary Coutant  <ccoutant@google.com>
1295
1296         * symtab.h (Symbol::is_cxx_vtable): New function.
1297         * target-reloc.h (relocate_section): Check for vtable symbol.
1298         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1299         * testsuite/Makefile.in: Regenerate.
1300         * testsuite/missing_key_func.cc: New test source.
1301         * testsuite/missing_key_func.sh: New test script.
1302
1303 2013-05-21  Cary Coutant  <ccoutant@google.com>
1304
1305         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1306         type of enclosing symbol.
1307         (Relocate_info::location): Check symbol type when describing symbol.
1308         * object.h (Symbol_location_info): Remove unused line_number;
1309         add enclosing_symbol_type.
1310         * testsuite/debug_msg.sh: Adjust expected output.
1311
1312 2013-05-13  Cary Coutant  <ccoutant@google.com>
1313
1314         * configure.ac: Export DEFAULT_TARGET.
1315         * configure: Regenerate.
1316         * Makefile.in: Regenerate.
1317         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1318         * testsuite/Makefile.in: Regenerate.
1319         * testsuite/debug_msg.sh: Delete duplicate tests.
1320         Don't check undef_int error message match for powerpc where the
1321         source file and line number aren't available.
1322
1323 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1324
1325         * options.h (General_options): Add --rosegment-gap option.
1326         * options.cc (finalize): --rosegment-gap implies --rosegment.
1327         * layout.cc (set_segment_offsets): Let user option override
1328         target->rosegment_gap().
1329
1330 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1331
1332         * options.h (General_options): Remove leading space from help
1333         messages for -nostdlib and --rosegment.
1334
1335 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1336
1337         PR ld/15365
1338         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1339
1340 2013-05-03  Alan Modra  <amodra@gmail.com>
1341
1342         * merge.cc (Output_merge_string::do_add_input_section): Correct
1343         scan for number of strings.  Rename vars to avoid shadowing.
1344         Include missing terminator in input_size_.
1345
1346 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1347
1348         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1349         Restore empty string handling.
1350
1351 2013-05-01  Cary Coutant  <ccoutant@google.com>
1352
1353         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1354         uninitialized warning.
1355
1356 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1357
1358         * output.cc (Output_section::add_merge_input_section): Allow
1359         to merge sections if the alignment is more than character size.
1360         * merge.h (Output_merge_string::Output_merge_string): Remove
1361         assert.
1362         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1363         only not-null strings. Check the alignment of strings.
1364         * stringpool.h
1365         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1366         alignment as the argument.
1367         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1368         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1369         Align non-zero length strings according to the addralign_.
1370         (Stringpool_template<Stringpool_char>::set_string_offsets):
1371         Updating offsets according to the given alignment.
1372         * testsuite/Makefile.am (text_section_grouping): Test if string
1373         literals are getting merged.
1374         * testsuite/Makefile.in: Regenerate.
1375         * testsuite/merge_string_literals_1.c: New file.
1376         * testsuite/merge_string_literals_2.c: Ditto.
1377         * testsuite/merge_string_literals.sh: Ditto.
1378
1379 2013-04-26  Ian Lance Taylor  <iant@google.com>
1380
1381         * target-reloc.h (relocate_section): If the reloc offset is out of
1382         range, pass VIEW as NULL to relocate.relocate.
1383         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1384         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1385         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1386         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1387         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1388         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1389
1390 2013-04-26  Geoff Pike  <gpike@chromium.org>
1391
1392         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1393         * layout.cc (Hash_task): New class.
1394         (Layout::queue_build_id_tasks): New function.
1395         (Layout::write_build_id): Handle single-thread portion of build ID
1396         computation.  (In some cases, all of it is single-threaded.)  Replace
1397         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1398         functionality in fewer lines of code.
1399         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1400         * options.h (General_options): make "--build-id" default to tree
1401         rather than sha1.  Add two new options related to --build-id=tree:
1402         --build-id-chunk-size-for-treehash and
1403         --build-id-min-file-size-for-treehash.
1404         * Makefile.am: add testing of --build-id=tree and related new options
1405         (these tests will be invoked by "make check").
1406         * Makefile.in: Regenerate.
1407
1408 2013-04-25  Alan Modra  <amodra@gmail.com>
1409
1410         * configure.tgt: Add powerpcle and powerpc64le.
1411
1412 2013-04-22  Alan Modra  <amodra@gmail.com>
1413
1414         PR gold/15355
1415         * layout.cc (Layout::segment_precedes): Allow more than one
1416         segment with the same type and flags.
1417
1418 2013-04-15  Cary Coutant  <ccoutant@google.com>
1419
1420         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1421         allocate space in file for BSS sections.
1422
1423 2013-04-15  Cary Coutant  <ccoutant@google.com>
1424
1425         * script-sections.cc (Orphan_output_section): Reset address
1426         to zero after each orphaned section for relocatable links.
1427
1428 2013-04-15  Cary Coutant  <ccoutant@google.com>
1429
1430         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1431         section starting address for relocatable link.
1432         * testsuite/Makefile.am (script_test_11): New test.
1433         * testsuite/Makefile.in: Regenerate.
1434         * testsuite/script_test_11.c: New source file.
1435         * testsuite/script_test_11.t: New linker script.
1436
1437 2013-04-13  Alan Modra  <amodra@gmail.com>
1438
1439         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1440         owner when sections are not adjacent and exceed group size.
1441         (Target_powerpc::group_sections): Handle corner case.
1442         (Target_powerpc::Branch_info::make_stub): Handle case where
1443         stub table doesn't exist due to branches in non-exec sections.
1444         (Target_powerpc::Relocate::relocate): Likewise.
1445
1446 2013-04-11  Alan Modra  <amodra@gmail.com>
1447
1448         PR gold/15354
1449         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1450         .branch_lt to match bfd ld.  Adjust comments throughout file.
1451
1452 2013-04-04  Ian Lance Taylor  <iant@google.com>
1453
1454         GCC PR c++/56840
1455         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1456         sections before checking whether they are included in the link.
1457
1458 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1459
1460         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1461         object before calling the plugin claim_file handler.  Pass the elf
1462         object of the archive to the plugin. Delete the elf object if the
1463         plugin claims the file.
1464
1465 2013-03-21  Alan Modra  <amodra@gmail.com>
1466
1467         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1468         segment when omagic.
1469
1470 2013-03-21  Alan Modra  <amodra@gmail.com>
1471
1472         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1473         comparison warning.
1474         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1475         uninitialized" warning.
1476
1477 2013-03-20  Alan Modra  <amodra@gmail.com>
1478
1479         * symtab.h (Symbol::clear_version): New function.
1480         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1481         is_needed by weak references.  Clear version for symbols defined
1482         in as-needed objects that are not needed.
1483
1484 2013-03-15  Alan Modra  <amodra@gmail.com>
1485
1486         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1487         static and public.  Add report_err param.  Return false for data refs.
1488         (Target_powerpc::rela_dyn_section): New overloaded function.
1489         (Target_powerpc::plt_, iplt_): Elucidate.
1490         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1491         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1492         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1493         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1494         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1495         push_branch and make_plt_entry for ifunc syms when
1496         reloc_needs_plt_for_ifunc.
1497         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1498         for ifunc unless reloc_needs_plt_for_ifunc.
1499
1500 2013-03-15  Alan Modra  <amodra@gmail.com>
1501
1502         * gc.h (gc_process_relocs): Don't look through function descriptors.
1503         * icf.cc (get_section_contents): Do so here instead.
1504
1505 2013-03-13  Alan Modra  <amodra@gmail.com>
1506
1507         * powerpc.cc (is_branch_reloc): Forward declare.
1508         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1509         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1510         false for 64-bit, true for 32-bit non-branch relocs.
1511         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1512         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1513         nm output.
1514         (icf_safe_test): Generate linker map file as well as nm output.
1515         (icf_safe_so_test): Likewise.
1516         * testsuite/Makefile.in: Regenerate.
1517         * testsuite/icf_test.sh: Parse linker map file to determine
1518         section folding.
1519         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1520         * testsuite/icf_safe_so_test.sh: Likewise.
1521         (X86_32_or_ARM_specific_safe_fold): Merge into..
1522         (arch_specific_safe_fold): ..this.
1523         (X86_64_specific_safe_fold): Delete unused function.
1524
1525 2013-03-12  Alan Modra  <amodra@gmail.com>
1526
1527         * gc.h (gc_process_relocs): Look through function descriptors
1528         to determine shndx, symvalue and addend used by ICF.  Tidy
1529         variable duplication.
1530
1531 2013-03-11  Alan Modra  <amodra@gmail.com>
1532
1533         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1534         * layout.cc (Layout_task_runner::run): ..to here.
1535         * symtab.h (struct Symbol_location): Extract from..
1536         (class Symbol_table): ..here.
1537         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1538         * target.h (class Target): Add function_location and
1539         do_function_location functions.
1540         (class Sized_target): Add do_function_location.
1541         * object.h (class Sized_relobj_file): Move find_shdr..
1542         (class Object): ..to here.
1543         * object.cc: Likewise.  Update to suit.  Instantiate.
1544         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1545         * powerpc.cc (class Powerpc_dynobj): New.
1546         (Target_powerpc::do_function_location): New function.
1547         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1548         (Powerpc_dynobj::do_read_symbols): New function.
1549         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1550
1551 2013-03-08  Ian Lance Taylor  <iant@google.com>
1552
1553         * options.cc (General_options::string_to_object_format): Accept
1554         "default".
1555
1556 2013-03-08  Alan Modra  <amodra@gmail.com>
1557
1558         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1559         pointer to Post_fde.
1560         (struct Post_fde): Move definition to here..
1561         * ehframe.cc (struct Post_fde): ..from here.
1562         (Cie::write): Don't alloc Post_fde.
1563         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1564
1565 2013-03-07  Alan Modra  <amodra@gmail.com>
1566
1567         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1568         relocation referencing .LC0.
1569         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1570
1571 2013-03-07  Alan Modra  <amodra@gmail.com>
1572
1573         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1574         always_inline.  Add assembly for powerpc to avoid GOT.
1575
1576 2013-03-07  Alan Modra  <amodra@gmail.com>
1577
1578         * testsuite/script_test_10.sh: Don't test .bss section
1579         header number.
1580
1581 2013-03-06  Alan Modra  <amodra@gmail.com>
1582
1583         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1584         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1585         all callers.  Handle folded sections.
1586         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1587         to Powerpc_relobj.
1588         (Global_symbol_visitor_opd::operator()): Likewise.
1589
1590 2013-03-04  Alan Modra  <amodra@gmail.com>
1591
1592         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1593         * testsuite/Makefile.in: Regenerate.
1594
1595 2013-03-01  Cary Coutant  <ccoutant@google.com>
1596
1597         Add dwp support for v2 DWARF package file format.
1598         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1599         tu_length parameter.  Adjust all callers.
1600         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1601         * dwp.cc: Include dwarf.h.
1602         (Section_bounds): New struct type.
1603         (Unit_set): New struct type.
1604         (Dwo_file::Dwo_file): Initialize new data member.
1605         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1606         Combine and rename to...
1607         (Dwo_file::read_unit_index): ...this.
1608         (Dwo_file::sized_read_compunit_index)
1609         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1610         (Dwo_file::sized_read_unit_index): ...this.
1611         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1612         parameters; add section_id parameter.
1613         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1614         (Dwo_file::add_unit_set): ...this.
1615         (Dwo_file::shndx_map_): Remove.
1616         (Dwo_file::sect_offsets_): New data member.
1617         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1618         (Dwp_output_file::add_section): Rename to...
1619         (Dwp_output_file::add_contribution): ...this.
1620         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1621         (Dwp_output_file::add_tu_set): Likewise.
1622         (Dwp_output_file::Contribution): New type.
1623         (Dwp_output_file::Section::contributions): New data member.
1624         (Dwp_output_file::Cu_or_tu_set): Remove.
1625         (Dwp_output_file::Section::Section): New ctor.
1626         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1627         (Dwp_output_file::Dwp_index::Section_table): New type.
1628         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1629         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1630         parameter.
1631         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1632         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1633         (Dwp_output_file::Dwp_index::section_table): New member function.
1634         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1635         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1636         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1637         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1638         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1639         (Dwp_output_file::Dwp_index::section_table_): New data member.
1640         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1641         (Dwp_output_file::add_output_section): New member function.
1642         (Dwp_output_file::write_new_section): New member function.
1643         (Dwp_output_file::write_contributions): New member function.
1644         (Dwp_output_file::section_id_map_): New data member.
1645         (class Dwo_id_info_reader): Remove.
1646         (class Unit_reader): New class.
1647         (get_dwarf_section_name): New function.
1648         (Dwo_file::read_executable): Adjust initializations of class data.
1649         (Dwo_file::read): Add support for v2 package file format.
1650         (Dwo_file::read_unit_index): Likewise.
1651         (Dwo_file::sized_read_unit_index): Likewise.
1652         (Dwo_file::copy_section): Likewise.
1653         (Dwo_file::add_unit_set): Likewise.
1654         (Dwp_output_file::add_output_section): Likewise.
1655         (Dwp_output_file::add_contribution): Likewise.
1656         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1657         for empty slot.
1658         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1659         file format.
1660         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1661         slot.
1662         (Dwp_output_file::initialize): Remove unused function.
1663         (Dwp_output_file::finalize): Add support for v2 package file format.
1664         (Dwp_output_file::write_index): Likewise.
1665         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1666         function prototype.
1667
1668 2013-03-01  Cary Coutant  <ccoutant@google.com>
1669
1670         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1671         function into class definition in header file.
1672         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1673         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1674         New function.
1675         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1676
1677 2013-02-28  Alan Modra  <amodra@gmail.com>
1678
1679         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1680         * target.cc (Target::do_plt_fde_location): New function.
1681         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1682         accessor function, and constructor param.
1683         (struct Post_fde, Post_fdes): Declare.
1684         (Cie::write): Add post_fdes param.
1685         * ehframe.cc (Fde::write): Use plt_fde_location.
1686         (struct Post_fde): Define.
1687         (Cie::write): Stash FDEs added post merge mapping.
1688         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1689         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1690         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1691         other FDEs.
1692         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1693         (Target_powerpc::has_glink): New function.
1694         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1695         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1696         glink_eh_frame_fde_32, default_fde): New data.
1697         (Stub_table::eh_frame_added_): New var.
1698         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1699         Make const.
1700         (Stub_table::add_eh_frame): New function.
1701         (Output_data_glink::add_eh_frame): New function.
1702         (Target_powerpc::make_glink_section): Call add_eh_frame.
1703
1704 2013-02-15  Ian Lance Taylor  <iant@google.com>
1705
1706         * options.h (DEFINE_uint64_alias): Define.
1707         (class General_options): Add -Ttext-segment as an alias for
1708         -Ttext.
1709
1710 2013-02-15  Alan Modra  <amodra@gmail.com>
1711
1712         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1713         (Stub_table::do_write): ..here, two places.
1714         (Stub_table::plt_call_size): Use it here too.
1715
1716 2013-02-11  Ian Lance Taylor  <iant@google.com>
1717
1718         * descriptors.cc (Descriptors::close_all): New function.
1719         * descriptors.h (class Descriptors): Declare close_all.
1720         (close_all_descriptors): New inline function.
1721         * plugin.cc: Include "descriptors.h".
1722         (Plugin_manager::cleanup): Call close_all_descriptors.
1723
1724 2013-02-06  Alan Modra  <amodra@gmail.com>
1725
1726         * README: Update coding style link.
1727
1728 2013-01-28  Cary Coutant  <ccoutant@google.com>
1729
1730         * dwp.cc (File_list): New typedef.
1731         (Dwo_name_info_reader): New class.
1732         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1733         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1734         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1735         (Dwo_file::read_executable): New function.
1736         (Dwo_file::read): Move common setup code to ...
1737         (Dwo_file::make_object): ... here.
1738         (dwp_options): Add --exec/-e.
1739         (usage): Likewise.
1740         (main): Likewise.
1741
1742 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1743
1744         * layout.cc (Layout::layout): Check for option text_reorder.
1745         (Layout::make_output_section): Ditto.
1746         * options.h (text_reorder): New option.
1747         * output.cc (Input_section_sort_compare): Remove special ordering
1748         of section names.
1749         (Output_section::
1750          Input_section_sort_section_name_special_ordering_compare::
1751          operator()): New function.
1752         (Output_section::sort_attached_input_sections): Use new sort function
1753         for .text.
1754         * output.h (Input_section_sort_section_name_special_ordering_compare):
1755         New struct.
1756         * testsuite/Makefile.am (text_section_grouping): Test option
1757         --no-text-reorder
1758         * testsuite/Makefile.in: Regenerate.
1759         * testsuite/text_section_grouping.sh: Check order of functions without
1760         default text reordering.
1761
1762 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1763
1764         * options.h (General_options): Change default to true for new_dtags.
1765
1766 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1767
1768         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1769         when enable_new_dtags is false.  Only add DT_RUNPATH when
1770         enable_new_dtags is true.
1771
1772 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1773
1774         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1775         used in declaration and definition consistent.
1776         (Target_powerpc::symval_for_branch): Ditto.
1777
1778 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1779
1780         * testsuite/plugin_final_layout.cc: Fix comment.
1781
1782 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1783
1784         * layout.cc (Layout::layout): Do not do default sorting for
1785         text sections when section ordering is specified.
1786         (make_output_section): Ditto.
1787         * testsuite/plugin_final_layout.cc: Name the function sections
1788         to catch reordering issues.
1789
1790 2013-01-15  Alan Modra  <amodra@gmail.com>
1791
1792         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1793         plt-thread-safe.
1794
1795 2013-01-15  Alan Modra  <amodra@gmail.com>
1796
1797         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1798         * testsuite/Makefile.in: Regenerate.
1799
1800 2013-01-14  Alan Modra  <amodra@gmail.com>
1801
1802         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1803         * testsuite/Makefile.in: Regenerate.
1804
1805 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1806
1807         PR bfd/14430
1808         Fix mingw gold build with plugins enabled
1809         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1810         * configure.ac: Export DLOPEN_LIBS and add headers check.
1811         * plugin.cc: Handle non-dlfcn case.
1812         * Makefile.in: Regenerate.
1813         * config.in: Regenerate.
1814         * configure: Regenerate.
1815         * testsuite/Makefile.in: Regenerate.
1816
1817 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1818
1819         * output.h (sort_attached_input_sections): Change to be public.
1820         * script-sections.cc
1821         (Output_section_definition::set_section_addresses): Sort
1822         attached input sections according to section order before linker
1823         script assigns section addresses.
1824         (Orphan_output_section::set_section_addresses): Sort
1825         attached input sections according to section order before linker
1826         script assigns section addresses.
1827         * Makefile.am (final_layout.sh): Use a simple linker script to
1828         check if section ordering still works.
1829         * Makefile.in: Regenerate.
1830
1831 2013-01-09  Ben Cheng  <bccheng@google.com>
1832
1833         * arm.cc (Target_arm::attributes_accept_div): New function.
1834         (Target_arm::attributes_forbid_div): New function.
1835         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1836         attribute using the same new functions as what bfd/elf32_arm.c
1837         does.
1838
1839 2013-01-07  Cary Coutant  <ccoutant@google.com>
1840
1841         PR gold/14993
1842         * output.cc (Output_section::add_input_section): For incremental
1843         updates, don't track input sections that are allocated from patch
1844         space.
1845
1846 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1847             Ian Lance Taylor  <iant@google.com>
1848
1849         PR gold/14897
1850         * configure.ac (--enable-ld): Removed.
1851         (install_as_default): Set to yes only for --enable-gold=default
1852         or --disable-ld.
1853         * configure: Regenerated.
1854
1855 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1856
1857         * options.h (General_options): Add -fuse-ld= for GCC linker
1858         option compatibility.
1859
1860 2013-01-04  Cary Coutant  <ccoutant@google.com>
1861
1862         * configure.ac: Fix typo restoring CXXFLAGS.
1863         * configure: Regenerate.
1864
1865 2013-01-04  Cary Coutant  <ccoutant@google.com>
1866
1867         * testsuite/Makefile.am (CXXLINK_S): New macro.
1868         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1869         * testsuite/Makefile.in: Regenerate.
1870
1871 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1872
1873         * version.cc (print_version): Update copyright year to 2013.
1874
1875 2012-12-20  Ian Lance Taylor  <iant@google.com>
1876
1877         * layout.cc (Layout::special_ordering_of_input_section): New
1878         function.
1879         (Layout::layout): If input section requires special ordering, must
1880         sort input sections.
1881         (Layout::make_output_section): May sort .text input sections.
1882         (Layout::is_section_name_prefix_grouped): Remove.
1883         * layout.h (class Layout): Declare
1884         special_ordering_of_input_section.  Don't declare
1885         is_section_name_prefix_grouped.
1886         * output.cc (Output_section::add_input_section): Revert last
1887         change.
1888         (Output_section::Input_section_sort::match_file_name): Don't crash
1889         if called on output section data.
1890         (Output_section::Input_section_sort_compare): Sort based on
1891         special ordering.
1892         (Output_section::Input_section_sort_section_order_index_compare):
1893         Revert last patch.
1894         (Output_section::sort_attached_input_sections): Likewise.
1895
1896 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1897
1898         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1899         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1900         * output.cc (Output_section::add_input_section): Check if section
1901         name contains special prefix.  Keep input sections to sort such
1902         sections.
1903         (Output_section::Input_section_sort_section_order_index_compare
1904          ::operator()): Group sections according to prefixes.
1905         (Output_section::sort_attached_input_sections): Add condition to
1906         Input_section_entry constructor call.
1907         * testsuite/Makefile.am (text_section_grouping): New test.
1908         * testsuite/Makefile.in: Regenerate.
1909         * testsuite/text_section_grouping.cc: New file.
1910         * testsuite/text_section_grouping.sh: New file.
1911
1912 2012-12-17  Nick Clifton  <nickc@redhat.com>
1913
1914         * Makefile.am: Add copyright notice.
1915         * NEWS: Likewise.
1916         * README: Likewise.
1917         * configure.ac: Likewise.
1918         * ftruncate.c: Likewise.
1919         * Makefile.in: Regenerate.
1920
1921 2012-12-14  Cary Coutant  <ccoutant@google.com>
1922
1923         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1924         --no-as-needed flag.
1925         (exception_separate_shared_12_test): Likewise.
1926         (incremental_copy_test): Likewise.
1927         * testsuite/Makefile.in: Regenerate.
1928
1929 2012-12-14  Cary Coutant  <ccoutant@google.com>
1930
1931         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1932         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1933
1934 2012-12-12  Alan Modra  <amodra@gmail.com>
1935
1936         * powerpc.cc (class Track_tls): New.
1937         (class Relocate, class Scan): Inherit Track_tls.
1938         (Target_powerpc::Scan::local, global): Track tls optimization
1939         and avoid creating plt entry for __tls_get_addr if all uses
1940         are optimized away.
1941         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1942
1943 2012-12-12  Alan Modra  <amodra@gmail.com>
1944
1945         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1946         Replace no_toc_optimize with toc_optimize.
1947         * output.h (Output_section::input_sections): Provide non-const variant.
1948         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1949         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1950         accessors.
1951         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1952         (class Sort_toc_sections): New.
1953         (Target_powerpc::do_finalize_sections): Sort toc sections.
1954         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1955
1956 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1957
1958         * testsuite/binary_unittest.cc (read_all): New function.
1959         (Sized_binary_test): Use it instead of ::read.
1960         * fileread.cc (do_read): Don't assume pread always reads the whole
1961         amount in a single call.
1962
1963 2012-12-10  Alan Modra  <amodra@gmail.com>
1964
1965         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1966         Set EM_PPC64 or EM_PPC here.
1967         (Target_selector_powerpc::do_recognize): Delete.
1968
1969 2012-12-10  Alan Modra  <amodra@gmail.com>
1970
1971         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1972         stub_table_.
1973         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1974
1975 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1976
1977         * testsuite/binary_unittest.cc (Sized_binary_test):
1978         Use open_descriptor rather than ::open.
1979
1980 2012-12-07  Alan Modra  <amodra@gmail.com>
1981
1982         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1983         typedef and invalid_address constant.
1984         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1985         instantiate constants.
1986
1987 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1988
1989         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1990         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1991         * aclocal.m4: Regenerate.
1992         * configure: Regenerate.
1993         * Makefile.in: Regenerate.
1994         * testsuite/Makefile.in: Regenerate.
1995
1996 2012-12-07  Alan Modra  <amodra@gmail.com>
1997
1998         * options.h (General_options): Add no_toc_optimize.
1999         * powerpc.cc (ok_lo_toc_insn): New function.
2000         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2001
2002 2012-12-06  Alan Modra  <amodra@gmail.com>
2003
2004         * options.h (General_options): Add plt_align, plt_static_chain,
2005         plt_thread_safe.  Update stub_group_size help text.
2006         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2007         for new plt_thread_safe_ var.
2008         (use_plt_offset): Correct comments.
2009         (Target_powerpc::do_relax): Look for thread creation symbols to
2010         determine default plt_thread_safe value.  Clear plt call stubs
2011         as well as branch stubs each iteration.
2012         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2013         insn constants.
2014         (l, hi, ha, write_insn): Move earlier.
2015         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2016         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2017         plt stubs too.
2018         (Stub_table::update_size): Adjust.
2019         (Stub_table::prev_size, set_prev_size): Delete.
2020         (Stub_table::stub_align): Let --plt-align affect result.
2021         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2022         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2023         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2024         (Stub_table::do_write): Support more stub variants.
2025
2026 2012-12-04  Alan Modra  <amodra@gmail.com>
2027
2028         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2029         (Target_powerpc::do_define_standard_symbols): New function.
2030
2031 2012-12-03  Alan Modra  <amodra@gmail.com>
2032
2033         * output.h: Formatting, whitespace.
2034
2035 2012-12-03  Alan Modra  <amodra@gmail.com>
2036
2037         * layout.h (Layout::get_executable_sections): Declare.
2038         * layout.cc (Layout::get_executable_sections): New function.
2039         * arm.cc (Target_arm::group_sections): Use it.
2040         (Arm_output_section::group_sections): Delete now redundant test.
2041         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2042         param to handle relative relocs.
2043         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2044         (Output_data_reloc::add_absolute): Adjust.
2045         (Output_data_reloc::add_relative): New function.
2046         (Output_data::reset_data_size): New function.
2047         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2048         (Output_section::set_addralign): New function.
2049         (Output_section::checkpoint_set_addralign): New function.
2050         (Output_section::clear_section_offsets_need_adjustment): New function.
2051         (Output_section::input_sections): Make public.
2052         * powerpc.cc (class Output_data_brlt_powerpc): New.
2053         (class Stub_table, class Stub_control): New.
2054         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2055         stub_table_, set_stub_table, stub_table): New vectors and accessor
2056         functions.
2057         (Target_powerpc::do_may_relax, do_relax, push_branch,
2058         new_stub_table, stub_tables, brlt_section, group_sections,
2059         add_branch_lookup_table, find_branch_lookup_table,
2060         write_branch_lookup_table, make_brlt_section): New functions.
2061         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2062         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2063         branch_info_): New vars.
2064         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2065         make call stubs here.
2066         (Output_data_glink): Remove all call stub handling from this class.
2067         (Target_powerpc::Scan::local, global): Save interesting branch
2068         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2069         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2070         functions on final link.
2071         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2072         Handle long branch destinations too.
2073         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2074         do_plt_address_for_local): Adjust lookup of plt call stubs.
2075
2076 2012-11-30  Alan Modra  <amodra@gmail.com>
2077
2078         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2079         relocs against protected symbols when building 32-bit shared libs.
2080
2081 2012-11-30  Alan Modra  <amodra@gmail.com>
2082
2083         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2084         param.  Call got_section() to make .got.  Update all callers
2085         and their callers and so on.
2086
2087 2012-11-30  Alan Modra  <amodra@gmail.com>
2088
2089         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2090         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2091         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2092         value if it already exists.
2093
2094 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2095
2096         PR gold/14858
2097         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2098
2099 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2100
2101         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2102         than bfc instruction for data sandboxing.
2103
2104 2012-11-08  Alan Modra  <amodra@gmail.com>
2105
2106         * po/POTFILES.in: Regenerate.
2107
2108 2012-11-05  Alan Modra  <amodra@gmail.com>
2109
2110         * configure.ac: Apply 2012-09-10 change to config.in here.
2111         * configure: Regenerate.
2112
2113 2012-11-05  Alan Modra  <amodra@gmail.com>
2114
2115         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2116         (struct Opd_ent): Use "Address" rather than "Offset".
2117         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2118         (Target_powerpc::got_section): Make public.
2119         (Target_powerpc::scan_relocs): Move code setting symbols..
2120         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2121         Create _SDA_BASE_ only when referenced.
2122
2123 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2124
2125         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2126         from last change.
2127
2128 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2129
2130         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2131         for offset_in_output_section parameter.
2132         (Sized_target::relocate_special_relocatable): Likewise.
2133         * arm.cc (Target_arm::relocate_relocs): Likewise.
2134         (Target_arm::relocate_special_relocatable): Likewise.
2135         * i386.cc (Target_i386::relocate_relocs): Likewise.
2136         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2137         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2138         * target-reloc.h (relocate_relocs): Likewise.
2139         * testsuite/testfile.cc (Target_test): Likewise.
2140         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2141         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2142
2143         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2144         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2145
2146         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2147         parameter, which is unused in the [!F_SETFD] case.
2148
2149         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2150         SYMNDX to off_t before comparing it to this->data_size().
2151         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2152         * incremental.cc (Output_section_incremental_inputs::do_write):
2153         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2154
2155         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2156
2157 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2158
2159         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2160         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2161         in EABI_VER5.
2162
2163 2012-10-29  Cary Coutant  <ccoutant@google.com>
2164
2165         * dwp.cc (usage): Add file and exit status parameters;
2166         add --help and --version options.
2167         (print_version): New function.
2168         (main): Add --help and --version options.
2169
2170 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2171
2172         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2173         final_layout_sequence.txt.
2174         * testsuite/Makefile.in: Regenerated.
2175
2176 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2177
2178         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2179         COMPILE generated by automake.
2180         (LINK1): Likewise.
2181         (CXXCOMPILE1): Likewise.
2182         (CXXLINK1): Likewise.
2183         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2184         (LINK): Likewise.
2185         (CXXCOMPILE): Likewise.
2186         (CXXLINK): Likewise.
2187         * testsuite/Makefile.in: Regenerated.
2188
2189 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2190
2191         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2192         on bad fwrite return.
2193
2194 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2195
2196         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2197         on val.
2198
2199 2012-10-23  Cary Coutant  <ccoutant@google.com>
2200
2201         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2202         * testsuite/Makefile.in: Regenerate.
2203         * testsuite/dwp_test.h: New source file.
2204         * testsuite/dwp_test_1.cc: New source file.
2205         * testsuite/dwp_test_1.s: New source file.
2206         * testsuite/dwp_test_1.sh: New source file.
2207         * testsuite/dwp_test_1b.cc: New source file.
2208         * testsuite/dwp_test_1b.s: New source file.
2209         * testsuite/dwp_test_2.cc: New source file.
2210         * testsuite/dwp_test_2.s: New source file.
2211         * testsuite/dwp_test_2.sh: New source file.
2212         * testsuite/dwp_test_main.cc: New source file.
2213         * testsuite/dwp_test_main.s: New source file.
2214
2215 2012-10-23  Cary Coutant  <ccoutant@google.com>
2216
2217         * dwp.h: New header file.
2218         * dwp.cc: New source file.
2219         * gold.h: Move shared declarations to system.h.
2220         * system.h: New header file.
2221         * Makefile.am: Add dwp.
2222         * Makefile.in: Regenerate.
2223
2224 2012-10-23  Cary Coutant  <ccoutant@google.com>
2225
2226         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2227         Dwarf_info_reader::read_from_pointer.
2228         (Dwarf_pubnames_table::read_header): Likewise.
2229         (Dwarf_pubnames_table::next_name): Likewise.
2230         (Dwarf_die::read_attributes): Likewise.
2231         (Dwarf_die::skip_attributes): Likewise.
2232         (Dwarf_info_reader::read_from_pointer): New function template.
2233         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2234         (Dwarf_pubnames_table): Likewise.
2235         (Dwarf_info_reader::read_from_pointer): New function template.
2236         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2237         Dwarf_pubnames_table ctor.
2238
2239 2012-10-23  Cary Coutant  <ccoutant@google.com>
2240
2241         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2242         abbrev_shndx.
2243         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2244         abbrev_shndx_.
2245         (Dwarf_info_reader::set_abbrev_shndx): New method.
2246         (Dwarf_info_reader::abbrev_shndx_): New data member.
2247
2248 2012-10-23  Cary Coutant  <ccoutant@google.com>
2249
2250         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2251         from object, not parameters.
2252         (Dwarf_info_reader::parse): Likewise.
2253         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2254         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2255         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2256         methods.
2257
2258 2012-10-23  Cary Coutant  <ccoutant@google.com>
2259
2260         * fileread.cc (Input_file::Input_file): New constructor.
2261         * fileread.h (class Input_file): Add new constructor.
2262
2263 2012-10-18  Alan Modra  <amodra@gmail.com>
2264
2265         PR gold/14727
2266         * object.cc (Relobj::is_section_name_included): Also match
2267         .sdata personality section.
2268
2269 2012-10-18  Alan Modra  <amodra@gmail.com>
2270
2271         * target-reloc.h (class Default_comdat_behavior): New, package up..
2272         (get_comdat_behaviour): ..this.
2273         (relocate_section): Add Relocate_comdat_behavior template arg,
2274         adjust code to suit.
2275         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2276         (Target_arm::scan_reloc_section): Likewise.
2277         * i386.cc (Target_i386::relocate_section): Likewise.
2278         * sparc.cc (Target_sparc::relocate_section): Likewise.
2279         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2280         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2281         * powerpc.cc (class Relocate_comdat_behavior): New.
2282         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2283         gold::relocate_section with new template arg.
2284
2285 2012-10-18  Alan Modra  <amodra@gmail.com>
2286
2287         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2288         dynamic relocs for GOT_TPREL got entries, without symbol if
2289         resolving locally.
2290         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2291         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2292         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2293
2294 2012-10-17  Alan Modra  <amodra@gmail.com>
2295
2296         PR gold/14726
2297         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2298
2299 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2300
2301         * layout.cc (Layout::include_section): Keep sections marked
2302         SHF_EXCLUDE when doing relocatable links.
2303
2304 2012-10-16  Alan Modra  <amodra@gmail.com>
2305
2306         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2307         (Target_powerpc::do_finalize_sections): Call it.
2308         (Output_data_save_res): New class and supporting functions.
2309         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2310         normal symbols defined in object files.
2311
2312 2012-10-12  Alan Modra  <amodra@gmail.com>
2313
2314         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2315         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2316         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2317         section if scan_opd_relocs not yet called.
2318         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2319
2320 2012-10-12  Alan Modra  <amodra@gmail.com>
2321
2322         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2323         add_local_ifunc_entry): Revert last change.
2324         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2325
2326 2012-10-05  Alan Modra  <amodra@gmail.com>
2327
2328         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2329         do_plt_address_for_global): New functions.
2330         (Output_data_got_powerpc::do_write): Don't segfault when linking
2331         statically.
2332         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2333         add_local_ifunc_entry): Return true on adding entry..
2334         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2335         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2336         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2337         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2338         set up symbols here.
2339         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2340         syms here.  Do so even when no .iplt.  Don't segfault when linking
2341         statically.
2342         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2343         new variants without reloc param.
2344         (Glink_sym_ent::Glink_sym_ent): Likewise.
2345         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2346         reloc when refs will resolve to plt call stub.
2347         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2348         R_PPC_PLTREL24 to resolve locally.
2349         (Target_powerpc::Scan::global): Correct ifunc handling.
2350         (Target_powerpc::Relocate::relocate): Correct local sym glink
2351         lookup.  Don't destroy "value" when we have a plt call stub,
2352         and when checking plt call validity.
2353         (Target_powerpc::do_dynsym_value): Simplify.
2354
2355 2012-10-05  Alan Modra  <amodra@gmail.com>
2356
2357         * i386.cc (Output_data_plt_i386::address_for_global,
2358         address_for_local): Add plt offset to returned value.  Adjust uses.
2359         * sparc.cc (Output_data_plt_sparc::address_for_global,
2360         address_for_local): Likewise.
2361         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2362         address_for_local): Likewise.
2363         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2364         address_for_local): Likewise.
2365         * target.h (Target::plt_address_for_global, plt_address_for_local):
2366         Update comment.
2367         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2368         (Output_data_got::Got_entry::write): Nor here.
2369         * output.h: Comment fix.
2370
2371 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2372
2373         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2374         global_offset_table_ value for larget got.
2375         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2376
2377 2012-09-29  Alan Modra  <amodra@gmail.com>
2378
2379         * powerpc.cc (Target_powerpc::iplt_): New output section.
2380         (Target_powerpc::iplt_section, make_iplt_section,
2381         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2382         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2383         Target_powerpc::plt_entry_count): Count iplt entries too.
2384         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2385         reloc section in constructor.  New params.
2386         (Target_powerpc::make_plt_section): Create reloc section here instead.
2387         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2388         functions.
2389         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2390         (Output_data_glink::add_entry, find_entry): New functions to
2391         deal with local syms.
2392         (Glink_sym_ent): Add support for local syms.
2393         (Output_data_glink::do_write): Handle ifunc plt entries.
2394         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2395         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2396         (Target_powerpc::Relocate::relocate): Likewise.
2397         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2398
2399 2012-09-25  Alan Modra  <amodra@gmail.com>
2400
2401         * object.h (Sized_relobj_file::adjust_local_symbol,
2402         do_adjust_local_symbol): New functions.
2403         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2404         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2405         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2406         and irregular opd entry spacing.
2407         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2408         (Global_symbol_visitor_opd): New functor.
2409         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2410         on deleted opd entries.
2411
2412 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2413
2414         * tilegx.cc: New file.
2415         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2416         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2417         * configure.tgt: Add entries for tilegx*.
2418         * configure.ac: Likewise.
2419         * Makefile.in: Rebuild.
2420         * configure: Likewise.
2421         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2422         tilegx.
2423
2424 2012-09-13  Alan Modra  <amodra@gmail.com>
2425
2426         * target-reloc.h (scan_relocs): Call scan.local for relocs
2427         against symbols in discarded sections.  Pass is_discarded
2428         param.
2429         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2430         Add is_discarded param.
2431         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2432         is_discarded to flag opd entry as discarded.  Don't emit dyn
2433         relocs on such entries.
2434         (Target_powerpc::Scan::global): Similarly detect and handle
2435         such opd entries.
2436         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2437         opd_ent_.  Update all uses.
2438         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2439         (Target_powerpc::relocate_section): Zero out discarded opd
2440         entry relocs.
2441
2442 2012-09-12  Ian Lance Taylor  <iant@google.com>
2443
2444         PR gold/14570
2445         * output.cc: Rename Output_data_got template parameter from size
2446         to got_size for all functions.  Compile all variants of
2447         Output_data_got.
2448         (Output_data_got::Got_entry::write): Correct use of size for
2449         symbol value.  Use local_is_tls rather than casting to
2450         Sized_relobj_file.
2451         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2452         (class Sized_relobj_file): Add do_local_is_tls.
2453         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2454
2455 2012-09-11  Alan Modra  <amodra@gmail.com>
2456
2457         PR gold/14566
2458         * layout.cc (Layout::set_segment_offsets): When using
2459         common-page-size alignment, ensure we are on a new max-page-size
2460         page.
2461         * output.cc (Output_segment::set_section_addresses): Use
2462         abi_pagesize, not common_pagesize for relro boundary.
2463         (Output_segment::set_offset): Likewise.
2464
2465 2012-09-11  Alan Modra  <amodra@gmail.com>
2466
2467         * output.h (Output_data_got::add_global_tls, add_local_tls,
2468         add_local_tls_pair): New functions.
2469         (Output_data_got::add_local_pair_with_rel): Remove second
2470         reloc param.  Expand comment.
2471         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2472         use_plt_or_tls_offset_, similarly for constructor param.
2473         (Output_data_got::Got_entry::write): Add got_index param.
2474         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2475         add_local_tls_pair): New functions.
2476         (Output_data_got::Got_entry::write): Handle tls symbols
2477         with use_plt_or_tls_offset_ set specially.
2478         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2479         (Output_data_got::do_write): Replace iterator with index, pass
2480         index to entry write function.
2481         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2482         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2483         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2484         call.
2485         * i386.cc (Target_i386::Scan::local): Likewise.
2486         * sparc.cc (Target_sparc::Scan::local): Likewise.
2487         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2488         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2489         do_tls_offset_for_global): New functions.
2490         (Target_powerpc::Scan::local): Correct TLS relocations and got
2491         entry values.
2492         (Target_powerpc::Scan::global): Don't emit unnecessary
2493         dynamic relocations on TLS GOT entries.
2494
2495 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2496
2497         * config.in: Disable sanity check for kfreebsd.
2498
2499 2012-09-10  Sterling Augustine  <saugustine@google.com>
2500
2501         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2502         (Gdb_index::pubtypes_read): New parameter.
2503         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2504         to calls.
2505         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2506         pubtypes_object_.
2507
2508 2012-09-09  Alan Modra  <amodra@gmail.com>
2509
2510         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2511         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2512         * gc.h (gc_process_relocs): Call target gc_add_reference.
2513         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2514         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2515         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2516         unnecessary cast.
2517         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2518         to cater for when we don't need code offset.  Update use.
2519         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2520         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2521         set_opd_valid): New functions.
2522         (Target_powerpc::do_gc_add_reference): New function.
2523         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2524         stashed refs.
2525         (Target_powerpc::do_gc_mark_symbol): New function.
2526
2527 2012-09-06  Cary Coutant  <ccoutant@google.com>
2528
2529         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2530         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2531         (Dwarf_die::skip_attributes): Likewise.
2532         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2533         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2534         (main): Call it.
2535         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2536
2537 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2538
2539         * testsuite/script_test_3.t: Add .got.plt output section
2540         statement.
2541         * testsuite/script_test_4.t: Likewise.
2542
2543 2012-09-05  Alan Modra  <amodra@gmail.com>
2544
2545         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2546         update all uses and lose "enum" when using type.
2547
2548 2012-09-05  Alan Modra  <amodra@gmail.com>
2549
2550         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2551         * configure: Regenerate.
2552         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2553         (plugin_final_layout.stdout): Likewise.
2554         (memory_test): Set page sizes to 0x1000.
2555         * testsuite/Makefile.in: Regenerate.
2556         * testsuite/discard_locals_test.sh: Add FIXME comment.
2557         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2558         * testsuite/pr14265.t: Add .got output section statement.
2559         * testsuite/script_test_2.t: Likewise.
2560         * testsuite/script_test_3.t: Likewise.
2561         * testsuite/script_test_4.t: Likewise.
2562         * testsuite/script_test_5.t: Likewise.
2563         * testsuite/script_test_6.t: Likewise.
2564         * testsuite/script_test_7.t: Likewise.
2565         * testsuite/script_test_9.t: Likewise.
2566
2567 2012-09-05  Alan Modra  <amodra@gmail.com>
2568
2569         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2570         (Powerpc_relocate_functions::Status): New typedef.
2571         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2572         (Target_powerpc::Scan::local): Handle REL64.
2573         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2574         for REL32 and REL64.
2575         (Target_powerpc::symval_for_branch): New function, extracted from..
2576         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2577         checks.  Report overflow errors.
2578
2579 2012-09-05  Alan Modra  <amodra@gmail.com>
2580
2581         * object.h (Sized_relobj_file::emit_relocs): Delete.
2582         (Sized_relobj_file::emit_relocs_reltype): Delete.
2583         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2584         relocate_relocs for --emit-relocs.
2585         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2586         * output.h: Update comment.
2587         (Output_segment::first_section): New function.
2588         (Output_segment::first_section_load_address): Use first_section.
2589         * output.cc (Output_segment::first_section): New function extracted..
2590         (Output_segment::first_section_load_address): ..from here.  Delete.
2591         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2592         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2593         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2594         adjust call to target.h function.
2595         * i386.cc (Target_i386): Likewise.
2596         * sparc.cc (Target_sparc): Likewise.
2597         * x86_64.cc (Target_x86_64): Likewise.
2598         * powerpc.cc (Target_powerpc): Likewise.
2599         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2600         first tls section has section symbol for optimised local dynamic
2601         output relocs.
2602         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2603         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2604         optimised tls code.
2605         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2606         Rename to relocate_relocs.  Update error message.
2607
2608 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2609
2610         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2611         --just-symbols.
2612
2613 2012-08-31  Alan Modra  <amodra@gmail.com>
2614
2615         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2616         (Powerpc_relobj::toc_base_offset): New stub function.
2617         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2618         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2619         (Target_powerpc::Relocate::enum skip_tls): New.
2620         (Target_powerpc::call_tls_get_addr_): New var.
2621         (Target_powerpc::is_branch_reloc): Move to file scope.
2622         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2623         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2624         New functions.
2625         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2626         (powerpc_info): Correct common_pagesize for ppc64.
2627         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2628         (Powerpc_relocate_functions): Add overflow check enums and functions.
2629         Add non-shift version of rela, rela_ua.  Delete all rel public
2630         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2631         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2632         addr16_ha3, addr14 functions.
2633         (Output_data_got_powerpc::add_constant_pair): New function.
2634         (Output_data_got_powerpc::got_base_offset): Likewise.
2635         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2636         (instruction constants): Sort, add some more.
2637         (Output_data_glink::do_write): Add and use Address typedef.  Use
2638         object->toc_base_offset() stub for 64-bit.
2639         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2640         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2641         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2642         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2643         Always treat .opd relocs as against locally defined symbol.
2644         Correct condition for RELATIVE relocs.
2645         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2646         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2647         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2648         calculations.  Handle TLS relocs, and more.  Add overflow
2649         checking and adjust for Powerpc_relocate_functions changes.
2650         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2651         Reinstate --emit-relocs code with FIXME.
2652
2653 2012-08-30  Alan Modra  <amodra@gmail.com>
2654
2655         * layout.cc (Layout::set_segment_offsets): Set p_align to
2656         abi_pagesize, not common_pagesize.
2657         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2658         to determine whether file header can go in segment.
2659
2660 2012-08-30  Alan Modra  <amodra@gmail.com>
2661
2662         * output.h (Output_reloc::Output_reloc <output section>): Add
2663         is_relative param.  Adjust calls.
2664         (Output_reloc::add_output_section_relative): New functions.
2665         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2666         is_relative.
2667         (Output_reloc::symbol_value): Handle SECTION_CODE.
2668
2669 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2670
2671         * gold.cc (queue_middle_tasks): Call layout again when unique
2672         segments for sections is desired.
2673         * layout.cc (Layout::Layout): Initialize new members.
2674         (Layout::get_output_section_flags): New function.
2675         (Layout::choose_output_section): Call get_output_section_flags.
2676         (Layout::layout): Make output section for mapping to a unique segment.
2677         (Layout::insert_section_segment_map): New function.
2678         (Layout::attach_allocated_section_to_segment): Make unique segment for
2679         output sections marked so.
2680         (Layout::segment_precedes): Check for unique segments when sorting.
2681         * layout.h (Layout::Unique_segment_info): New struct.
2682         (Layout::Section_segment_map): New typedef.
2683         (Layout::insert_section_segment_map): New function.
2684         (Layout::get_output_section_flags): New function.
2685         (Layout::is_unique_segment_for_sections_specified): New function.
2686         (Layout::set_unique_segment_for_sections_specified): New function.
2687         (Layout::unique_segment_for_sections_specified_): New member.
2688         (Layout::section_segment_map_): New member.
2689         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2690         Rename is_gc_pass_one to is_pass_one.
2691         Rename is_gc_pass_two to is_pass_two.
2692         Rename is_gc_or_icf to is_two_pass.
2693         Check for which pass based on whether symbols data is present.
2694         Make it two pass when unique segments for sections is desired.
2695         * output.cc (Output_section::Output_section): Initialize new
2696         members.
2697         * output.h (Output_section::is_unique_segment): New function.
2698         (Output_section::set_is_unique_segment): New function.
2699         (Output_section::is_unique_segment_): New member.
2700         (Output_section::extra_segment_flags): New function.
2701         (Output_section::set_extra_segment_flags): New function.
2702         (Output_section::extra_segment_flags_): New member.
2703         (Output_section::segment_alignment): New function.
2704         (Output_section::set_segment_alignment): New function.
2705         (Output_section::segment_alignment_): New member.
2706         (Output_segment::Output_segment): Initialize is_unique_segment_.
2707         (Output_segment::is_unique_segment): New function.
2708         (Output_segment::set_is_unique_segment): New function.
2709         (Output_segment::is_unique_segment_): New member.
2710         * plugin.cc (allow_unique_segment_for_sections): New function.
2711         (unique_segment_for_sections): New function.
2712         (Plugin::load): Add new functions to transfer vector.
2713         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2714         * Makefile.in: Regenerate.
2715         * testsuite/plugin_final_layout.sh: Check if unique segment
2716         functionality works.
2717         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2718         are available.
2719         (allow_unique_segment_for_sections): New global.
2720         (unique_segment_for_sections): New global.
2721         (claim_file_hook): Call allow_unique_segment_for_sections.
2722         (all_symbols_read_hook): Call unique_segment_for_sections.
2723
2724 2012-08-22  Cary Coutant  <ccoutant@google.com>
2725
2726         * layout.cc (Layout::include_section): Don't assert on GROUP
2727         sections with --emit-relocs.
2728
2729 2012-08-21  Cary Coutant  <ccoutant@google.com>
2730
2731         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2732         if --export-dynamic-symbol names an undef symbol.
2733
2734 2012-08-18  Alan Modra  <amodra@gmail.com>
2735
2736         * powerpc.cc: Formatting and white space.
2737         (Powerpc_relobj): Rename got2_section_ to special_.
2738         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2739         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2740         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2741         (Target_powerpc): Add Address typedef and invalid_address.  Use
2742         throughout.
2743         (Target_powerpc::is_branch_reloc): New function.
2744         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2745         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2746         for dst_mask, value and addend.
2747         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2748         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2749         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2750         uint16_t for 24-bit offset.  Use get_output_section_offset and
2751         check return.
2752         (Target_powerpc::Scan::local): Handle more relocs.
2753         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2754         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2755         Plug in toc restoring insn after plt calls.  Translate branches
2756         to function descriptor symbols to corresponding entry point.
2757         (Target_powerpc::relocate_for_relocatable): Check return from
2758         get_output_section_offset.
2759         * symtab.h: Comment typo.
2760
2761 2012-08-14  Ian Lance Taylor  <iant@google.com>
2762
2763         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2764         unsupported_relocal_local to call unsupported_reloc_global.
2765
2766 2012-08-14  Nick Clifton  <nickc@redhat.com>
2767
2768         PR ld/14265
2769         * script-sections.cc (Sections_element::output_section_name): Add
2770         keep return parameter.
2771         (Output_section_element::match_name): Add keep return parameter.
2772         Return the value of the keep_ member.
2773         * script-sections.h (class Output_section): Update
2774         output_section_name prototype.
2775         * layout.cc (Layout::keep_input_section): New public member
2776         function.
2777         (Layout::choose_output_section): Pass keep parameter to
2778         output_section_name.
2779         * layout.h (class Layout): Add keep_input_section.
2780         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2781         sections.
2782         * testsuite/Makefile.am: Add a test.
2783         * testsuite/Makefile.in: Regenerate.
2784         * testsuite/pr14265.c: Source file for the test.
2785         * testsuite/pr14265.t: Linker script for the test.
2786         * testsuite/pr14265.sh: Shell script for the test.
2787
2788 2012-08-14  Alan Modra  <amodra@gmail.com>
2789
2790         * target.h (Target::output_section_name): New function.
2791         (Target::do_output_section_name): New function.
2792         * layout.cc (Layout::choose_output_section): Call the above.
2793         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2794
2795 2012-08-14  Alan Modra  <amodra@gmail.com>
2796
2797         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2798         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2799         for replace_constant call.
2800         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2801         (Output_data_glink::do_print_to_mapfile): New function.
2802         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2803         (Target_powerpc::Relocate::relocate): Likewise.
2804
2805 2012-08-14  Alan Modra  <amodra@gmail.com>
2806
2807         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2808         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2809         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2810         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2811         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2812         here.
2813         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2814         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2815         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2816         here.
2817         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2818         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2819
2820 2012-08-12  Alan Modra  <amodra@gmail.com>
2821
2822         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2823         (glink insn constants): Use uint32_t.
2824         (Output_data_glink::add_entry): Use insert, not [] operator.
2825
2826 2012-08-11  Alan Modra  <amodra@gmail.com>
2827
2828         * object.h (Sized_relobj_file::find_shdr): New function.
2829         (Sized_relobj_file::find_special_sections): New function.
2830         * object.cc (Sized_relobj_file::find_shdr): New function.
2831         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2832         (Sized_relobj_file::find_special_sections): New function, split out..
2833         (Sized_relobj_file::do_read_symbols): ..from here.
2834         * output.h (Output_data_got::replace_constant): New function.
2835         (Output_data_got::num_entries): New function.
2836         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2837         (Output_data_got::got_offset): Protected rather than private.
2838         (Output_data_got::replace_got_entry): New function.
2839         * output.cc (Output_data_got::replace_got_entry): New function.
2840         * powerpc.cc (class Powerpc_relobj): New.
2841         (class Powerpc_relocate_functions): Delete all psymval variants or
2842         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2843         Implement _ha functions using corresponding _hi function.
2844         (Powerpc_relobj::find_special_sections): New function.
2845         (Target_powerpc::do_make_elf_object): New function.
2846         (class Output_data_got_powerpc): New.
2847         (class Output_data_glink): New.
2848         (class Powerpc_scan_relocatable_reloc): New.
2849         Many more changes througout file.
2850
2851 2012-08-09  Nick Clifton  <nickc@redhat.com>
2852
2853         * po/vi.po: Updated Vietnamese translation.
2854
2855 2012-08-07  Ian Lance Taylor  <iant@google.com>
2856
2857         * layout.cc (Layout::add_target_dynamic_tags): If
2858         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2859         plt_rel.
2860
2861 2012-07-30  Nick Clifton  <nickc@redhat.com>
2862
2863         * po/gold.pot: Updated template.
2864         * po/es.po: Updated Spanish translation.
2865
2866 2012-07-18  Cary Coutant  <ccoutant@google.com>
2867
2868         PR gold/14344
2869         * configure.ac: Add check for -gpubnames support.
2870         * configure: Regenerate.
2871         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2872         support; force -gno-pubnames.
2873         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2874         support.
2875         (gdb_index_test_4): New test.
2876         * testsuite/Makefile.in: Regenerate.
2877         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2878         * testsuite/gdb_index_test_2.sh: Likewise.
2879         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2880         * testsuite/gdb_index_test_4.sh: New script.
2881         * testsuite/gdb_index_test_comm.sh: New script with common code;
2882         don't look for space after colon.
2883
2884 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2885
2886         * gold.cc (queue_middle_tasks): Update function order only after
2887         deferred objects due to plugins are processed.
2888
2889 2012-07-11  Ian Lance Taylor  <iant@google.com>
2890
2891         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2892         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2893         (Target_arm::scan_reloc_for_stub): Likewise.
2894         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2895         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2896         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2897         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2898         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2899
2900 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2901             Ian Lance Taylor  <iant@google.com>
2902
2903         PR gold/14309
2904         * configure.ac: Test whether std::tr1::hash<off_t> works.
2905         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2906         needed.
2907         * output.h (class Output_fill): Add virtual destructor.
2908         * configure, config.in: Rebuild.
2909
2910 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2911
2912         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2913
2914 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2915
2916         * plugin.cc (Plugin::load): Handle position independent executables.
2917
2918 2012-06-06  Cary Coutant  <ccoutant@google.com>
2919
2920         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2921         add .debug_macro.
2922         (lines_only_debug_sections): Likewise.
2923         (gdb_fast_lookup_sections): New static array.
2924         (is_gdb_debug_section): Rename formal parameter.
2925         (is_lines_only_debug_section): Likewise.
2926         (is_gdb_fast_lookup_section): New function.
2927         (Layout::include_section): Check for ".zdebug_" prefix; pass
2928         section name suffix to is_gdb_debug_section, et al.; check for
2929         fast-lookup sections when building .gdb_index.
2930         * options.h (--strip-debug-gdb): Update GDB version number.
2931
2932 2012-06-06  Cary Coutant  <ccoutant@google.com>
2933
2934         * configure.ac: Add check for fallocate.
2935         * configure: Regenerate.
2936         * config.in: Regenerate.
2937
2938         * options.h (class General_options): Add --mmap-output-file and
2939         --posix-fallocate options.
2940         * output.cc: (posix_fallocate): Remove; replace with...
2941         (gold_fallocate): New function.
2942         (Output_file::map_no_anonymous): Call gold_fallocate.
2943         (Output_file::map): Check --mmap-output-file option.
2944
2945 2012-06-05  Jing Yu  <jingyu@google.com>
2946
2947         * gold.h (textdomain): Add do {} to empty while(0).
2948         (bindtextdomain): Likewise.
2949
2950 2012-06-04  Cary Coutant  <ccoutant@google.com>
2951
2952         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2953         has_dynsym_index.
2954
2955 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2956
2957         * symtab.cc (Symbol_table::define_special_symbol):
2958         Initialize *poldsym to prevent uninitialized variable errors.
2959
2960 2012-05-23  Cary Coutant  <ccoutant@google.com>
2961
2962         * layout.cc (Layout::section_name_mapping): Add rules to handle
2963         exact match on .data.rel.ro.local or .data.rel.ro.
2964         (Layout::output_section_name): Check for exact matches.
2965
2966 2012-05-23  Cary Coutant  <ccoutant@google.com>
2967
2968         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2969         more carefully.
2970
2971 2012-05-22  Cary Coutant  <ccoutant@google.com>
2972
2973         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2974         object before exporting symbol.
2975
2976 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2977
2978         * testsuite/tls_test.cc: Include "config.h" first.
2979         * testsuite/tls_test_c.c: Likewise.
2980
2981 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2982             Nick Clifton  <nickc@redhat.com>
2983
2984         PR 14072
2985         * configure.in: Add check that sysdep.h has been included before
2986         any system header files.
2987         * configure: Regenerate.
2988         * config.in: Regenerate.
2989
2990 2012-05-14  Cary Coutant  <ccoutant@google.com>
2991
2992         * layout.cc (Layout::make_output_section): Mark .tdata section
2993         as RELRO.
2994         * testsuite/relro_test.cc: Add a TLS variable.
2995
2996 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2997
2998         PR gold/14091
2999         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3000         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3001         R_X86_64_64.
3002
3003 2012-05-08  Cary Coutant  <ccoutant@google.com>
3004
3005         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3006         (lines_only_debug_sections): Likewise.
3007
3008 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3009
3010         * nacl.cc: New file.
3011         * nacl.h: New file.
3012         * Makefile.am (CCFILES, HFILES): Add them.
3013         * Makefile.in: Regenerate.
3014         * i386.cc (Output_data_plt_i386_nacl): New class.
3015         (Output_data_plt_i386_nacl_exec): New class.
3016         (Output_data_plt_i386_nacl_dyn): New class.
3017         (Target_i386_nacl): New class.
3018         (Target_selector_i386_nacl): New class.
3019         (target_selector_i386): Use it instead of Target_selector_i386.
3020         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3021         (Target_x86_64_nacl): New class.
3022         (Target_selector_x86_64_nacl): New class.
3023         (target_selector_x86_64, target_selector_x32): Use it instead of
3024         Target_selector_x86_64.
3025         * arm.cc (Output_data_plt_arm_nacl): New class.
3026         (Target_arm_nacl): New class.
3027         (Target_selector_arm_nacl): New class.
3028         (target_selector_arm, target_selector_armbe): Use it instead of
3029         Target_selector_arm.
3030
3031         * target-select.cc (select_target): Take new Input_file* and off_t
3032         arguments, pass them on to recognize method of selector.
3033         * object.cc (make_elf_sized_object): Update caller.
3034         * parameters.cc (parameters_force_valid_target): Likewise.
3035         * incremental.cc (make_sized_incremental_binary): Likewise.
3036         * target-select.h: Update decl.
3037         (Target_selector::recognize): Take new Input_file* argument,
3038         pass it on to do_recognize.
3039         (Target_selector::do_recognize): Take new Input_file* argument.
3040         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3041         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3042         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3043         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3044
3045         * target.h (Target::Target_info): New members isolate_execinstr
3046         and rosegment_gap.
3047         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3048         * arm.cc (Target_arm::arm_info): Update initializer.
3049         * i386.cc (Target_i386::i386_info): Likewise.
3050         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3051         * sparc.cc (Target_sparc::sparc_info): Likewise.
3052         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3053         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3054         * layout.cc (Layout::attach_allocated_section_to_segment):
3055         Take new const Target* argument.  If target->isolate_execinstr(), act
3056         like --rosegment.
3057         (Layout::find_first_load_seg): Take new const Target* argument;
3058         if target->isolate_execinstr(), reject PF_X segments.
3059         (Layout::relaxation_loop_body): Update caller.
3060         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3061         reset file offset to zero when we hit LOAD_SEG, and then do a second
3062         loop over the segments before LOAD_SEG to reassign offsets after
3063         addresses have been determined.  Handle target->rosegment_gap().
3064         (Layout::attach_section_to_segment): Take new const Target* argument;
3065         pass it to attach_allocated_section_to_segment.
3066         (Layout::make_output_section): Update caller.
3067         (Layout::attach_sections_to_segments): Take new const Target* argument;
3068         pass it to attach_section_to_segment.
3069         * gold.cc (queue_middle_tasks): Update caller.
3070         * layout.h (Layout): Update method decls with new arguments.
3071
3072         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3073         Target_info pointer to use.
3074         (Target_arm::do_make_data_plt): New virtual method.
3075         (Target_arm::make_data_plt): New method that calls it.
3076         (Target_arm::make_plt_entry): Use it.
3077         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3078         for the section alignment.
3079         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3080         method.
3081         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3082         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3083         method.
3084         (Output_data_plt_arm::get_plt_entry_size): Call it.
3085         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3086         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3087         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3088         method.
3089         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3090         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3091         method instead of sizeof(plt_entry).
3092         (Output_data_plt_arm::add_entry): Likewise.
3093         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3094         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3095         than static method.
3096         (Target_arm::plt_entry_size): Likewise.
3097         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3098         Move to ...
3099         (Output_data_plt_arm_standard): ... here, new class.
3100         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3101         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3102         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3103
3104         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3105         Take additional argument for the PLT entry size.
3106         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3107         Use get_plt_entry_size method rather than plt_entry_size variable.
3108         (Output_data_plt_x86_64::reserve_slot): Likewise.
3109         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3110         (Output_data_plt_x86_64::add_entry): Likewise.
3111         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3112         (Output_data_plt_x86_64::address_for_global): Likewise.
3113         (Output_data_plt_x86_64::address_for_local): Likewise.
3114         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3115         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3116         Make method non-static.
3117         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3118         method.
3119         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3120         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3121         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3122         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3123         virtual method.
3124         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3125         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3126         virtual method.
3127         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3128         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3129         virtual method.
3130         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3131         (Output_data_plt_x86_64::plt_entry_size)
3132         (Output_data_plt_x86_64::first_plt_entry)
3133         (Output_data_plt_x86_64::plt_entry)
3134         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3135         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3136         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3137         (Output_data_plt_x86_64_standard): ... here, new class.
3138         (Target_x86_64::Target_x86_64): Take optional argument for the
3139         Target_info pointer to use.
3140         (Target_x86_64::do_make_data_plt): New virtual method.
3141         (Target_x86_64::make_data_plt): New method to call it.
3142         (Target_x86_64::init_got_plt_for_update): Use that.
3143         Call this->plt_->add_eh_frame method here.
3144         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3145         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3146         rather than static method.
3147         (Target_x86_64::plt_entry_size): Likewise.
3148         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3149         rather than plt_entry_size variable.  Move guts of PLT filling to...
3150         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3151         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3152         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3153
3154         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3155         additional argument for the section alignment.
3156         Don't do add_eh_frame_for_plt here.
3157         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3158         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3159         variable.
3160         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3161         method.
3162         (Output_data_plt_i386::get_plt_entry_size): Call it.
3163         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3164         (Output_data_plt_i386::add_eh_frame): New method to call it.
3165         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3166         method.
3167         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3168         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3169         method.
3170         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3171         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3172         method instead of plt_entry_size.
3173         (Output_data_plt_i386::plt_entry_size)
3174         (Output_data_plt_i386::plt_eh_frame_fde_size)
3175         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3176         (Output_data_plt_i386_standard): ... here, new class.
3177         (Output_data_plt_i386_exec): New class.
3178         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3179         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3180         (Output_data_plt_i386::exec_plt_entry): Move to ...
3181         (Output_data_plt_i386_exec::plt_entry): ... here.
3182         (Output_data_plt_i386_dyn): New class.
3183         (Output_data_plt_i386::first_plt_entry): Move to ...
3184         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3185         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3186         (Output_data_plt_i386_dyn::plt_entry): ... here.
3187         (Target_i386::Target_i386): Take optional argument for the Target_info
3188         pointer to use.
3189         (Target_i386::do_make_data_plt): New virtual method.
3190         (Target_i386::make_data_plt): New method to call it.
3191         (Target_i386::make_plt_section): Use that.
3192         Call this->plt_->add_eh_frame method here.
3193         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3194         rather than plt_entry_size variable.
3195         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3196         (Output_data_plt_i386::address_for_local): Likewise.
3197         (Output_data_plt_i386::do_write): Likewise.
3198         Move guts of PLT filling to...
3199         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3200         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3201         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3202         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3203
3204 2012-05-01  Cary Coutant  <ccoutant@google.com>
3205
3206         * dwarf_reader.cc (Dwarf_die::read_attributes)
3207         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3208         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3209         * reduced_debug_output.cc
3210         (Output_reduced_debug_info_section::get_die_end): Remove
3211         DW_FORM_GNU_ref_index.  Add default case.
3212
3213 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3214
3215         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3216         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3217         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3218         DW_AT_high_pc as offset from DW_AT_low_pc.
3219
3220         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3221         * testsuite/Makefile.in: Regenerate.
3222         * testsuite/gdb_index_test_3.c: New test source file.
3223         * testsuite/gdb_index_test_3.sh: New test source file.
3224
3225 2012-04-25  Ian Lance Taylor  <iant@google.com>
3226
3227         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3228         pointer.
3229         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3230         as a class, not a struct.
3231         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3232         (Target_arm::apply_cortex_a8_workaround): Likewise.
3233         * gc.h: Declare Reloc_types as a struct, not a class.
3234         * object.h: Declare Symbols_data as a struct.
3235         * reloc.h: Declare Read_relocs_data as a struct.
3236         * target.h: Declare Relocate_info as a struct.
3237
3238 2012-04-24  David S. Miller  <davem@davemloft.net>
3239
3240         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3241         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3242         and R_SPARC_WPLT30.
3243
3244 2012-04-24  Cary Coutant  <ccoutant@google.com>
3245
3246         * incremental-dump.cc (find_input_containing_global): Replace
3247         magic number with symbolic constant.
3248         (dump_incremental_inputs): Update version number.
3249         * incremental.cc (Output_section_incremental_inputs): Update version
3250         number; import symbolic constants from Incremental_inputs_reader.
3251         (Incremental_inputs::create_data_sections): Align relocations
3252         section correctly for 64-bit targets.
3253         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3254         constants; add padding.
3255         (Output_section_incremental_inputs::write_header): Add assert for
3256         header_size.
3257         (Output_section_incremental_inputs::write_input_files): Add assert
3258         for input_entry_size.
3259         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3260         add assert for object_info_size, input_section_entry_size,
3261         global_sym_entry_size.
3262         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3263         for data structure sizes; use them.
3264         (Incremental_input_entry_reader): Import symbolic constants from
3265         Incremental_inputs_reader; use them.
3266
3267 2012-04-23  David S. Miller  <davem@davemloft.net>
3268
3269         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3270         and elf_flags_set_.
3271         (Target_sparc::Target_sparc): Initialize new fields.
3272         (Target_sparc::do_make_elf_object): New function.
3273         (Target_sparc::do_adjust_elf_header): New function.
3274
3275 2012-04-23  Cary Coutant  <ccoutant@google.com>
3276
3277         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3278         CU range table of gdb index.
3279
3280 2012-04-20  David S. Miller  <davem@davemloft.net>
3281
3282         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3283         instead of false.
3284
3285 2012-04-16  David S. Miller  <davem@davemloft.net>
3286
3287         * sparc.cc (Target_sparc::got_address): New function.
3288         (Sparc_relocate_functions::gdop_hix22): New function.
3289         (Sparc_relocate_functions::gdop_lox10): New function.
3290         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3291         relocs.
3292         (Target_sparc::Scan::local): Likewise if the global symbol is not
3293         preemptible and is not IFUNC.
3294         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3295         transformations for local and non-preemptible non-IFUNC global
3296         symbols.
3297
3298         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3299         writing out 64-bit part of ranges.
3300
3301         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3302         -fpic and -fpie respectively.
3303         * Makefile.in: Regenerate.
3304
3305         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3306         (Target_sparc::Target_sparc): Initialize new field.
3307         (Target_sparc::do_plt_section_for_global): New function.
3308         (Target_sparc::do_plt_section_for_local): New function.
3309         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3310         (Target_sparc::make_plt_section): New function, broken out of
3311         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3312         (Target_sparc::make_plt_entry): Call make_plt_section.
3313         (Target_sparc::make_local_ifunc_plt_entry): New function.
3314         (Target_sparc::rela_ifunc_section): New function.
3315         (Target_sparc::plt_section): Remove const.
3316         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3317         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3318         and ifunc_count_ fields.
3319         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3320         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3321         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3322         (Output_data_plt_sparc::rela_ifunc): New function.
3323         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3324         (Output_data_plt_sparc::has_ifunc_section): New function.
3325         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3326         (Output_data_plt_sparc::address_for_global): New function.
3327         (Output_data_plt_sparc::address_for_local): New function.
3328         (Output_data_plt_sparc::plt_index_to_offset): New function.
3329         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3330         and entry_count.
3331         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3332         entry_count.
3333         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3334         R_SPARC_JMP_IREL to switch.
3335         (Target_sparc::Scan::check_non_pic): Likewise.
3336         (Target_sparc::Scan::local): Handle IFUNC symbols.
3337         (Target_sparc::Scan::local): Likewise.
3338         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3339         and plt_address_for_local.
3340         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3341         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3342
3343         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3344         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3345         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3346         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3347         global relocs too.
3348         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3349         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3350         calls.
3351         * sparc.cc (Target_sparc::Scan::global): Likewise.
3352         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3353
3354 2012-04-16  Cary Coutant  <ccoutant@google.com>
3355
3356         * archive.cc (Library_base::should_include_member): Check for
3357         --export-dynamic-symbol.
3358         * options.h (class General_options): Add --export-dynamic-symbol.
3359         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3360         --export-dynamic-symbol.
3361         (Symbol_table::gc_mark_undef_symbols): Likewise.
3362         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3363
3364 2012-04-12  David S. Miller  <davem@davemloft.net>
3365
3366         * sparc.cc (Reloc::wdisp10): New relocation method.
3367         (Reloc::h34): Likewise.
3368         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3369         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3370         R_SPARC_WDISP10.
3371         (Target_sparc::Scan::local): Likewise.
3372         (Target_sparc::Scan::global): Likewise.
3373         (Target_sparc::Relocate::relocate): Likewise.
3374
3375 2012-04-09  Cary Coutant  <ccoutant@google.com>
3376
3377         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3378         low_pc == 0.
3379
3380 2012-04-06  Ian Lance Taylor  <iant@google.com>
3381
3382         * timer.cc: #include <unistd.h>.
3383
3384 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3385
3386         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3387         * config.in: Regenerate.
3388         * configure: Regenerate.
3389
3390 2012-04-05  Nick Clifton  <nickc@redhat.com>
3391
3392         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3393         (AM_LC_MESSAGES): Add.
3394         * aclocal.m4: Regenerate.
3395         * config.in: Regenerate.
3396         * configure: Regenerate.
3397
3398 2012-03-21  Cary Coutant  <ccoutant@google.com>
3399
3400         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3401         * Makefile.in: Regenerate.
3402         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3403         (Sized_elf_reloc_mapper::symbol_section): New function.
3404         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3405         (make_elf_reloc_mapper): New function.
3406         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3407         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3408         (Dwarf_abbrev_table::do_get_abbrev): New function.
3409         (Dwarf_ranges_table::read_ranges_table): New function.
3410         (Dwarf_ranges_table::read_range_list): New function.
3411         (Dwarf_pubnames_table::read_section): New function.
3412         (Dwarf_pubnames_table::read_header): New function.
3413         (Dwarf_pubnames_table::next_name): New function.
3414         (Dwarf_die::Dwarf_die): New function.
3415         (Dwarf_die::read_attributes): New function.
3416         (Dwarf_die::skip_attributes): New function.
3417         (Dwarf_die::set_name): New function.
3418         (Dwarf_die::set_linkage_name): New function.
3419         (Dwarf_die::attribute): New function.
3420         (Dwarf_die::string_attribute): New function.
3421         (Dwarf_die::int_attribute): New function.
3422         (Dwarf_die::uint_attribute): New function.
3423         (Dwarf_die::ref_attribute): New function.
3424         (Dwarf_die::child_offset): New function.
3425         (Dwarf_die::sibling_offset): New function.
3426         (Dwarf_info_reader::check_buffer): New function.
3427         (Dwarf_info_reader::parse): New function.
3428         (Dwarf_info_reader::do_parse): New function.
3429         (Dwarf_info_reader::do_read_string_table): New function.
3430         (Dwarf_info_reader::lookup_reloc): New function.
3431         (Dwarf_info_reader::get_string): New function.
3432         (Dwarf_info_reader::visit_compilation_unit): New function.
3433         (Dwarf_info_reader::visit_type_unit): New function.
3434         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3435         Sized_elf_reloc_mapper.
3436         (Sized_dwarf_line_info::symbol_section): Remove function.
3437         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3438         (Sized_dwarf_line_info::read_line_mappings): Remove object
3439         parameter, adjust callers.
3440         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3441         * dwarf_reader.h: Include <sys/types.h>.
3442         (class Track_relocs): Remove forward declaration.
3443         (class Elf_reloc_mapper): New class.
3444         (class Sized_elf_reloc_mapper): New class.
3445         (class Dwarf_abbrev_table): New class.
3446         (class Dwarf_range_list): New class.
3447         (class Dwarf_ranges_table): New class.
3448         (class Dwarf_pubnames_table): New class.
3449         (class Dwarf_die): New class.
3450         (class Dwarf_info_reader): New class.
3451         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3452         (Sized_dwarf_line_info::symbol_section): Remove member function.
3453         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3454         base class.
3455         * gdb-index.cc: New source file.
3456         * gdb-index.h: New source file.
3457         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3458         and .debug_types sections, call Layout::add_to_gdb_index.
3459         (Sized_relobj_incr::do_section_name): Implement.
3460         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3461         return type; Implement.
3462         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3463         return type.
3464         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3465         parameter list and return type.
3466         (Sized_incr_dynobj::do_section_contents): Likewise.
3467         * layout.cc: Include gdb-index.h.
3468         (Layout::Layout): Initialize gdb_index_data_.
3469         (Layout::init_fixed_output_section): Check for .gdb_index section.
3470         (Layout::add_to_gdb_index): New function. Instantiate.
3471         * layout.h: Add forward declaration for class Gdb_index.
3472         (Layout::add_to_gdb_index): New member function.
3473         (Layout::gdb_index_data_): New data member.
3474         * main.cc: Include gdb-index.h.
3475         (main): Print statistics for gdb index.
3476         * object.cc (Object::section_contents): Move code into
3477         do_section_contents.
3478         (need_decompressed_section): Check for sections needed when building
3479         gdb index.
3480         (build_compressed_section_map): Likewise.
3481         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3482         gdb index.
3483         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3484         sections; call Layout::add_to_gdb_index.
3485         (Sized_relobj_file::do_decompressed_section_contents): Call
3486         do_section_contents directly.
3487         * object.h (Object::do_section_contents): Adjust parameter list and
3488         return type.
3489         (Object::do_decompressed_section_contents): Call do_section_contents
3490         directly.
3491         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3492         return type.
3493         * options.h (class General_options): Add --gdb-index option.
3494         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3495         list and return type.
3496         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3497         * reloc.h (Track_relocs::checkpoint): New function.
3498         (Track_relocs::reset): New function.
3499
3500         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3501         New test cases.
3502         * testsuite/Makefile.in: Regenerate.
3503         * testsuite/gdb_index_test.cc: New test source file.
3504         * testsuite/gdb_index_test_1.sh: New test source file.
3505         * testsuite/gdb_index_test_2.sh: New test source file.
3506
3507 2012-03-19  Doug Kwan  <dougkwan@google.com>
3508
3509         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3510         (Target_arm::do_finalize_sections): Remove code which defines
3511         __exidx_start and __exidx_end.  Make symbol table parameter
3512         anonymous as it is not used.
3513         * gold.cc (queue_middle_tasks): Call target hook to define any
3514         target-specific symbols.
3515         * target.h (Target::define_standard_symbols): New method.
3516         (Target::do_define_standard_symbols): Same.
3517         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3518         * testsuite/Makefile.in: Regenerate.
3519         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3520         and __exidx_end.
3521         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3522         relocations are generated for __exidx_start and __exidx_end.
3523
3524 2012-03-16  Doug Kwan  <dougkwan@google.com>
3525
3526         * testsuite/Makefile.am: Disable test initpri3b.
3527         * testsuite/Makefile.in: Regenerate.
3528
3529 2012-03-15  Doug Kwan  <dougkwan@google.com>
3530
3531         * arm.cc (Target_arm::got_section): Make .got section read-only
3532         if -z now is given.
3533
3534 2012-03-15  Ian Lance Taylor  <iant@google.com>
3535
3536         PR gold/13850
3537         * layout.cc (Layout::make_output_section): Correctly mark
3538         SHT_INIT_ARRAY, et. al., as relro.
3539
3540 2012-03-14  Doug Kwan  <dougkwan@google.com>
3541
3542         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3543         dynamic relocations for protected symbols in shared objects.
3544
3545 2012-03-13  Ian Lance Taylor  <iant@google.com>
3546
3547         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3548         keep the larger alignment.
3549
3550 2012-03-12  Cary Coutant  <ccoutant@google.com>
3551
3552         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3553         handling of DW_LNE_define_file.
3554
3555 2012-03-12  Cary Coutant  <ccoutant@google.com>
3556
3557         * reduced_debug_output.cc
3558         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3559         codes to switch.
3560
3561 2012-02-29  Cary Coutant  <ccoutant@google.com>
3562
3563         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3564
3565 2012-02-29  Cary Coutant  <ccoutant@google.com>
3566
3567         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3568         Call Object::decompressed_section_contents.
3569         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3570         New dtor.
3571         (Sized_dwarf_line_info::buffer_start_): New data member.
3572         * merge.cc (Output_merge_data::do_add_input_section): Call
3573         Object::decompressed_section_contents.
3574         (Output_merge_string::do_add_input_section): Likewise.
3575         * object.cc (need_decompressed_section): New function.
3576         (build_compressed_section_map): Decompress sections needed later.
3577         (Sized_relobj_file::do_decompressed_section_contents): New function.
3578         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3579         * object.h (Object::decompressed_section_contents): New function.
3580         (Object::discard_decompressed_sections): New function.
3581         (Object::do_decompressed_section_contents): New function.
3582         (Object::do_discard_decompressed_sections): New function.
3583         (Compressed_section_info): New type.
3584         (Compressed_section_map): Include decompressed section contents.
3585         (Sized_relobj_file::do_decompressed_section_contents): New function.
3586         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3587
3588 2012-02-16  Cary Coutant  <ccoutant@google.com>
3589
3590         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3591         * testsuite/Makefile.in: Regenerate.
3592
3593 2012-02-14  Cary Coutant  <ccoutant@google.com>
3594
3595         * options.cc (General_options::finalize): Disallow -pie and -static.
3596
3597 2012-02-03  Doug Kwan  <dougkwan@google.com>
3598
3599         * arm.cc (Arm_relocate_functions::abs8,
3600         Arm_relocate_functions::abs16): Use
3601         Bits::has_signed_unsigned_overflow32.
3602         (Arm_relocate_functions::thm_abs8): Correct range of
3603         overflow check.
3604         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3605         in assertions.
3606
3607 2012-02-02  Doug Kwan  <dougkwan@google.com>
3608
3609         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3610         position independent outputs, not just shared objects.
3611
3612 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3613
3614         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3615         * configure: Regenerated.
3616
3617 2012-01-27  Ian Lance Taylor  <iant@google.com>
3618
3619         * reloc.h (Bits): New class with static functions, copied from
3620         namespace utils in arm.cc.
3621         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3622         instead.
3623
3624 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3625
3626         * incremental.cc (write_info_blocks): Correct relocation offset.
3627
3628 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3629
3630         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3631         (Relocate::tls_gd_to_le): Likewise.
3632
3633 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3634
3635         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3636
3637 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3638
3639         * configure.ac: Check if -mcmodel=medium works.
3640         * configure: Regenerated.
3641
3642 2012-01-24  Cary Coutant  <ccoutant@google.com>
3643
3644         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3645         definition and ...
3646         (read_unsigned_LEB_128_x): ... this new function.
3647         (read_signed_LEB_128): Replaced with inline definition and ...
3648         (read_signed_LEB_128_x): ... this new function.
3649         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3650         (read_unsigned_LEB_128): Add inline definition.
3651         (read_signed_LEB_128_x): New function.
3652         (read_signed_LEB_128): Add inline definition.
3653         * testsuite/Makefile.am (leb128_unittest): New unit test.
3654         * testsuite/Makefile.in: Regenerate.
3655         * testsuite/leb128_unittest.cc: New unit test.
3656
3657 2012-01-23  Ian Lance Taylor  <iant@google.com>
3658
3659         PR gold/13617
3660         * i386.cc (Target_i386::do_code_fill): When using a jmp
3661         instruction, pad with nop instructions.
3662         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3663
3664 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3665
3666         * x86_64.cc (gc_process_relocs): Add typename on types used in
3667         template.
3668         (scan_relocs): Likewise.
3669         (relocate_section): Likewise.
3670         (apply_relocation): Likewise.
3671
3672 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3673
3674         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3675         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3676         under x32.
3677
3678 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3679
3680         * x86_64.cc: Initial support for x32.
3681
3682 2012-01-03  Cary Coutant  <ccoutant@google.com>
3683
3684         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3685         Use abstract base class for GOT.
3686         * gold/output.h (class Output_data_got_base): New abstract base class.
3687         (class Output_data_got): Derive from new base class, adjust ctors.
3688         (Output_data_got::reserve_slot): Make virtual; rename to
3689         do_reserve_slot; Adjust callers.
3690         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3691         pointer to abstract base class.
3692         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3693
3694 2011-12-18  Ian Lance Taylor  <iant@google.com>
3695
3696         * object.h (Relobj::local_symbol_value): New function.
3697         (Relobj::local_plt_offset): New function.
3698         (Relobj::local_has_got_offset): New function.
3699         (Relobj::local_got_offset): New function.
3700         (Relobj::set_local_got_offset): New function.
3701         (Relobj::do_local_symbol_value): New pure virtual function.
3702         (Relobj::do_local_plt_offset): Likewise.
3703         (Relobj::do_local_has_got_offset): Likewise.
3704         (Relobj::do_local_got_offset): Likewise.
3705         (Relobj::do_set_local_got_offset): Likewise.
3706         (Sized_relobj::do_local_has_got_offset): Rename from
3707         local_has_got_offset.
3708         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3709         (Sized_relobj::do_set_local_got_offset): Rename from
3710         set_local_got_offset.
3711         (Sized_relobj_file::do_local_plt_offset): Rename from
3712         local_plt_offset.
3713         (Sized_relobj_file::do_local_symbol_value): New function.
3714         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3715         local_plt_offset.
3716         * output.cc (Output_data_got::Got_entry::write): Change object to
3717         Relobj.  Use local_symbol_value.
3718         (Output_data_got::add_global_with_rel): Change rel_dyn to
3719         Output_data_reloc_generic*.  Use add_global_generic.
3720         (Output_data_got::add_global_with_rela): Remove.  Change all
3721         callers to use add_global_with_rel.
3722         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3723         Output_data_reloc_generic*.  Use add_global_generic.
3724         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3725         callers to use add_global_pair_with_rel.
3726         (Output_data_got::add_local): Change object to Relobj*.
3727         (Output_data_got::add_local_plt): Likewise.
3728         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3729         change rel_dyn to Output_data_reloc_generic*.  Use
3730         add_local_generic.
3731         (Output_data_got::add_local_with_rela): Remove.  Change all
3732         callers to use all_local_with_rel.
3733         (Output_data_got::add_local_pair_with_rel): Change object to
3734         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3735         add_output_section_generic.
3736         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3737         callers to use add_local_pair_with_rel.
3738         (Output_data_got::reserve_local): Change object to Relobj*.
3739         * output.h: (class Output_data_reloc_generic): Add pure virtual
3740         declarations for add_global_generic, add_local_generic,
3741         add_output_section_generic.
3742         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3743         functions for Output_data_reloc_generic.  Update declarations for
3744         changes listed in output.cc.
3745         (class Output_data_got): Change template parameter to got_size.
3746         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3747         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3748         function.
3749         (Sized_relobj_incr::do_local_plt_offset): New function.
3750         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3751         add_global_generic.
3752
3753 2011-12-17  Cary Coutant  <ccoutant@google.com>
3754
3755         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3756         * resolve.cc (Symbol_table::resolve): Likewise.
3757         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3758         arrays.
3759         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3760
3761 2011-12-16  Ian Lance Taylor  <iant@google.com>
3762
3763         * output.h (Output_data_reloc_generic::add): Only call
3764         add_dynamic_reloc if this is a dynamic reloc section.
3765
3766 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3767
3768         PR gold/13505
3769         * target-reloc.h (apply_relocation): Replace <64, false> with
3770         <size, big_endian>.
3771
3772 2011-11-25  Nick Clifton  <nickc@redhat.com>
3773
3774         * po/it.po: New Italian translation.
3775
3776 2011-11-17  Sterling Augustine  <saugustine@google.com>
3777
3778         * script.cc (script_include_directive): Implement.
3779         (read_script_file): New local variables name and search_path. Update
3780         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3781         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3782         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3783
3784 2011-11-11  Sterling Augustine  <saugustine@google.com>
3785
3786         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3787         (file_or_sections_cmd): Likewise.
3788
3789 2011-11-11  Doug Kwan  <dougkwan@google.com>
3790
3791         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3792         if --just-symbols is given.
3793
3794 2011-11-10  Doug Kwan  <dougkwan@google.com>
3795
3796         PR gold/13362
3797         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3798         when processing data relocs.
3799         * reloc.h (Relocate_functions::rel_unaligned): New method.
3800         (Relocate_functions::pcrel_unaligned): Ditto.
3801         (Relocate_functions::rel32_unaligned): Ditto.
3802         (Relocate_functions::pcrel32_unaligned): Ditto.
3803
3804 2011-11-09  Doug Kwan  <dougkwan@google.com>
3805
3806         PR gold/13362
3807         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3808         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3809         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3810         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3811         (Relocate_functions::rel_unaligned): New.
3812         (Relocate_functions::rel32_unaligned): New.
3813         * target-reloc.h (relocate_for_relocatable): Add code to handle
3814         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3815         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3816         arm_unaligned_reloc_r): New targets.
3817         * testsuite/Makefile.in: Regenerate.
3818         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3819         linking.
3820
3821 2011-11-02  Ian Lance Taylor  <iant@google.com>
3822
3823         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3824         NATIVE_LINKER.
3825         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3826         * options.cc (General_options::finalize): Use library search path
3827         from configure script if specified.  If not native and no sysroot,
3828         only search TOOLLIBDIR.
3829         * options.h (Search_directory::Search_directory): Change name to
3830         const std::string&.
3831         (General_options::add_to_library_path_with_sysroot): Change arg to
3832         const std::string&.
3833         * configure, Makefile.in, config.in: Rebuild.
3834
3835 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3836
3837         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3838         we are working around the ARM1176 Erratum.
3839         * options.h (General_options::fix_arm1176): Add option.
3840         * testsuite/Makefile.am: Add testcases, and keep current ones
3841         working.
3842         * testsuite/Makefile.in: Regenerate.
3843         * testsuite/arm_fix_1176.s: New file.
3844         * testsuite/arm_fix_1176.sh: Likewise.
3845
3846 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3847
3848         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3849         may_use_blx_.
3850         (Target_arm::may_use_blx): Remove method.
3851         (Target_arm::set_may_use_blx): Likewise.
3852         (Target_arm::may_use_v4t_interworking): New method.
3853         (Target_arm::may_use_v5t_interworking): Likewise.
3854         (Target_arm::may_use_blx_): Remove member variable.
3855         (Arm_relocate_functions::arm_branch_common): Check for v5T
3856         interworking.
3857         (Arm_relocate_functions::thumb_branch_common): Likewise.
3858         (Reloc_stub::stub_type_for_reloc): Likewise.
3859         (Target_arm::do_finalize_sections): Correct interworking checks.
3860         * testsuite/Makefile.am: Add new tests.
3861         * testsuite/Makefile.in: Regenerate.
3862         * testsuite/arm_farcall_arm_arm.s: New test.
3863         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3864         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3865         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3866         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3867         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3868         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3869         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3870
3871 2011-10-31  Cary Coutant  <ccoutant@google.com>
3872
3873         PR gold/13023
3874         * expression.cc (Expression::eval_with_dot): Add
3875         is_section_dot_assignment parameter.
3876         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3877         absolute and assigning to dot within a section.
3878         * script-sections.cc
3879         (Output_section_element_assignment::set_section_addresses): Pass
3880         dot_section to set_if_absolute.
3881         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3882         as is_section_dot_assignment flag to eval_with_dot.
3883         (Output_section_element_dot_assignment::set_section_addresses):
3884         Likewise.
3885         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3886         parameter.  Also set value if relative to dot_section; set the
3887         symbol's output_section.
3888         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3889         parameter.  Adjust all callers.
3890         (Expression::eval_maybe_dot): Likewise.
3891         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3892         Adjust all callers.
3893         * testsuite/script_test_2.t: Test assignment of an absolute value
3894         to dot within an output section element.
3895
3896 2011-10-31  Cary Coutant  <ccoutant@google.com>
3897
3898         * options.h (class General_options): Add --[no-]gnu-unique options.
3899         * symtab.cc (Symbol_table::sized_write_globals): Convert
3900         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3901
3902 2011-10-31  Cary Coutant  <ccoutant@google.com>
3903
3904         PR gold/13359
3905         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3906         unnecessary assertion.
3907         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3908
3909 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3910
3911         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3912         gc_mark_symbol.
3913         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3914         gc_mark_symbol.
3915         Change to just keep the section associated with symbol.
3916         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3917         they are externally visible and --export-dynamic is turned on.
3918         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3919
3920 2011-10-19  Ian Lance Taylor  <iant@google.com>
3921
3922         PR gold/13163
3923         * script-sections.cc
3924         (Output_section_element_dot_assignment::needs_output_section): New
3925         function.
3926
3927 2011-10-19  Ian Lance Taylor  <iant@google.com>
3928
3929         PR gold/13204
3930         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3931         --section-start option was seen.
3932         * options.h (General_options::any_section_start): New function.
3933
3934 2011-10-18  David S. Miller  <davem@davemloft.net>
3935
3936         PR binutils/13301
3937         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3938         member to track relocation locations that have moved during TLS
3939         reloc optimizations.
3940         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3941         (Target_sparc::Relocate::relocate): Adjust view down by 4
3942         bytes if it matches reloc_adjust_addr_.
3943         (Target_sparc::Relocate::relocate_tls): Always move the
3944         __tls_get_addr call delay slot instruction forward 4 bytes when
3945         performing relaxation.
3946
3947 2011-10-18  Cary Coutant  <ccoutant@google.com>
3948
3949         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3950         (Output_file::map_no_anonymous): Check for non-zero
3951         return code from posix_fallocate.
3952
3953 2011-10-17  Cary Coutant  <ccoutant@google.com>
3954
3955         PR gold/13245
3956         * plugin.cc (is_visible_from_outside): Check for symbols
3957         referenced from dynamic objects.
3958         * resolve.cc (Symbol_table::resolve): Don't count references
3959         from dynamic objects as references from real ELF files.
3960         * testsuite/plugin_test_2.sh: Adjust expected result.
3961
3962 2011-10-17  Cary Coutant  <ccoutant@google.com>
3963
3964         * gold.cc: Include timer.h.
3965         (queue_middle_tasks): Stamp time.
3966         (queue_final_tasks): Likewise.
3967         * main.cc (main): Store timer in parameters.  Print timers
3968         for each pass.
3969         * parameters.cc (Parameters::Parameters): Initialize timer_.
3970         (Parameters::set_timer): New function.
3971         (set_parameters_timer): New function.
3972         * parameters.h (Parameters::set_timer): New function.
3973         (Parameters::timer): New function.
3974         (Parameters::timer_): New data member.
3975         (set_parameters_timer): New function.
3976         * timer.cc (Timer::stamp): New function.
3977         (Timer::get_pass_time): New function.
3978         * timer.h (Timer::stamp): New function.
3979         (Timer::get_pass_time): New function.
3980         (Timer::pass_times_): New data member.
3981
3982 2011-10-17  Cary Coutant  <ccoutant@google.com>
3983
3984         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3985         task for members of lib groups.
3986
3987 2011-10-17  Cary Coutant  <ccoutant@google.com>
3988
3989         PR gold/13288
3990         * fileread.cc (File_read::find_view): Add assert.
3991         (File_read::make_view): Move bounds check (replace with assert)...
3992         (File_read::find_or_make_view): ... to here.
3993
3994 2011-10-12  Cary Coutant  <ccoutant@google.com>
3995
3996         * output.cc (Output_file::open_base_file): Handle case where
3997         ::read returns less than requested size.
3998
3999 2011-10-10  Cary Coutant  <ccoutant@google.com>
4000
4001         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4002         Initialize defined_count_.
4003         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4004         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4005         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4006         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4007         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4008         * incremental.h (Sized_relobj_incr::defined_count_): New data
4009         member.
4010         (Sized_incr_dynobj::defined_count_): New data member.
4011         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4012         Return zeroes instead of internal error.
4013
4014 2011-10-10  Cary Coutant  <ccoutant@google.com>
4015
4016         PR gold/13249
4017         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4018         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4019         * output.h (class Output_reloc): Add use_plt_offset flag.
4020         (Output_reloc::type_): Adjust size of bit field.
4021         (Output_reloc::use_plt_offset_): New bit field.
4022         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4023         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4024         flag.  Adjust all callers.
4025         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4026         creating RELATIVE relocations.
4027
4028 2011-10-10  Nick Clifton  <nickc@redhat.com>
4029
4030         * po/es.po: Updated Spanish translation.
4031         * po/fi.po: Updated Finnish translation.
4032
4033 2011-10-03   Diego Novillo  <dnovillo@google.com>
4034
4035         * options.cc (parse_uint): Fix dereference of RETVAL.
4036
4037 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4038
4039         * layout.h (section_order_map_): New member.
4040         (get_section_order_map): New member function.
4041         * output.cc (Output_section::add_input_section): Check for patterns
4042         only when --section-ordering-file is specified.
4043         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4044         output_sections have been formed.
4045         * layout.cc (Layout_Layout): Initialize section_order_map_.
4046         * plugin.cc (update_section_order): Store order in order_map. Do not
4047         update the order.
4048         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4049         * testsuite/Makefile.in: Regenerate.
4050         * testsuite/plugin_section_order.c: New file.
4051         * testsuite/plugin_final_layout.cc: New file.
4052         * testsuite/plugin_final_layout.sh: New file.
4053
4054 2011-09-29  Cary Coutant  <ccoutant@google.com>
4055
4056         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4057         Check for NULL.
4058         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4059         symbols during incremental update.
4060         (Symbol_table::add_from_dynobj): Likewise.
4061
4062 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4063             Ian Lance Taylor  <iant@google.com>
4064
4065         * symtab.cc (Symbol_table::define_special_symbol): Always
4066         canonicalize version string.
4067
4068 2011-09-26  Cary Coutant  <ccoutant@google.com>
4069
4070         * gold.cc (queue_initial_tasks): Move option checks ...
4071         * options.cc (General_options::finalize): ... to here. Disable
4072         some options; make others fatal.
4073
4074 2011-09-26  Cary Coutant  <ccoutant@google.com>
4075
4076         gcc PR lto/47247
4077         * plugin.cc (get_symbols_v2): New function.
4078         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4079         (is_referenced_from_outside): New function.
4080         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4081         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4082         (get_symbols): Pass version parameter.
4083         (get_symbols_v2): New function.
4084         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4085         parameter.
4086         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4087         (onload): Add LDPT_GET_SYMBOLS_V2.
4088         (all_symbols_read_hook): Use get_symbols_v2; check for
4089         LDPR_PREVAILING_DEF_IRONLY_EXP.
4090         * testsuite/plugin_test_3.sh: Update expected results.
4091
4092 2011-09-23  Simon Baldwin  <simonb@google.com>
4093
4094         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4095         configuration options.
4096         * configure: Regenerate.
4097         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4098         * Makefile.in: Regenerate.
4099         * testsuite/Makefile.in: Regenerate.
4100
4101 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4102
4103         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4104
4105 2011-09-19  Cary Coutant  <ccoutant@google.com>
4106
4107         * incremental.cc (can_incremental_update): Fix typo in comment.
4108         * incremental.h (can_incremental_update): Likewise.
4109
4110 2011-09-18  Cary Coutant  <ccoutant@google.com>
4111
4112         * incremental.cc (can_incremental_update): New function.
4113         * incremental.h (can_incremental_update): New function.
4114         * layout.cc (Layout::init_fixed_output_section): Call it.
4115         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4116         * object.cc (Sized_relobj_file::do_layout): Call
4117         can_incremental_update.
4118
4119 2011-09-13  Cary Coutant  <ccoutant@google.com>
4120
4121         * configure.ac: Check for glibc support for gnu_indirect_function
4122         support with static linking, setting automake conditional
4123         IFUNC_STATIC.
4124         * Makefile.in: Regenerate.
4125         * configure: Regenerate.
4126
4127         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4128         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4129         for IFUNC_STATIC.
4130         * testsuite/Makefile.in: Regenerate.
4131
4132 2011-09-13  Cary Coutant  <ccoutant@google.com>
4133
4134         * incremental.cc (Sized_relobj_incr::do_layout): Call
4135         report_comdat_group for kept comdat sections.
4136         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4137         * testsuite/Makefile.in: Regenerate.
4138         * testsuite/incr_comdat_test_1.cc: New source file.
4139         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4140         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4141         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4142
4143 2011-09-13  Ian Lance Taylor  <iant@google.com>
4144
4145         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4146         variable external_symbols_offset.
4147
4148 2011-09-12  Ian Lance Taylor  <iant@google.com>
4149
4150         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4151         triggered if object has no symbols.
4152
4153 2011-09-09  David S. Miller  <davem@davemloft.net>
4154
4155         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4156         (Output_fill_debug_line::do_write): Likewise.
4157
4158 2011-08-29  Cary Coutant  <ccoutant@google.com>
4159
4160         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4161         casts to match formatting specs.
4162         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4163
4164 2011-08-26  Cary Coutant  <ccoutant@google.com>
4165
4166         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4167         remaining hole size when allocating.
4168         (Layout::make_output_section): Set fill methods for debug sections.
4169         * layout.h (Free_list::Free_list_node): Move from private to
4170         public.
4171         (Free_list::set_min_hole_size): New function.
4172         (Free_list::begin, Free_list::end): New functions.
4173         (Free_list::min_hole_): New data member.
4174         * output.cc: Include dwarf.h.
4175         (Output_fill_debug_info::do_minimum_hole_size): New function.
4176         (Output_fill_debug_info::do_write): New function.
4177         (Output_fill_debug_line::do_minimum_hole_size): New function.
4178         (Output_fill_debug_line::do_write): New function.
4179         (Output_section::Output_section): Initialize new data member.
4180         (Output_section::set_final_data_size): Ensure patch space is larger
4181         than minimum hole size.
4182         (Output_section::do_write): Fill holes in debug sections.
4183         * output.h (Output_fill): New class.
4184         (Output_fill_debug_info): New class.
4185         (Output_fill_debug_line): New class.
4186         (Output_section::set_free_space_fill): New function.
4187         (Output_section::free_space_fill_): New data member.
4188         * testsuite/Makefile.am (incremental_test_3): Add
4189         --incremental-patch option.
4190         (incremental_test_4): Likewise.
4191         (incremental_test_5): Likewise.
4192         (incremental_test_6): Likewise.
4193         (incremental_copy_test): Likewise.
4194         (incremental_common_test_1): Likewise.
4195         * testsuite/Makefile.in: Regenerate.
4196
4197 2011-08-26  Nick Clifton  <nickc@redhat.com>
4198
4199         * po/es.po: Updated Spanish translation.
4200
4201 2011-08-01  Cary Coutant  <ccoutant@google.com>
4202
4203         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4204         * gold/testsuite/Makefile.in: Regenerate.
4205         * gold/testsuite/justsyms_exec.c: New source file.
4206         * gold/testsuite/justsyms_lib.c: New source file.
4207
4208 2011-08-01  Cary Coutant  <ccoutant@google.com>
4209
4210         * layout.cc (Layout::set_segment_offsets): Don't realign text
4211         segment if -Ttext was specified.
4212         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4213         file type.
4214         * object.h (Sized_relobj_file::e_type): New function.
4215         (Sized_relobj_file::e_type_): New data member.
4216         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4217         base address for ET_EXEC files.
4218         * target.cc (Target::do_make_elf_object_implementation): Allow
4219         ET_EXEC files with --just-symbols option.
4220
4221 2011-07-28  Cary Coutant  <ccoutant@google.com>
4222
4223         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4224         Add thread_number parameter.
4225         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4226         * workqueue-threads.cc
4227         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4228         current thread if its thread number is greater than desired thread
4229         count.
4230         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4231         Add thread_number parameter.
4232         (Workqueue::should_cancel_thread): Likewise.
4233         (Workqueue::find_runnable_or_wait): Pass thread_number to
4234         should_cancel_thread.
4235         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4236         parameter.
4237
4238 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4239
4240         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4241         only after checking if it cannot be forced local.
4242         * symtab.h (is_externally_visible): Check if the symbol is not forced
4243         local.
4244
4245 2011-07-15  Ian Lance Taylor  <iant@google.com>
4246
4247         * options.h (class General_options): Add --print-output-format.
4248         Move -EL next to -EB, for  better --help output.
4249         * target-select.cc: Include <cstdio>, "options.h", and
4250         "parameters.h".
4251         (Target_selector::do_target_bfd_name): New function.
4252         (print_output_format): New function.
4253         * target-select.h (class Target_selector): Update declarations.
4254         (Target_selector::target_bfd_name): New function.
4255         (print_output_format): Declare.
4256         * main.cc: Include "target-select.h".
4257         (main): Handle --print-output-format.
4258         * gold.cc: Include "target-select.h".
4259         (queue_initial_tasks): Handle --print-output-format when there are
4260         no input files.
4261         * parameters.cc (parameters_force_valid_target): Give a better
4262         error message if -EB/-EL does not match target.
4263         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4264         function.
4265
4266 2011-07-15  Ian Lance Taylor  <iant@google.com>
4267
4268         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4269         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4270         (Output_data_plt_i386::do_write): Write address of .dynamic
4271         section to first entry in .got.plt section.
4272         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4273         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4274         Initialize layout_.
4275         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4276         section to first entry in .got.plt section.
4277         * layout.h (Layout::dynamic_section): New function.
4278
4279 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4280
4281         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4282         to claim_file call.
4283         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4284         input_section_position_, and input_section_glob_.
4285         (read_layout_from_file): Call function section_ordering_specified.
4286         * layout.h (is_section_ordering_specified): New function.
4287         (section_ordering_specified): New function.
4288         (section_ordering_specified_): New boolean member.
4289         * main.cc(main): Call load_plugins after layout object is defined.
4290         * output.cc (Output_section::add_input_section): Use
4291         function section_ordering_specified to check if section ordering is
4292         needed.
4293         * output.cc (Output_section::add_relaxed_input_section): Use
4294         function section_ordering_specified to check if section ordering is
4295         needed.
4296         (Output_section::update_section_layout): New function.
4297         (Output_section::sort_attached_input_sections): Check if input section
4298         must be reordered.
4299         * output.h (Output_section::update_section_layout): New function.
4300         * plugin.cc (get_section_count): New function.
4301         (get_section_type): New function.
4302         (get_section_name): New function.
4303         (get_section_contents): New function.
4304         (update_section_order): New function.
4305         (allow_section_ordering): New function.
4306         (Plugin::load): Add the new interfaces to the transfer vector.
4307         (Plugin_manager::load_plugins): New parameter.
4308         (Plugin_manager::all_symbols_read): New parameter.
4309         (Plugin_manager::claim_file): New parameter. Save the elf object for
4310         unclaimed objects.
4311         (Plugin_manager::get_elf_object): New function.
4312         (Plugin_manager::get_view): Change to directly use the bool to check
4313         if get_view is called from claim_file_hook.
4314         * plugin.h (input_objects): New function
4315         (Plugin__manager::load_plugins): New parameter.
4316         (Plugin_manager::claim_file): New parameter.
4317         (Plugin_manager::get_elf_object): New function.
4318         (Plugin_manager::in_claim_file_handler): New function.
4319         (Plugin_manager::in_claim_file_handler_): New member.
4320         (layout): New function.
4321         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4322         handler with an extra parameter. Make the elf object before calling
4323         claim_file handler.
4324         * testsuite/plugin_test.c (get_section_count): New function pointer.
4325         (get_section_type): New function pointer.
4326         (get_section_name): New function pointer.
4327         (get_section_contents): New function pointer.
4328         (update_section_order): New function pointer.
4329         (allow_section_ordering): New function pointer.
4330         (onload): Check if the new interfaces exist.
4331
4332 2011-07-13  Ian Lance Taylor  <iant@google.com>
4333
4334         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4335         relro section.
4336         * x86_64.cc (Target_x86_64::got_section): Likewise.
4337         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4338         (relro_now_test_SOURCES): New variable.
4339         (relro_now_test_DEPENDENCIES): New variable.
4340         (relro_now_test_LDFLAGS): New variable.
4341         (relro_now_test_LDADD): New variable.
4342         (relro_now_test.so): New target.
4343         * testsuite/Makefile.in: Rebuild.
4344
4345 2011-07-12  Ian Lance Taylor  <iant@google.com>
4346
4347         PR gold/12980
4348         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4349         GLOB_DAT relocation rather than a RELATIVE relocation for a
4350         protected symbol when creating a shared library.
4351         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4352         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4353         * testsuite/protected_main_1.cc (main): Test that protected
4354         function has same address.
4355
4356 2011-07-11  Ian Lance Taylor  <iant@google.com>
4357
4358         PR gold/12979
4359         * options.h (class General_options): Add -Bgroup.
4360         * options.cc (General_options::finalize): If -Bgroup is set,
4361         default to --unresolved-symbols=report-all.
4362         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4363         * target-reloc.h (issue_undefined_symbol_error): Handle
4364         --unresolved-symbols=report-all.
4365
4366 2011-07-08  Ian Lance Taylor  <iant@google.com>
4367
4368         PR gold/11985
4369         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4370         if linker script discards key sections.
4371         (Layout::create_dynamic_symtab): Likewise.
4372         (Layout::assign_local_dynsym_offsets): Likewise.
4373         (Layout::sized_create_version_sections): Likewise.
4374         (Layout::create_interp): Likewise.
4375         (Layout::finish_dynamic_section): Likewise.
4376         (Layout::set_dynamic_symbol_size): Likewise.
4377
4378 2011-07-08  Ian Lance Taylor  <iant@google.com>
4379
4380         PR gold/12386
4381         * options.h (class General_options): Add --unresolved-symbols.
4382         * target-reloc.h (issue_undefined_symbol_error): Check
4383         --unresolved-symbols.  Add comments.
4384
4385 2011-07-08  Ian Lance Taylor  <iant@google.com>
4386
4387         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4388         expression more complex.
4389
4390 2011-07-08  Ian Lance Taylor  <iant@google.com>
4391
4392         PR gold/11317
4393         * target-reloc.h (issue_undefined_symbol_error): New inline
4394         function, broken out of relocate_section.
4395         (relocate_section): Call issue_undefined_symbol_error.
4396         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4397         there is no TLS segment if we are about to issue an undefined
4398         symbol error.
4399         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4400
4401 2011-07-08  Ian Lance Taylor  <iant@google.com>
4402
4403         PR gold/12279
4404         * resolve.cc (Symbol_table::should_override): Add fromtype
4405         parameter.  Change all callers.  Give error when linking together
4406         TLS and non-TLS symbol.
4407         (Symbol_table::should_override_with_special): Add fromtype
4408         parameter.  Change all callers.
4409         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4410         there is no TLS segment if we have reported some errors.
4411         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4412
4413 2011-07-08  Ian Lance Taylor  <iant@google.com>
4414
4415         PR gold/12372
4416         * target.h (Target::plt_address_for_global): New function.
4417         (Target::plt_address_for_local): New function.
4418         (Target::plt_section_for_global): Remove.
4419         (Target::plt_section_for_local): Remove.
4420         (Target::do_plt_address_for_global): New virtual function.
4421         (Target::do_plt_address_for_local): New virtual function.
4422         (Target::do_plt_section_for_global): Remove.
4423         (Target::do_plt_section_for_local): Remove.
4424         (Target::register_global_plt_entry): Add Symbol_table and Layout
4425         parameters.
4426         * output.cc (Output_data_got::Got_entry::write): Use
4427         plt_address_for_global and plt_address_for_local.
4428         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4429         address of output section.
4430         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4431         got_irelative_, and irelative_count_ fields.  Update
4432         declarations.
4433         (Output_data_plt_i386::has_irelative_section): New function.
4434         (Output_data_plt_i386::entry_count): Add irelative_count_.
4435         (Output_data_plt_i386::set_final_data_size): Likewise.
4436         (class Target_i386): Add got_irelative_ and rel_irelative_
4437         fields.  Update declarations.
4438         (Target_i386::Target_i386): Initialize new fields.
4439         (Target_i386::do_plt_address_for_global): New function replacing
4440         do_plt_section_for_global.
4441         (Target_i386::do_plt_address_for_local): New function replacing
4442         do_plt_section_for_local.
4443         (Target_i386::got_section): Create got_irelative_.
4444         (Target_i386::rel_irelative_section): New function.
4445         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4446         fields.  Don't define __rel_iplt_{start,end}.
4447         (Output_data_plt_i386::add_entry): Add symtab and layout
4448         parameters.  Change all callers.  Use different PLT and GOT for
4449         IFUNC symbols.
4450         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4451         layout parameters.  Change all callers.  Use different PLT and
4452         GOT.
4453         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4454         (Output_data_plt_i386::rel_irelative): New function.
4455         (Output_data_plt_i386::address_for_global): New function.
4456         (Output_data_plt_i386::address_for_local): New function.
4457         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4458         IRELATIVE GOT when changing IFUNC GOT entries.
4459         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4460         reloc.
4461         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4462         if we didn't create an IRELATIVE GOT.
4463         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4464         plt_address_for_local.
4465         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4466         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4467         got_irelative_, and irelative_count_ fields.  Update
4468         declarations.
4469         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4470         Initialize new fields.  Remove symtab parameter.  Change all
4471         callers.
4472         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4473         irelative_count_.
4474         (Output_data_plt_x86_64::has_irelative_section): New function.
4475         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4476         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4477         fields.  Update declarations.
4478         (Target_x86_64::Target_x86_64): Initialize new fields.
4479         (Target_x86_64::do_plt_address_for_global): New function replacing
4480         do_plt_section_for_global.
4481         (Target_x86_64::do_plt_address_for_local): New function replacing
4482         do_plt_section_for_local.
4483         (Target_x86_64::got_section): Create got_irelative_.
4484         (Target_x86_64::rela_irelative_section): New function.
4485         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4486         all callers.  Don't create __rel_iplt_{start,end}.
4487         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4488         parameters.  Change all callers.  Use different PLT and GOT for
4489         IFUNC symbols.
4490         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4491         layout parameters.  Change all callers.  Use different PLT and
4492         GOT.
4493         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4494         parameters.  Change all callers.  Use different PLT and GOT for
4495         IFUNC symbols.
4496         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4497         (Output_data_plt_x86_64::rela_irelative): New function.
4498         (Output_data_plt_x86_64::address_for_global): New function.
4499         (Output_data_plt_x86_64::address_for_local): New function.
4500         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4501         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4502         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4503         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4504         parameters.
4505         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4506         reloc.
4507         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4508         symbols if we didn't create an IRELATIVE GOT.
4509         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4510         plt_address_for_local.
4511         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4512         * testsuite/ifuncvar1.c: New test file.
4513         * testsuite/ifuncvar2.c: New test file.
4514         * testsuite/ifuncvar3.c: New test file.
4515         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4516         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4517         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4518         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4519         * testsuite/Makefile.in: Rebuild.
4520
4521 2011-07-07  Cary Coutant  <ccoutant@google.com>
4522
4523         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4524         (two_file_test_1_ndebug.o): Likewise.
4525         (two_file_test_1b_ndebug.o): Likewise.
4526         (two_file_test_2_ndebug.o): Likewise.
4527         (two_file_test_main_ndebug.o): Likewise.
4528         (incremental_test_2): Link with no-debug versions.
4529
4530 2011-07-06  Cary Coutant  <ccoutant@google.com>
4531
4532         * gold/incremental.cc
4533         (Output_section_incremental_inputs::write_info_blocks): Check for
4534         hidden and internal symbols.
4535
4536 2011-07-06  Cary Coutant  <ccoutant@google.com>
4537
4538         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4539         Check disposition for startup file.
4540         (Incremental_inputs::report_command_line): Ignore
4541         --incremental-startup-unchanged option.
4542         * options.cc (General_options::parse_incremental_startup_unchanged):
4543         New function.
4544         (General_options::General_options): Initialize new data member.
4545         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4546         (General_options): Add --incremental-startup-unchanged option.
4547         (General_options::incremental_startup_disposition): New function.
4548         (General_options::incremental_startup_disposition_): New data member.
4549
4550 2011-07-06  Cary Coutant  <ccoutant@google.com>
4551
4552         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4553         input file index to Script_info ctor.
4554         (Sized_incremental_binary::do_file_has_changed): Find the
4555         command-line argument for files named in scripts.
4556         * incremental.h (Script_info::Script_info): New ctor
4557         with input file index.
4558         (Script_info::input_file_index): New function.
4559         (Script_info::input_file_index_): New data member.
4560         (Incremental_binary::get_library): Add const.
4561         (Incremental_binary::get_script_info): Add const.
4562         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4563         * testsuite/Makefile.am (incremental_test_5): New test case.
4564         (incremental_test_6): New test case.
4565         * testsuite/Makefile.in: Regenerate.
4566
4567 2011-07-06  Cary Coutant  <ccoutant@google.com>
4568
4569         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4570         debug output when command lines differ.
4571
4572 2011-07-06  Cary Coutant  <ccoutant@google.com>
4573
4574         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4575         --incremental-patch option.
4576         * layout.cc (Free_list::allocate): Extend allocation beyond original
4577         end if enabled.
4578         (Layout::make_output_section): Mark sections that should get
4579         patch space.
4580         * options.cc (parse_percent): New function.
4581         * options.h (parse_percent): New function.
4582         (DEFINE_percent): New macro.
4583         (General_options): Add --incremental-patch option.
4584         * output.cc (Output_section::Output_section): Initialize new data
4585         members.
4586         (Output_section::add_input_section): Print section name when out
4587         of patch space.
4588         (Output_section::add_output_section_data): Likewise.
4589         (Output_section::set_final_data_size): Add patch space when
4590         doing --incremental-full.
4591         (Output_section::do_reset_address_and_file_offset): Remove patch
4592         space.
4593         (Output_segment::set_section_list_addresses): Print debug output
4594         only if --incremental-update.
4595         * output.h (Output_section::set_is_patch_space_allowed): New function.
4596         (Output_section::is_patch_space_allowed_): New data member.
4597         (Output_section::patch_space_): New data member.
4598         * parameters.cc (Parameters::incremental_full): New function.
4599         * parameters.h (Parameters::incremental_full): New function
4600         * testsuite/Makefile.am (incremental_test_2): Add test for
4601         --incremental-patch option.
4602         * testsuite/Makefile.in: Regenerate.
4603         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4604         (t18): Remove function body.
4605
4606 2011-07-05  Doug Kwan  <dougkwan@google.com>
4607
4608         PR gold/12771
4609         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4610         Arm_Address type for relocation result.
4611         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4612         overflow check.
4613         (Arm_relocate_functions::abs32): Use unaligned access.
4614         (Arm_relocate_functions::rel32): Ditto.
4615         (Arm_relocate_functions::prel31): Ditto.
4616         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4617         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4618         static data relocations.
4619         * testsuite/Makefile.in: Regnerate.
4620         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4621
4622 2011-07-05  Ian Lance Taylor  <iant@google.com>
4623
4624         PR gold/12392
4625         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4626         symbols if necessary.
4627         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4628
4629 2011-07-05  Ian Lance Taylor  <iant@google.com>
4630
4631         PR gold/12952
4632         * resolve.cc (Symbol::override_base_with_special): Simply override
4633         version with special symbol version, ignoring previous version.
4634
4635 2011-07-05  Ian Lance Taylor  <iant@google.com>
4636
4637         * object.cc (Sized_relobj_file::include_section_group): Add
4638         information to comment about signature location.
4639
4640 2011-07-02  Ian Lance Taylor  <iant@google.com>
4641
4642         PR gold/12957
4643         * options.h (class General_options): Add -f and -F.
4644         * options.cc (General_options::finalize): Fatal error if -f/-F
4645         are used without -shared.
4646         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4647
4648 2011-07-02  Ian Lance Taylor  <iant@google.com>
4649
4650         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4651
4652 2011-07-01  Ian Lance Taylor  <iant@google.com>
4653
4654         PR gold/12525
4655         PR gold/12952
4656         * resolve.cc (Symbol::override_base_with_special): Don't override
4657         the version if the overriding symbol has a different name.
4658         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4659         all callers.  If we give an error about an undefined version,
4660         define the base version if necessary.
4661         * dynobj.h (class Versions): Update declaration.
4662         * testsuite/weak_alias_test_5.cc: New file.
4663         * testsuite/weak_alias_test.script: New file.
4664         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4665         and versioned_alias have the right value, and call t2.
4666         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4667         weak_alias_test_5.so.
4668         (weak_alias_test_LDADD): Likewise.
4669         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4670         * testsuite/Makefile.in: Rebuild.
4671
4672 2011-07-01  Ian Lance Taylor  <iant@google.com>
4673
4674         PR gold/12525
4675         * options.h (class General_options): Support -z notext.
4676         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4677         -Wl,-z,notext.
4678         (two_file_shared_nonpic.so): Likewise.
4679         (two_file_shared_mixed.so): Likewise.
4680         (two_file_shared_mixed_1.so): Likewise.
4681         (weak_undef_lib_nonpic.so): Likewise.
4682         (alt/weak_undef_lib_nonpic.so): Likewise.
4683         (tls_test_shared_nonpic.so): Likewise.
4684         * testsuite/Makefile.in: Rebuild.
4685
4686 2011-07-01  Ian Lance Taylor  <iant@google.com>
4687
4688         PR gold/12525
4689         * configure.ac: Test whether static linking works, setting
4690         the automake conditional HAVE_STATIC.
4691         * testsuite/Makefile.am: Disable tests using -static if
4692         HAVE_STATIC is not true.
4693         * configure, testsuite/Makefile.in: Rebuild.
4694
4695 2011-07-01  Ian Lance Taylor  <iant@google.com>
4696
4697         PR gold/12525
4698         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4699         Assert if we see DW_EH_PE_indirect.
4700         * target.h (Target::ehframe_datarel_base): New function.
4701         (Target::do_ehframe_datarel_base): New target function.
4702         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4703         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4704         function.
4705
4706 2011-07-01  Ian Lance Taylor  <iant@google.com>
4707
4708         PR gold/12571
4709         * options.h (class General_options): Add
4710         --ld-generated-unwind-info.
4711         * ehframe.cc (Fde::write): Add address parameter.  Change all
4712         callers.  If associated with PLT, fill in address and size.
4713         (Cie::set_output_offset): Only add merge mapping if there is an
4714         object.
4715         (Cie::write): Add address parameter.  Change all callers.
4716         (Eh_frame::add_ehframe_for_plt): New function.
4717         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4718         input_offset_ fields into union u_, with new plt field.
4719         (Fde::Fde): Adjust for new union field.
4720         (Fde::Fde) [Output_data version]: New constructor.
4721         (Fde::add_mapping): Only add merge mapping if there is an object.
4722         (class Cie): Update declarations.
4723         (class Eh_frame): Declare add_ehframe_for_plt.
4724         * layout.cc (Layout::layout_eh_frame): Break out code into
4725         make_eh_frame_section, and call it.
4726         (Layout::make_eh_frame_section): New function.
4727         (Layout::add_eh_frame_for_plt): New function.
4728         * layout.h (class Layout): Update declarations.
4729         * merge.cc (Merge_map::add_mapping): Add assertion.
4730         * i386.cc: Include "dwarf.h".
4731         (class Output_data_plt_i386): Make first_plt_entry,
4732         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4733         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4734         and plt_eh_frame_fde.
4735         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4736         boundary.  Call add_eh_frame_for_plt if appropriate.
4737         * x86_64.cc: Include "dwarf.h".
4738         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4739         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4740         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4741         and plt_eh_frame_fde.
4742         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4743         appropriate.
4744
4745 2011-06-29  Ian Lance Taylor  <iant@google.com>
4746
4747         PR gold/12629
4748         * object.cc (Sized_relobj_file::layout_section): Change shdr
4749         parameter to be const.
4750         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4751         out of do_layout.
4752         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4753         appropriate.  Call layout_eh_frame_section.
4754         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4755         sections.
4756         * object.h (class Sized_relobj_file): Update declarations.
4757
4758 2011-06-29  Ian Lance Taylor  <iant@google.com>
4759
4760         PR gold/12652
4761         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4762         modifier.
4763         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4764
4765 2011-06-29  Ian Lance Taylor  <iant@google.com>
4766
4767         PR gold/12675
4768         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4769         SHT_X86_64_UNWIND.
4770         * layout.cc (Layout::layout_eh_frame): Likewise.
4771
4772 2011-06-29  Ian Lance Taylor  <iant@google.com>
4773
4774         PR gold/12695
4775         * layout.cc (Layout::symtab_section_shndx): New function.
4776         * layout.h (class Layout): Declare symtab_section_shndx.
4777         * output.cc (Output_section::write_header): Call it.
4778
4779 2011-06-29  Ian Lance Taylor  <iant@google.com>
4780
4781         PR gold/12818
4782         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4783         symbols which are not used in a relocation.
4784
4785 2011-06-28  Ian Lance Taylor  <iant@google.com>
4786
4787         PR gold/12898
4788         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4789         script create indistinguishable segments.
4790         (Layout::set_segment_offsets): Use stable_sort when sorting
4791         segments.  Pass this to Compare_segments constructor.
4792         * layout.h (class Layout): Make segment_precedes non-static.
4793         (class Compare_segments): Change from struct to class.  Add
4794         layout_ field.  Add constructor.
4795         * script-sections.cc
4796         (Script_sections::attach_sections_using_phdrs_clause): Rename
4797         local orphan to is_orphan.  Don't report failure to put empty
4798         section in segment.  On attachment failure, report name of
4799         section, and attach to first PT_LOAD segment.
4800
4801 2011-06-28  Ian Lance Taylor  <iant@google.com>
4802
4803         PR gold/12934
4804         * target-select.cc (Target_selector::Target_selector): Add
4805         emulation parameter.  Change all callers.
4806         (select_target_by_bfd_name): Rename from select_target_by_name.
4807         Change all callers.
4808         (select_target_by_emulation): New function.
4809         (supported_emulation_names): New function.
4810         * target-select.h (class Target_selector): Add emulation_ field.
4811         Update declarations.
4812         (Target_selector::recognize_by_bfd_name): Rename from
4813         recognize_by_name.  Change all callers.
4814         (Target_selector::supported_bfd_names): Rename from
4815         supported_names.  Change all callers.
4816         (Target_selector::recognize_by_emulation): New function.
4817         (Target_selector::supported_emulations): New function.
4818         (Target_selector::emulation): New function.
4819         (Target_selector::do_recognize_by_bfd_name): Rename from
4820         do_recognize_by_name.  Change all callers.
4821         (Target_selector::do_supported_bfd_names): Rename from
4822         do_supported_names.  Change all callers.
4823         (Target_selector::do_recognize_by_emulation): New function.
4824         (Target_selector::do_supported_emulations): New function.
4825         (select_target_by_bfd_name): Change name in declaration.
4826         (select_target_by_emulation): Declare.
4827         (supported_emulation_names): Declare.
4828         * parameters.cc (parameters_force_valid_target): Try to find
4829         target based on emulation from -m option.
4830         * options.h (class General_options): Change doc string for -m.
4831         * options.cc (help): Print emulations.
4832         (General_options::parse_V): Likewise.
4833         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4834         Add emulation parameter.  Change all callers.
4835
4836 2011-06-28  Ian Lance Taylor  <iant@google.com>
4837
4838         * target.h (class Target): Add osabi_ field.
4839         (Target::osabi): New function.
4840         (Target::set_osabi): New function.
4841         (Target::Target): Initialize osabi_.
4842         (Target::do_adjust_elf_header): Make pure virtual.
4843         (Sized_target::do_adjust_elf_header): Declare.
4844         * target.cc (Sized_target::do_adjust_elf_header): New function.
4845         (class Sized_target): Instantiate all versions.
4846         * freebsd.h (class Target_freebsd): Remove.
4847         (Target_selector_freebsd::do_recognize): Call set_osabi on
4848         Target.
4849         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4850         (Target_selector_freebsd::set_osabi): Remove.
4851         * i386.cc (class Target_i386): Inherit from Sized_target rather
4852         than Target_freebsd.
4853         * x86_64.cc (class Target_x86_64): Likewise.
4854
4855 2011-06-28  Ian Lance Taylor  <iant@google.com>
4856
4857         * target.h (Target::can_check_for_function_pointers): Rewrite.
4858         Make non-virtual.
4859         (Target::can_icf_inline_merge_sections): Likewise.
4860         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4861         (Target::Target_info): Add can_icf_inline_merge_sections field.
4862         (Target::do_can_check_for_function_pointers): New virtual
4863         function.
4864         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4865         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4866         from can_check_for_function_pointers, move in file.
4867         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4868         section_may_have_icf_unsafe_poineters, move in file.
4869         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4870         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4871         Rename from can_check_for_function_pointers, move in file.
4872         (Target_i386::can_icf_inline_merge_sections): Remove.
4873         (Target_i386::i386_info): Initialize
4874         can_icf_inline_merge_sections.
4875         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4876         Initialize can_icf_inline_merge_sections.
4877         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4878         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4879         Rename from can_check_for_function_pointers, move in file.
4880         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4881         (Target_x86_64::x86_64_info): Initialize
4882         can_icf_inline_merge_sections.
4883         * testsuite/testfile.cc (Target_test::test_target_info):
4884         Likewise.
4885         * icf.cc (get_section_contents): Correct formatting.
4886
4887 2011-06-27  Ian Lance Taylor  <iant@google.com>
4888
4889         * symtab.cc (Symbol::versioned_name): New function.
4890         (Symbol_table::add_to_final_symtab): Use versioned_name when
4891         appropriate.
4892         (Symbol_table::sized_write_symbol): Likewise.
4893         * symtab.h (class Symbol): Declare versioned_name.
4894         * stringpool.h (class Stringpool_template): Add variant of add
4895         which takes a std::basic_string.
4896         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4897         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4898         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4899         (ver_test_12.o): New target.
4900         * testsuite/Makefile.in: Rebuild.
4901
4902 2011-06-27  Doug Kwan  <dougkwan@google.com>
4903
4904         * arm.cc (Arm_relocate_functions::thm_jump8,
4905         Arm_relocate_functions::thm_jump11): Use a wider signed
4906         type to compute offset.
4907         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4908         arm_thm_jump8.
4909         * testsuite/Makefile.in: Regenerate.
4910         * testsuite/arm_branch_in_range.sh: Check test results of
4911         arm_thm_jump11 and arm_thm_jump8.
4912         * testsuite/arm_thm_jump11.s: New test source file.
4913         * testsuite/arm_thm_jump11.t: New linker script.
4914         * testsuite/arm_thm_jump8.s: New test source file.
4915         * testsuite/arm_thm_jump8.t: New linker script.
4916
4917 2011-06-24  Ian Lance Taylor  <iant@google.com>
4918
4919         * layout.cc: Include "object.h".
4920         (ctors_sections_in_init_array): New static variable.
4921         (Layout::is_ctors_in_init_array): New function.
4922         (Layout::layout): Add entry to ctors_sections_in_init_array if
4923         appropriate.
4924         * layout.h (class Layout): Declare is_ctors_in_init_array.
4925         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4926         is_ctors_reverse_view is set.
4927         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4928         all callers.  Set is_ctors_reverse_view field of View_size.
4929         (Sized_relobj_file::reverse_words): New function.
4930         * object.h (Sized_relobj_file::View_size): Add
4931         is_ctors_reverse_view field.
4932         (class Sized_relobj_file): Update declarations.
4933         * testsuite/initpri3.c: New test.
4934         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4935         initpri3b.
4936         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4937         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4938         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4939         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4940         * testsuite/Makefile.in: Rebuild.
4941
4942 2011-06-24  Cary Coutant  <ccoutant@google.com>
4943
4944         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4945         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4946         (debug_msg_cdebug.err): New targets.
4947         * testsuite/Makefile.in: Regenerate.
4948         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4949         Fix checks for link with shared library.
4950
4951 2011-06-24  Doug Kwan  <dougkwan@google.com>
4952
4953         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4954         skip empty text sections.
4955         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4956
4957 2011-06-22  Ian Lance Taylor  <iant@google.com>
4958
4959         PR gold/12910
4960         * options.h (class General_options): Add --ctors-in-init-array.
4961         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4962         friends as SHT_PROGBITS for merging sections.
4963         (Layout::layout): Remove special handling of .init_array and
4964         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4965         and .dtors if ctors_in_init_array.
4966         (Layout::make_output_section): Force correct section types for
4967         .init_array and friends.  Don't sort if doing relocatable link,
4968         Don't sort .ctors and .dtors if ctors_in_init_array.
4969         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4970         (Layout::output_section_name): Add relobj parameter.  Change all
4971         callers.  Handle .ctors. and .dtors. in code rather than table.
4972         Handle .ctors and .dtors if ctors_in_init_array.
4973         (Layout::match_file_name): New function, moved from output.cc.
4974         * layout.h (class Layout): Update declarations.
4975         * output.cc: Include "layout.h".
4976         (Input_section_sort_entry::get_priority): New function.
4977         (Input_section_sort_entry::match_file_name): Just call
4978         Layout::match_file_name.
4979         (Output_section::Input_section_sort_init_fini_compare::operator()):
4980         Handle .ctors and .dtors.  Sort by explicit priority rather than
4981         by name.
4982         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4983         * testsuite/initpri2.c: New test.
4984         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4985         (check_PROGRAMS): Add initpri2.
4986         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4987         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4988         * configure, testsuite/Makefile.in: Rebuild.
4989
4990 2011-06-19  Ian Lance Taylor  <iant@google.com>
4991
4992         PR gold/12880
4993         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4994         .interp section to a PT_INTERP segment even if we have seen a
4995         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4996         clause in a linker script.
4997         (Layout::finalize): Don't create a .interp section if we've
4998         already create a PT_INTERP segment.
4999         (Layout::create_interp): Always call choose_output_section (revert
5000         patch of 2011-06-17).  Don't create PT_INTERP segment.
5001         * script-sections.cc
5002         (Script_sections::create_note_and_tls_segments): Add a .interp
5003         section to a PT_INTERP segment even if we have seen a
5004         --dynamic-linker option.
5005
5006 2011-06-18  Ian Lance Taylor  <iant@google.com>
5007
5008         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5009         merely because a non-PT_LOAD segment has a dynamic reloc.
5010
5011 2011-06-18  Ian Lance Taylor  <iant@google.com>
5012
5013         * layout.cc (Layout::finish_dynamic_section): Don't create
5014         DT_FLAGS entry if not needed.
5015
5016 2011-06-18  Ian Lance Taylor  <iant@google.com>
5017
5018         PR gold/12745
5019         * layout.cc (Layout::layout_eh_frame): Correct handling of
5020         writable .eh_frame section.
5021
5022 2011-06-17  Ian Lance Taylor  <iant@google.com>
5023
5024         PR gold/12893
5025         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5026         symbol is redefined with the exact same object and value.
5027
5028 2011-06-17  Ian Lance Taylor  <iant@google.com>
5029
5030         PR gold/12880
5031         * layout.h (class Layout): Add interp_segment_ field.
5032         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5033         (Layout::attach_allocated_section_to_segment): If making shared
5034         library, put .interp section in PT_INTERP segment.
5035         (Layout::finalize): Also call create_interp if -dynamic-linker
5036         option was used.
5037         (Layout::create_interp): Assert that there is no PT_INTERP
5038         segment.  If not using a SECTIONS clause, use make_output_section.
5039         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5040         * script-sections.cc
5041         (Script_sections::create_note_and_tls_segments): If making shared
5042         library, put .interp section in PT_INTERP segment.
5043
5044 2011-06-17  Ian Lance Taylor  <iant@google.com>
5045
5046         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5047         when making a shared library.
5048
5049 2011-06-17  Ian Lance Taylor  <iant@google.com>
5050
5051         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5052         parameter.  Change all callers.  Don't issue warning about PC32
5053         against locally defined symbol.
5054
5055 2011-06-16  Ian Lance Taylor  <iant@google.com>
5056
5057         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5058         occurs in same object.
5059
5060 2011-06-14  Alan Modra  <amodra@gmail.com>
5061
5062         * po/POTFILES.in: Regenerate.
5063
5064 2011-06-09  Ian Lance Taylor  <iant@google.com>
5065
5066         * script-sections.cc
5067         (Orphan_output_section::set_section_addresses): For a relocatable
5068         link set address to 0.
5069
5070 2011-06-09  Cary Coutant  <ccoutant@google.com>
5071
5072         PR gold/12804
5073         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5074         used with --compress-debug-sections.
5075         * gold/object.cc (Sized_relobj_file::do_layout): Report
5076         uncompressed size of compressed input sections.
5077
5078 2011-06-08  Cary Coutant  <ccoutant@google.com>
5079
5080         PR gold/12804
5081         * testsuite/two_file_test_2_v1.cc: Change initialization of
5082         v2 to keep it in .data.
5083
5084 2011-06-07  Cary Coutant  <ccoutant@google.com>
5085
5086         * common.cc (Symbol_table::do_allocate_commons_list): Call
5087         gold_fallback.
5088         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5089         (Errors::fallback): New function.
5090         (gold_fallback): New function.
5091         * errors.h (Errors::fallback): New function.
5092         * gold.cc (gold_exit): Change status parameter to enum; adjust
5093         all callers.
5094         (queue_initial_tasks): Call gold_fallback.
5095         * gold.h: Include cstdlib.
5096         (Exit_status): New enum type.
5097         (gold_exit): Change status parameter to enum.
5098         (gold_fallback): New function.
5099         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5100         (Layout::create_symtab_sections): Likewise.
5101         (Layout::create_shdrs): Likewise.
5102         * main.cc (main): Adjust call to gold_exit.
5103         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5104         (Output_data_got::add_got_entry_pair): Likewise.
5105         (Output_section::add_input_section): Likewise.
5106         (Output_section::add_output_section_data): Likewise.
5107         (Output_segment::set_section_list_addresses): Likewise.
5108         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5109
5110 2011-06-07  Cary Coutant  <ccoutant@google.com>
5111
5112         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5113         for incremental links.
5114         * output.cc (Output_segment::set_section_list_addresses): Remove
5115         FIXME and test for TLS or BSS.
5116
5117 2011-06-07  Cary Coutant  <ccoutant@google.com>
5118
5119         * testsuite/Makefile.am: Add incremental_copy_test,
5120         incremental_common_test_1.
5121         * testsuite/Makefile.in: Regenerate.
5122         * testsuite/common_test_1_v1.c: New source file.
5123         * testsuite/common_test_1_v2.c: New source file.
5124         * testsuite/copy_test_v1.cc: New source file.
5125
5126 2011-06-07  Cary Coutant  <ccoutant@google.com>
5127
5128         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5129         update, allocate common from bss section's free list.
5130         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5131         linker-defined symbols.
5132         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5133         Skip GOT and PLT entries that are no longer referenced.
5134         (Output_section_incremental_inputs::write_info_blocks): Mark
5135         linker-defined symbols.
5136         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5137         * output.cc (Output_section::allocate): New function.
5138         * output.h (Output_section::allocate): New function.
5139         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5140         linker-defined symbols.
5141         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5142         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5143         (Symbol::init_base_output_data): Likewise.
5144         (Symbol::init_base_output_segment): Likewise.
5145         (Symbol::init_base_constant): Likewise.
5146         (Sized_symbol::init_output_data): Likewise.
5147         (Sized_symbol::init_output_segment): Likewise.
5148         (Sized_symbol::init_constant): Likewise.
5149         (Symbol_table::do_define_in_output_data): Likewise.
5150         (Symbol_table::do_define_in_output_segment): Likewise.
5151         (Symbol_table::do_define_as_constant): Likewise.
5152         * symtab.h (Symbol::is_predefined): New function.
5153         (Symbol::init_base_output_data): Add is_predefined parameter.
5154         (Symbol::init_base_output_segment): Likewise.
5155         (Symbol::init_base_constant): Likewise.
5156         (Symbol::is_predefined_): New data member.
5157         (Sized_symbol::init_output_data): Add is_predefined parameter.
5158         (Sized_symbol::init_output_segment): Likewise.
5159         (Sized_symbol::init_constant): Likewise.
5160         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5161
5162 2011-06-07  Cary Coutant  <ccoutant@google.com>
5163
5164         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5165         instead of emit_copy_reloc.
5166         (Copy_relocs::emit_copy_reloc): Refactor.
5167         (Copy_relocs::make_copy_reloc): New function.
5168         (Copy_relocs::add_copy_reloc): Remove.
5169         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5170         section.
5171         (Copy_relocs::make_copy_reloc): New function.
5172         (Copy_relocs::add_copy_reloc): Remove.
5173         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5174         unchanged input files.
5175         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5176         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5177         Reserve BSS space for COPY relocations.
5178         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5179         (Output_section_incremental_inputs::write_info_blocks): Record
5180         whether a symbol is copied from a shared object.
5181         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5182         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5183         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5184         (Incremental_input_entry_reader::get_output_symbol_index): Add
5185         is_copy parameter.
5186         (Incremental_binary::emit_copy_relocs): New function.
5187         (Incremental_binary::do_emit_copy_relocs): New function.
5188         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5189         new data member.
5190         (Sized_incremental_binary::add_copy_reloc): New function.
5191         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5192         (Sized_incremental_binary::Copy_reloc): New struct.
5193         (Sized_incremental_binary::Copy_relocs): New typedef.
5194         (Sized_incremental_binary::copy_relocs_): New data member.
5195         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5196         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5197         * target.h (Sized_target::emit_copy_reloc): New function.
5198         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5199
5200 2011-06-02  Cary Coutant  <ccoutant@google.com>
5201
5202         PR gold/12163
5203         * gold/archive.cc (Archive::Archive): Initialize new data member.
5204         (Archive::include_all_members): Return if archive has already been
5205         included.
5206         * gold/archive.h (Archive::include_all_members_): New data member.
5207
5208 2011-06-02  Nick Clifton  <nickc@redhat.com>
5209
5210         * dynobj.h: Fix spelling mistake in comment.
5211         * output.cc: Likewise.
5212
5213 2011-05-31  Doug Kwan  <dougkwan@google.com>
5214             Asier Llano
5215
5216         PR gold/12826
5217         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5218         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5219         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5220         redundant arm_exidx_test.so.
5221         * testsuite/Makefile.in: Regenerate.
5222         (check_SCRIPTS): Add pr12826.sh
5223         (check_DATA): Add pr12826.stdout
5224         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5225         * testsuite/pr12826.sh: New file.
5226         * testsuite/pr12826_1.s: Ditto.
5227         * testsuite/pr12826_1.s: Ditto.
5228
5229 2011-05-30  Ian Lance Taylor  <iant@google.com>
5230
5231         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5232         sections.
5233
5234 2011-05-29  Ian Lance Taylor  <iant@google.com>
5235
5236         PR gold/12804
5237         * testsuite/Makefile.am: Use different file name for two_file_test
5238         temporary file for each incremental test.
5239         * testsuite/Makefile.in: Rebuild.
5240
5241 2011-05-29  Ian Lance Taylor  <iant@google.com>
5242
5243         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5244         binary input file is empty.
5245
5246 2011-05-27  Ian Lance Taylor  <iant@google.com>
5247
5248         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5249         (ver_test_9.so): Likewise.
5250         * testsuite/Makefile.in: Rebuild.
5251
5252 2011-05-26 Cary Coutant  <ccoutant@google.com>
5253
5254         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5255         * incremental.cc (Incremental_inputs::report_input_section): Fix
5256         comment, indentation.
5257         (Incremental_inputs::report_comdat_group): New function.
5258         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5259         of data for incremental input file entry.
5260         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5261         group count, COMDAT group signatures.
5262         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5263         an unchanged input file.
5264         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5265         Initialize new data member.
5266         (Incremental_object_entry::add_comdat_group): New function.
5267         (Incremental_object_entry::get_comdat_group_count): New function.
5268         (Incremental_object_entry::get_comdat_signature_key): New function.
5269         (Incremental_object_entry::groups_): New data member.
5270         (Incremental_inputs::report_comdat_group): New function.
5271         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5272         data for incremental input file entry.
5273         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5274         (Incremental_input_entry_reader::get_input_section): Adjust size of
5275         data for incremental input file entry.
5276         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5277         (Incremental_input_entry_reader::get_comdat_group_signature): New
5278         function.
5279         * object.cc (Sized_relobj::include_section_group): Report kept
5280         COMDAT groups for incremental links.
5281
5282 2011-05-24  David Meyer  <pdox@google.com>
5283
5284         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5285         with name parameter.  Add found_name parameter.
5286         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5287         * dirsearch.h (class Dirsearch): Update declaration.
5288
5289 2011-05-24  Ian Lance Taylor  <iant@google.com>
5290
5291         * archive.cc (Library_base::should_include_member): Pull in object
5292         from archive if it defines the entry symbol.
5293         * parameters.cc (Parameters::entry): New function.
5294         * parameters.h (class Parameters): Declare entry.
5295         * output.h (class Output_file_header): Remove entry_ field.
5296         * output.cc (Output_file_header::Output_file_header): Remove entry
5297         parameter.  Change all callers.
5298         (Output_file_header::entry): Use parameters->entry.
5299         * gold.cc (queue_middle_tasks): Likewise.
5300         * plugin.cc (Plugin_hook::run): Likewise.
5301
5302 2011-05-24 Cary Coutant  <ccoutant@google.com>
5303
5304         * gold.cc (queue_initial_tasks): Pass incremental base filename
5305         to Output_file::open_base_file; don't print error message.
5306         * incremental-dump.cc (main): Adjust call to
5307         Output_file::open_for_modification.
5308         * incremental-dump.cc (main): Likewise.
5309         * incremental.cc (Incremental_inputs::report_command_line):
5310         Ignore --incremental-base option when comparing command lines.
5311         Ignore parameter when given as separate argument.
5312         * options.h (class General_options): Add --incremental-base.
5313         * output.cc (Output_file::Output_file):
5314         (Output_file::open_base_file): Add base_name and writable parameters;
5315         read base file into new file; print error message here.
5316         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5317         callers.
5318         * output.h (Output_file::open_for_modification): Rename to...
5319         (Output_file::open_base_file): ...this; add base_name and
5320         writable parameters; adjust all callers.
5321         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5322         callers.
5323         * testsuite/Makefile.am (incremental_test_4): Test
5324         --incremental-base.
5325         * testsuite/Makefile.in: Regenerate.
5326
5327 2011-05-24 Cary Coutant  <ccoutant@google.com>
5328
5329         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5330         incremental_test_4.
5331         * testsuite/Makefile.in: Regenerate.
5332         * testsuite/two_file_test_1_v1.cc: New test source file.
5333         * testsuite/two_file_test_1b_v1.cc: New test source file.
5334         * testsuite/two_file_test_2_v1.cc: New test source file.
5335
5336 2011-05-24 Cary Coutant  <ccoutant@google.com>
5337
5338         * dynobj.h (Dynobj::do_dynobj): New function.
5339         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5340         flag and soname for shared objects.
5341         * incremental.cc (Incremental_inputs::report_object): Make
5342         either Incremental_object_entry or Incremental_dynobj_entry; add
5343         soname to string table.
5344         (Incremental_inputs::report_input_section): Add assertion.
5345         (Output_section_incremental_inputs::set_final_data_size): Adjust
5346         type of input file entry for shared libraries; adjust size of
5347         shared library info entry.
5348         (Output_section_incremental_inputs::write_input_files): Write
5349         as_needed flag for shared libraries.
5350         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5351         of input file entry for shared libraries; write soname.
5352         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5353         soname from incremental info.
5354         * incremental.h (enum Incremental_input_flags): Add
5355         INCREMENTAL_INPUT_AS_NEEDED.
5356         (Incremental_input_entry::Incremental_input_entry): Initialize new
5357         data member.
5358         (Incremental_input_entry::set_as_needed): New function.
5359         (Incremental_input_entry::as_needed): New function.
5360         (Incremental_input_entry::do_dynobj_entry): New function.
5361         (Incremental_input_entry::as_needed_): New data member.
5362         (Incremental_object_entry::Incremental_object_entry): Don't check
5363         for shared library.
5364         (Incremental_object_entry::do_type): Likewise.
5365         (class Incremental_dynobj_entry): New class.
5366         (Incremental_input_entry_reader::as_needed): New function.
5367         (Incremental_input_entry_reader::get_soname): New function.
5368         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5369         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5370         size of shared library info entry.
5371         * layout.cc (Layout::finish_dynamic_section): Don't test for
5372         incremental link when adding DT_NEEDED entries.
5373         * object.h (Object::Object): Initialize new data member.
5374         (Object::dynobj): New function.
5375         (Object::set_as_needed): New function.
5376         (Object::as_needed): New function.
5377         (Object::do_dynobj): New function.
5378         (Object::as_needed_): New data member.
5379
5380 2011-05-24 Cary Coutant  <ccoutant@google.com>
5381
5382         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5383         info; adjust display of GOT entries.
5384         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5385         vector of input objects; remove file_status_.
5386         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5387         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5388         got_plt reader; call target hooks to reserve GOT entries.
5389         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5390         of input file info header and GOT info entry.
5391         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5392         relocation info.
5393         (Got_plt_view_info::got_descriptor): Remove.
5394         (Got_plt_view_info::sym_index): New data member.
5395         (Got_plt_view_info::input_index): New data member.
5396         (Local_got_offset_visitor::visit): Write input file index.
5397         (Global_got_offset_visitor::visit): Write 0 for input file index.
5398         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5399         with sym_index and input_index.
5400         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5401         incremental info GOT entry; replace got_descriptor with input_index.
5402         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5403         map from input file index to object.
5404         (Sized_relobj_incr::do_layout): Replace direct data member reference
5405         with accessor function.
5406         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5407         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5408         Adjust size of input file info header.
5409         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5410         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5411         (Incremental_input_entry_reader::get_input_section): Adjust size of
5412         input file info header.
5413         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5414         of incremental info GOT entry.
5415         (Incremental_got_plt_reader::get_got_desc): Remove.
5416         (Incremental_got_plt_reader::get_got_symndx): New function.
5417         (Incremental_got_plt_reader::get_got_input_index): New function.
5418         (Sized_incremental_binary::Sized_incremental_binary): Remove
5419         file_status_; add input_objects_.
5420         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5421         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5422         (Sized_incremental_binary::file_is_unchanged): Remove.
5423         (Sized_incremental_binary::set_input_object): New function.
5424         (Sized_incremental_binary::input_object): New function.
5425         (Sized_incremental_binary::file_status_): Remove.
5426         (Sized_incremental_binary::input_objects_): New data member.
5427         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5428         references.
5429         (Sized_relobj_incr::invalid_address): Move to base class.
5430         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5431         class.
5432         (Sized_relobj_incr::do_output_section_offset): Likewise.
5433         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5434         (Sized_relobj_incr::section_offsets_): Likewise.
5435         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5436         function.
5437         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5438         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5439         with accessor function.
5440         (Sized_relobj_file::do_layout): Likewise.
5441         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5442         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5443         (Sized_relobj_file::compute_final_local_value): Replace refs to
5444         section_offsets_ with accessor function.
5445         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5446         * object.h (Relobj::Relobj): Initialize new data members.
5447         (Relobj::add_dyn_reloc): New function.
5448         (Relobj::first_dyn_reloc): New function.
5449         (Relobj::dyn_reloc_count): New function.
5450         (Relobj::first_dyn_reloc_): New data member.
5451         (Relobj::dyn_reloc_count_): New data member.
5452         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5453         references.
5454         (Sized_relobj::Address): New typedef.
5455         (Sized_relobj::invalid_address): Move here from child class.
5456         (Sized_relobj::Sized_relobj): Initialize new data members.
5457         (Sized_relobj::sized_relobj): New function.
5458         (Sized_relobj::is_output_section_offset_invalid): Move here from
5459         child class.
5460         (Sized_relobj::get_output_section_offset): Likewise.
5461         (Sized_relobj::local_has_got_offset): Likewise.
5462         (Sized_relobj::local_got_offset): Likewise.
5463         (Sized_relobj::set_local_got_offset): Likewise.
5464         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5465         (Sized_relobj::clear_got_offsets): New function.
5466         (Sized_relobj::section_offsets): Move here from child class.
5467         (Sized_relobj::do_output_section_offset): Likewise.
5468         (Sized_relobj::do_set_section_offset): Likewise.
5469         (Sized_relobj::Local_got_offsets): Likewise.
5470         (Sized_relobj::local_got_offsets_): Likewise.
5471         (Sized_relobj::section_offsets_): Likewise.
5472         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5473         references.
5474         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5475         class.
5476         (Sized_relobj_file::sized_relobj): New function
5477         (Sized_relobj_file::local_has_got_offset): Move to base class.
5478         (Sized_relobj_file::local_got_offset): Likewise.
5479         (Sized_relobj_file::set_local_got_offset): Likewise.
5480         (Sized_relobj_file::get_output_section_offset): Likewise.
5481         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5482         (Sized_relobj_file::do_output_section_offset): Likewise.
5483         (Sized_relobj_file::do_set_section_offset): Likewise.
5484         (Sized_relobj_file::Local_got_offsets): Likewise.
5485         (Sized_relobj_file::local_got_offsets_): Likewise.
5486         (Sized_relobj_file::section_offsets_): Likewise.
5487         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5488         (all constructors).
5489         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5490         (Output_reloc::get_symbol_index): Likewise.
5491         (Output_reloc::local_section_offset): Likewise.
5492         (Output_reloc::get_address): Likewise.
5493         (Output_reloc::symbol_value): Likewise.
5494         (Output_data_got::reserve_slot): Move to class definition.
5495         (Output_data_got::reserve_local): New function.
5496         (Output_data_got::reserve_slot_for_global): Remove.
5497         (Output_data_got::reserve_global): New function.
5498         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5499         (all constructors, two instantiations).
5500         (Output_reloc::get_relobj): New function (two instantiations).
5501         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5502         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5503         (Output_data_reloc::add_global): Adjust type of relobj.
5504         (Output_data_reloc::add_global_relative): Likewise.
5505         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5506         (Output_data_reloc::add_local): Likewise.
5507         (Output_data_reloc::add_local_relative): Likewise.
5508         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5509         (Output_data_reloc::add_local_section): Likewise.
5510         (Output_data_reloc::add_output_section): Likewise.
5511         (Output_data_reloc::add_absolute): Likewise.
5512         (Output_data_reloc::add_target_specific): Likewise.
5513         (Output_data_got::reserve_slot): Move definition here.
5514         (Output_data_got::reserve_local): New function.
5515         (Output_data_got::reserve_global): New function.
5516         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5517         section_offsets_ with accessor function.
5518         (Sized_relobj_file::write_sections): Likewise.
5519         (Sized_relobj_file::do_relocate_sections): Likewise.
5520         * target.h (Sized_target::reserve_local_got_entry): New function.
5521         (Sized_target::reserve_global_got_entry): New function.
5522         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5523         (Target_x86_64::reserve_global_got_entry): New function.
5524         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5525
5526 2011-05-23 Cary Coutant  <ccoutant@google.com>
5527
5528         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5529         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5530         bit when checking got_type.
5531         * incremental.cc (Sized_incremental_binary::setup_readers):
5532         Store symbol table and string table locations; initialize bit vector
5533         of file status flags.
5534         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5535         unchanged files.
5536         (Sized_incremental_binary::do_process_got_plt): New function.
5537         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5538         (Output_section_incremental_inputs::set_final_data_size): Record
5539         file index for each input file.
5540         (Output_section_incremental_inputs::write_got_plt): Store file index
5541         instead of input entry offset for each GOT entry.
5542         * incremental.h
5543         (Incremental_input_entry::Incremental_input_entry): Initialize new
5544         data member.
5545         (Incremental_input_entry::set_offset): Store file index.
5546         (Incremental_input_entry::get_file_index): New function.
5547         (Incremental_input_entry::file_index_): New data member.
5548         (Incremental_binary::process_got_plt): New function.
5549         (Incremental_binary::do_process_got_plt): New function.
5550         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5551         data members.
5552         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5553         (Sized_incremental_binary::set_file_is_unchanged): New function.
5554         (Sized_incremental_binary::file_is_unchanged): New function.
5555         (Sized_incremental_binary::do_process_got_plt): New function.
5556         (Sized_incremental_binary::file_status_): New data member.
5557         (Sized_incremental_binary::main_symtab_loc_): New data member.
5558         (Sized_incremental_binary::main_strtab_loc_): New data member.
5559         * output.cc (Output_data_got::Got_entry::write): Add case
5560         RESERVED_CODE.
5561         (Output_data_got::add_global): Call add_got_entry.
5562         (Output_data_got::add_global_plt): Likewise.
5563         (Output_data_got::add_global_with_rel): Likewise.
5564         (Output_data_got::add_global_with_rela): Likewise.
5565         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5566         (Output_data_got::add_global_pair_with_rela): Likewise.
5567         (Output_data_got::add_local): Call add_got_entry.
5568         (Output_data_got::add_local_plt): Likewise.
5569         (Output_data_got::add_local_with_rel): Likewise.
5570         (Output_data_got::add_local_with_rela): Likewise.
5571         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5572         (Output_data_got::add_local_pair_with_rela): Likewise.
5573         (Output_data_got::reserve_slot): New function.
5574         (Output_data_got::reserve_slot_for_global): New function.
5575         (Output_data_got::add_got_entry): New function.
5576         (Output_data_got::add_got_entry_pair): New function.
5577         (Output_section::add_output_section_data): Edit FIXME.
5578         * output.h
5579         (Output_section_data_build::Output_section_data_build): New
5580         constructor with size parameter.
5581         (Output_data_space::Output_data_space): Likewise.
5582         (Output_data_got::Output_data_got): Initialize new data member; new
5583         constructor with size parameter.
5584         (Output_data_got::add_constant): Call add_got_entry.
5585         (Output_data_got::reserve_slot): New function.
5586         (Output_data_got::reserve_slot_for_global): New function.
5587         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5588         (Output_data_got::add_got_entry): New function.
5589         (Output_data_got::add_got_entry_pair): New function.
5590         (Output_data_got::free_list_): New data member.
5591         * target.h (Sized_target::init_got_plt_for_update): New function.
5592         (Sized_target::register_global_plt_entry): New function.
5593         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5594         Initialize new data member; call init; add constructor with PLT count.
5595         (Output_data_plt_x86_64::init): New function.
5596         (Output_data_plt_x86_64::add_relocation): New function.
5597         (Output_data_plt_x86_64::reserve_slot): New function.
5598         (Output_data_plt_x86_64::free_list_): New data member.
5599         (Target_x86_64::init_got_plt_for_update): New function.
5600         (Target_x86_64::register_global_plt_entry): New function.
5601         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5602         incremental updates.
5603         (Output_data_plt_x86_64::add_relocation): New function.
5604         * testsuite/object_unittest.cc (Object_test): Set default options.
5605
5606 2011-05-16  Ian Lance Taylor  <iant@google.com>
5607
5608         * options.h (class General_options): Make -i a synonym for -r.
5609
5610 2011-05-16  Ian Lance Taylor  <iant@google.com>
5611
5612         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5613
5614 2011-05-10 Cary Coutant  <ccoutant@google.com>
5615
5616         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5617         strip_all (-s).
5618
5619 2011-05-06  Ian Lance Taylor  <iant@google.com>
5620
5621         * layout.cc (Layout::layout): If the output section flags change,
5622         update the ordering.
5623
5624 2011-04-25 Cary Coutant  <ccoutant@google.com>
5625
5626         * incremental-dump.cc (dump_incremental_inputs): Print local
5627         symbol info for each input file.
5628         * incremental.cc
5629         (Output_section_incremental_inputs::set_final_data_size): Add local
5630         symbol info to input file entries in incremental info.
5631         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5632         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5633         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5634         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5635         implementation.
5636         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5637         (Sized_incr_relobj::do_relocate): Write the local symbols.
5638         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5639         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5640         Adjust size of input file header.
5641         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5642         (Incremental_inputs_reader::get_local_symbol_count): New function.
5643         (Incremental_inputs_reader::get_input_section): Adjust size of input
5644         file header.
5645         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5646         (Sized_incr_relobj::This): New typedef.
5647         (Sized_incr_relobj::sym_size): New const data member.
5648         (Sized_incr_relobj::Local_symbol): New struct.
5649         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5650         (Sized_incr_relobj::do_local_symbol_offset): New function.
5651         (Sized_incr_relobj::local_symbol_count_): New data member.
5652         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5653         (Sized_incr_relobj::local_symbol_index_): New data member.
5654         (Sized_incr_relobj::local_symbol_offset_): New data member.
5655         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5656         (Sized_incr_relobj::local_symbols_): New data member.
5657         * object.h (Relobj::output_local_symbol_count): New function.
5658         (Relobj::local_symbol_offset): New function.
5659         (Relobj::do_output_local_symbol_count): New function.
5660         (Relobj::do_local_symbol_offset): New function.
5661         (Sized_relobj::do_output_local_symbol_count): New function.
5662         (Sized_relobj::do_local_symbol_offset): New function.
5663
5664 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5665
5666         * descriptors.cc (set_close_on_exec): New function.
5667         (Descriptors::open): Use set_close_on_exec.
5668         * output.cc (S_ISLNK): Define if not defined.
5669
5670 2011-04-22 Cary Coutant  <ccoutant@google.com>
5671
5672         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5673         global symbol map.
5674         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5675         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5676         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5677         relocations.
5678         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5679         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5680         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5681         * incremental.h
5682         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5683         function.
5684         (Incremental_binary::apply_incremental_relocs): New function.
5685         (Incremental_binary::do_apply_incremental_relocs): New function.
5686         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5687         data member.
5688         (Sized_incremental_binary::add_global_symbol): New function.
5689         (Sized_incremental_binary::global_symbol): New function.
5690         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5691         (Sized_incremental_binary::symbol_map_): New data member.
5692         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5693         * target.h (Sized_target::apply_relocation): New function.
5694         * target-reloc.h (apply_relocation): New function.
5695         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5696
5697 2011-04-22  Doug Kwan  <dougkwan@google.com>
5698
5699         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5700         flag of a SHT_ARM_EXIDX section.
5701         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5702         * testsuite/Makefile.in: Regenerate.
5703         * testsuite/arm_exidx_test.s: New file.
5704         * testsuite/arm_exidx_test.sh: Same.
5705
5706 2011-04-20 Cary Coutant  <ccoutant@google.com>
5707
5708         PR gold/12689
5709         * archive.h (Incremental_archive_entry::Archive_member):
5710         Initialize arg_serial_ (second constructor).
5711
5712 2011-04-17  Ian Lance Taylor  <iant@google.com>
5713
5714         * object.cc (Relocate_info::location): Simplify location string.
5715         * errors.cc (Errors::error_at_location): Don't print program
5716         name.
5717         (Errors::warning_at_location): Likewise.
5718         (Errors::undefined_symbol): Likewise.
5719         * testsuite/debug_msg.sh: Update accordingly.
5720
5721 2011-04-14 Cary Coutant  <ccoutant@google.com>
5722
5723         * gold/layout.cc (Layout::symtab_section_offset): New function.
5724         * gold/layout.h (Layout::symtab_section_offset): New function.
5725         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5726
5727 2011-04-12  Ian Lance Taylor  <iant@google.com>
5728
5729         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5730         with MREMAP_MAYMOVE.
5731         * output.h (class Output_file): Add map_is_allocated_ field.
5732         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5733         not available, provide stubs.  If mremap is not available, #define
5734         it to gold_mremap.
5735         (MREMAP_MAYMOVE): Define if not defined.
5736         (Output_file::Output_file): Initialize map_is_allocated_.
5737         (Output_file::resize): Check map_is_allocated_.
5738         (Output_file::map_anonymous): If mmap fails, use malloc.
5739         (Output_file::unmap): Don't do anything for an anonymous map.
5740         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5741         is not available, provide stubs.
5742         (File_read::View::~View): Use free rather than delete[].
5743         (File_read::make_view): Use malloc rather than new[].  If mmap
5744         fails, use malloc.
5745         (File_read::find_or_make_view): Use malloc rather than new[].
5746         * gold.h: Remove HAVE_REMAP code.
5747         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5748         exists.  Rename mremap to gold_mremap.  If mmap is not available
5749         don't do anything.
5750         * configure, config.in: Rebuild.
5751
5752 2011-04-11  Ian Lance Taylor  <iant@google.com>
5753
5754         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5755         initialize local variable v.
5756
5757 2011-04-11  Cary Coutant  <ccoutant@google.com>
5758
5759         * archive.cc (Archive::include_member): Adjust call to
5760         report_object.
5761         (Add_archive_symbols::run): Track argument serial numbers.
5762         (Lib_group::include_member): Likewise.
5763         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5764         * archive.h (Incremental_archive_entry::Archive_member):
5765         Initialize arg_serial_.
5766         (Archive_member::arg_serial_): New data member.
5767         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5768         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5769         incremental link.
5770         (Sized_dynobj::do_for_all_local_got_entries): New function.
5771         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5772         function.
5773         * fileread.cc (get_mtime): New function.
5774         * fileread.h (get_mtime): New function.
5775         * gold.cc (queue_initial_tasks): Check for incremental update.
5776         (process_incremental_input): New function.
5777         (queue_middle_tasks): Don't force valid target for incremental
5778         update.
5779         * incremental-dump.cc (find_input_containing_global): Adjust
5780         size of symbol info entry.
5781         (dump_incremental_inputs): Dump argument serial number and
5782         in_system_directory flag; bias shndx by 1; print symbol names
5783         when dumping per-file symbol lists; use new symbol info readers.
5784         * incremental.cc
5785         (Output_section_incremental_inputs:update_data_size): New function.
5786         (Sized_incremental_binary::setup_readers): Setup input readers
5787         for each input file; build maps for files added from libraries
5788         and scripts.
5789         (Sized_incremental_binary::check_input_args): New function.
5790         (Sized_incremental_binary::do_check_inputs): Build map of argument
5791         serial numbers to input arguments.
5792         (Sized_incremental_binary::do_file_has_changed): Rename
5793         do_file_is_unchanged to this; compare file modification times.
5794         (Sized_incremental_binary::do_init_layout): New function.
5795         (Sized_incremental_binary::do_reserve_layout): New function.
5796         (Sized_incremental_binary::do_get_input_reader): Remove.
5797         (Sized_incremental_binary::get_symtab_view): New function.
5798         (Incremental_checker::can_incrementally_link_output_file): Remove.
5799         (Incremental_inputs::report_command_line): Exclude --debug options.
5800         (Incremental_inputs::report_archive_begin): Add parameter; track
5801         argument serial numbers; don't put input file entry for archive
5802         before archive members.
5803         (Incremental_inputs::report_archive_end): Put input file entry
5804         for archive after archive members.
5805         (Incremental_inputs::report_object): Add parameter; track argument
5806         serial numbers and in_system_directory flag.
5807         (Incremental_inputs::report_script): Add parameter; track argument
5808         serial numbers.
5809         (Output_section_incremental_inputs::set_final_data_size): Adjust
5810         size of symbol info entry; check for forwarding symbols.
5811         (Output_section_incremental_inputs::write_input_files): Write
5812         in_system_directory flag and argument serial number.
5813         (Output_section_incremental_inputs::write_info_blocks): Map section
5814         indices between incremental info and original input file; store
5815         input section index for each symbol.
5816         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5817         change operator() to visit().
5818         (class Global_got_offset_visitor): Likewise.
5819         (class Global_symbol_visitor_got_plt):
5820         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5821         classes.
5822         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5823         (Sized_incr_relobj::do_read_symbols): New function.
5824         (Sized_incr_relobj::do_layout): New function.
5825         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5826         (Sized_incr_relobj::do_add_symbols): New function.
5827         (Sized_incr_relobj::do_should_include_member): New function.
5828         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5829         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5830         (Sized_incr_relobj::do_section_size): New function.
5831         (Sized_incr_relobj::do_section_name): New function.
5832         (Sized_incr_relobj::do_section_contents): New function.
5833         (Sized_incr_relobj::do_section_flags): New function.
5834         (Sized_incr_relobj::do_section_entsize): New function.
5835         (Sized_incr_relobj::do_section_address): New function.
5836         (Sized_incr_relobj::do_section_type): New function.
5837         (Sized_incr_relobj::do_section_link): New function.
5838         (Sized_incr_relobj::do_section_info): New function.
5839         (Sized_incr_relobj::do_section_addralign): New function.
5840         (Sized_incr_relobj::do_initialize_xindex): New function.
5841         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5842         (Sized_incr_relobj::do_read_relocs): New function.
5843         (Sized_incr_relobj::do_gc_process_relocs): New function.
5844         (Sized_incr_relobj::do_scan_relocs): New function.
5845         (Sized_incr_relobj::do_count_local_symbols): New function.
5846         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5847         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5848         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5849         (Sized_incr_relobj::do_relocate): New function.
5850         (Sized_incr_relobj::do_set_section_offset): New function.
5851         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5852         (Sized_incr_dynobj::do_read_symbols): New function.
5853         (Sized_incr_dynobj::do_layout): New function.
5854         (Sized_incr_dynobj::do_add_symbols): New function.
5855         (Sized_incr_dynobj::do_should_include_member): New function.
5856         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5857         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5858         (Sized_incr_dynobj::do_section_size): New function.
5859         (Sized_incr_dynobj::do_section_name): New function.
5860         (Sized_incr_dynobj::do_section_contents): New function.
5861         (Sized_incr_dynobj::do_section_flags): New function.
5862         (Sized_incr_dynobj::do_section_entsize): New function.
5863         (Sized_incr_dynobj::do_section_address): New function.
5864         (Sized_incr_dynobj::do_section_type): New function.
5865         (Sized_incr_dynobj::do_section_link): New function.
5866         (Sized_incr_dynobj::do_section_info): New function.
5867         (Sized_incr_dynobj::do_section_addralign): New function.
5868         (Sized_incr_dynobj::do_initialize_xindex): New function.
5869         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5870         (make_sized_incremental_object): New function.
5871         (Incremental_library::copy_unused_symbols): New function.
5872         (Incremental_library::do_for_all_unused_symbols): New function.
5873         * incremental.h (enum Incremental_input_flags): New type.
5874         (class Incremental_checker): Remove.
5875         (Incremental_input_entry::Incremental_input_entry): Add argument
5876         serial number.
5877         (Incremental_input_entry::arg_serial): New function.
5878         (Incremental_input_entry::set_is_in_system_directory): New function.
5879         (Incremental_input_entry::is_in_system_directory): New function.
5880         (Incremental_input_entry::arg_serial_): New data member.
5881         (Incremental_input_entry::is_in_system_directory_): New data member.
5882         (class Script_info): Move here from script.h.
5883         (Script_info::Script_info): Add filename parameter.
5884         (Script_info::filename): New function.
5885         (Script_info::filename_): New data member.
5886         (Incremental_script_entry::Incremental_script_entry): Add argument
5887         serial number.
5888         (Incremental_object_entry::Incremental_object_entry): Likewise.
5889         (Incremental_object_entry::add_input_section): Build list of input
5890         sections with map to original shndx.
5891         (Incremental_object_entry::get_input_section_index): New function.
5892         (Incremental_object_entry::shndx_): New data member.
5893         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5894         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5895         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5896         serial number.
5897         (Incremental_inputs::report_archive_begin): Likewise.
5898         (Incremental_inputs::report_object): Likewise.
5899         (Incremental_inputs::report_script): Likewise.
5900         (class Incremental_global_symbol_reader): New class.
5901         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5902         and store flags and input file type.
5903         (Incremental_input_entry_reader::arg_serial): New function.
5904         (Incremental_input_entry_reader::type): Extract type from flags.
5905         (Incremental_input_entry_reader::is_in_system_directory): New function.
5906         (Incremental_input_entry_reader::get_input_section_count): Call
5907         accessor function for type.
5908         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5909         function for type; adjust size of global symbol entry.
5910         (Incremental_input_entry_reader::get_global_symbol_count): Call
5911         accessor function for type.
5912         (Incremental_input_entry_reader::get_object_count): Likewise.
5913         (Incremental_input_entry_reader::get_object_offset): Likewise.
5914         (Incremental_input_entry_reader::get_member_count): Likewise.
5915         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5916         (Incremental_input_entry_reader::get_member_offset): Likewise.
5917         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5918         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5919         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5920         (Incremental_input_entry_reader::get_global_symbol_reader): New
5921         function.
5922         (Incremental_input_entry_reader::get_output_symbol_index): New
5923         function.
5924         (Incremental_input_entry_reader::type_): Remove.
5925         (Incremental_input_entry_reader::flags_): New data member.
5926         (Incremental_inputs_reader::input_file_offset): New function.
5927         (Incremental_inputs_reader::input_file_index): New function.
5928         (Incremental_inputs_reader::input_file): Call input_file_offset.
5929         (Incremental_inputs_reader::input_file_at_offset): New function.
5930         (Incremental_relocs_reader::get_r_type): Reformat.
5931         (Incremental_relocs_reader::get_r_shndx): Reformat.
5932         (Incremental_relocs_reader::get_r_offset): Reformat.
5933         (Incremental_relocs_reader::data): New function.
5934         (Incremental_binary::Incremental_binary): Initialize new data members.
5935         (Incremental_binary::check_inputs): Add cmdline parameter.
5936         (Incremental_binary::file_is_unchanged): Remove.
5937         (Input_reader::arg_serial): New function.
5938         (Input_reader::get_unused_symbol_count): New function.
5939         (Input_reader::get_unused_symbol): New function.
5940         (Input_reader::do_arg_serial): New function.
5941         (Input_reader::do_get_unused_symbol_count): New function.
5942         (Input_reader::do_get_unused_symbol): New function.
5943         (Incremental_binary::input_file_count): New function.
5944         (Incremental_binary::get_input_reader): Change signature to use
5945         index instead of filename.
5946         (Incremental_binary::file_has_changed): New function.
5947         (Incremental_binary::get_input_argument): New function.
5948         (Incremental_binary::get_library): New function.
5949         (Incremental_binary::get_script_info): New function.
5950         (Incremental_binary::init_layout): New function.
5951         (Incremental_binary::reserve_layout): New function.
5952         (Incremental_binary::output_file): New function.
5953         (Incremental_binary::do_check_inputs): New function.
5954         (Incremental_binary::do_file_is_unchanged): Remove.
5955         (Incremental_binary::do_file_has_changed): New function.
5956         (Incremental_binary::do_init_layout): New function.
5957         (Incremental_binary::do_reserve_layout): New function.
5958         (Incremental_binary::do_input_file_count): New function.
5959         (Incremental_binary::do_get_input_reader): Change signature.
5960         (Incremental_binary::input_args_map_): New data member.
5961         (Incremental_binary::library_map_): New data member.
5962         (Incremental_binary::script_map_): New data member.
5963         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5964         new data members.
5965         (Sized_incremental_binary::output_section): New function.
5966         (Sized_incremental_binary::inputs_reader): Add const.
5967         (Sized_incremental_binary::symtab_reader): Add const.
5968         (Sized_incremental_binary::relocs_reader): Add const.
5969         (Sized_incremental_binary::got_plt_reader): Add const.
5970         (Sized_incremental_binary::get_symtab_view): New function.
5971         (Sized_incremental_binary::Inputs_reader): New typedef.
5972         (Sized_incremental_binary::Input_entry_reader): New typedef.
5973         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5974         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5975         (Sized_incremental_binary::do_file_has_changed): New function.
5976         (Sized_incremental_binary::do_init_layout): New function.
5977         (Sized_incremental_binary::do_reserve_layout): New function.
5978         (Sized_input_reader::Inputs_reader): Remove.
5979         (Sized_input_reader::Input_entry_reader): Remove.
5980         (Sized_input_reader::do_arg_serial): New function.
5981         (Sized_input_reader::do_get_unused_symbol_count): New function.
5982         (Sized_input_reader::do_get_unused_symbol): New function.
5983         (Sized_incremental_binary::do_input_file_count): New function.
5984         (Sized_incremental_binary::do_get_input_reader): Change signature;
5985         use index instead of filename.
5986         (Sized_incremental_binary::section_map_): New data member.
5987         (Sized_incremental_binary::input_entry_readers_): New data member.
5988         (class Sized_incr_relobj): New class.
5989         (class Sized_incr_dynobj): New class.
5990         (make_sized_incremental_object): New function.
5991         (class Incremental_library): New class.
5992         * layout.cc (Free_list::num_lists): New static data member.
5993         (Free_list::num_nodes): New static data member.
5994         (Free_list::num_removes): New static data member.
5995         (Free_list::num_remove_visits): New static data member.
5996         (Free_list::num_allocates): New static data member.
5997         (Free_list::num_allocate_visits): New static data member.
5998         (Free_list::init): New function.
5999         (Free_list::remove): New function.
6000         (Free_list::allocate): New function.
6001         (Free_list::dump): New function.
6002         (Free_list::print_stats): New function.
6003         (Layout_task_runner::run): Resize output file for incremental updates.
6004         (Layout::Layout): Initialize new data members.
6005         (Layout::set_incremental_base): New function.
6006         (Layout::init_fixed_output_section): New function.
6007         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6008         incremental updates.
6009         (Layout::create_gold_note): Do not create gold note section for
6010         incremental updates.
6011         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6012         for incremental updates.
6013         (Layout::set_section_offsets): For incremental updates, allocate space
6014         from free list.
6015         (Layout::create_symtab_sections): Layout with offsets relative to
6016         start of section; for incremental updates, allocate space from free
6017         list.
6018         (Layout::create_shdrs): For incremental updates, allocate space from
6019         free list.
6020         (Layout::finish_dynamic_section): For incremental updates, do not
6021         check --as-needed (fixed in subsequent patch).
6022         * layout.h (class Free_list): New class.
6023         (Layout::set_incremental_base): New function.
6024         (Layout::incremental_base): New function.
6025         (Layout::init_fixed_output_section): New function.
6026         (Layout::allocate): New function.
6027         (Layout::incremental_base_): New data member.
6028         (Layout::free_list_): New data member.
6029         * main.cc (main): Print Free_list statistics.
6030         * object.cc (Relobj::finalize_incremental_relocs): Add
6031         clear_counts parameter; clear counts only when clear_counts is set.
6032         (Sized_relobj::Sized_relobj): Initialize new base class.
6033         (Sized_relobj::do_layout): Don't report special sections.
6034         (Sized_relobj::do_for_all_local_got_entries): New function.
6035         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6036         symtab_off to all symbol table offsets.
6037         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6038         * object.h (class Got_offset_list): Move to top of file.
6039         (Object::Object): Allow case where input_file == NULL.
6040         (Object::~Object): Likewise.
6041         (Object::input_file): Assert that input_file != NULL.
6042         (Object::lock): Allow case where input_file == NULL.
6043         (Object::unlock): Likewise.
6044         (Object::is_locked): Likewise.
6045         (Object::token): Likewise.
6046         (Object::release): Likewise.
6047         (Object::is_incremental): New function.
6048         (Object::get_mtime): New function.
6049         (Object::for_all_local_got_entries): New function.
6050         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6051         (Object::set_is_in_system_directory): New function.
6052         (Object::is_in_system_directory): New function.
6053         (Object::do_is_incremental): New function.
6054         (Object::do_get_mtime): New function.
6055         (Object::do_for_all_local_got_entries): New function.
6056         (Object::is_in_system_directory_): New data member.
6057         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6058         (class Sized_relobj_base): New class.
6059         (class Sized_relobj): Derive from Sized_relobj_base.
6060         (class Sized_relobj::Symbols): Redeclare from base class.
6061         (class Sized_relobj::local_got_offset_list): Remove.
6062         (class Sized_relobj::Output_sections): Redeclare from base class.
6063         (class Sized_relobj::do_for_all_local_got_entries): New function.
6064         (class Sized_relobj::write_local_symbols): Add offset parameter.
6065         (class Sized_relobj::local_symbol_offset_): Update comment.
6066         (class Sized_relobj::local_dynsym_offset_): Update comment.
6067         * options.cc (Input_arguments::add_file): Remove const.
6068         * options.h (Input_file_argument::Input_file_argument):
6069         Initialize arg_serial_ (all constructors).
6070         (Input_file_argument::set_arg_serial): New function.
6071         (Input_file_argument::arg_serial): New function.
6072         (Input_file_argument::arg_serial_): New data member.
6073         (Input_arguments::Input_arguments): Initialize file_count_.
6074         (Input_arguments::add_file): Remove const.
6075         (Input_arguments::number_of_input_files): New function.
6076         (Input_arguments::file_count_): New data member.
6077         (Command_line::number_of_input_files): Call
6078         Input_arguments::number_of_input_files.
6079         * output.cc (Output_segment_headers::Output_segment_headers):
6080         Set current size.
6081         (Output_section::Input_section::current_data_size): New function.
6082         (Output_section::Output_section): Initialize new data members.
6083         (Output_section::add_input_section): Don't do merge sections for
6084         an incremental link; allocate space from free list for an
6085         incremental update.
6086         (Output_section::add_output_section_data): Allocate space from
6087         free list for an incremental update.
6088         (Output_section::update_data_size): New function.
6089         (Output_section::set_fixed_layout): New function.
6090         (Output_section::reserve): New function.
6091         (Output_segment::set_section_addresses): Remove const.
6092         (Output_segment::set_section_list_addresses): Remove const; allocate
6093         space from free list for an incremental update.
6094         (Output_segment::set_offset): Adjust size of RELRO segment for an
6095         incremental update.
6096         * output.h (Output_data::current_data_size): Move here from
6097         child classes.
6098         (Output_data::pre_finalize_data_size): New function.
6099         (Output_data::update_data_size): New function.
6100         (Output_section_headers::update_data_size): new function.
6101         (Output_section_data_build::current_data_size): Move to Output_data.
6102         (Output_data_strtab::update_data_size): New function.
6103         (Output_section::current_data_size): Move to Output_data.
6104         (Output_section::set_fixed_layout): New function.
6105         (Output_section::has_fixed_layout): New function.
6106         (Output_section::reserve): New function.
6107         (Output_section::update_data_size): New function.
6108         (Output_section::has_fixed_layout_): New data member.
6109         (Output_section::free_list_): New data member.
6110         (Output_segment::set_section_addresses): Remove const.
6111         (Output_segment::set_section_list_addresses): Remove const.
6112         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6113         New function.
6114         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6115         New function.
6116         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6117         parameter when calling Add_symbols constructor; store argument
6118         serial number for members of a lib group.
6119         (Add_symbols::locks): Allow case where token == NULL.
6120         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6121         (Read_member::~Read_member): New function.
6122         (Read_member::is_runnable): New function.
6123         (Read_member::locks): New function.
6124         (Read_member::run): New function.
6125         (Check_script::~Check_script): New function.
6126         (Check_script::is_runnable): New function.
6127         (Check_script::locks): New function.
6128         (Check_script::run): New function.
6129         (Check_library::~Check_library): New function.
6130         (Check_library::is_runnable): New function.
6131         (Check_library::locks): New function.
6132         (Check_library::run): New function.
6133         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6134         (Add_symbols::library_): New data member.
6135         (class Read_member): New class.
6136         (class Check_script): New class.
6137         (class Check_library): New class.
6138         * reloc.cc (Read_relocs::is_runnable): Allow case where
6139         token == NULL.
6140         (Read_relocs::locks): Likewise.
6141         (Scan_relocs::locks): Likewise.
6142         (Relocate_task::locks): Likewise.
6143         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6144         to clear counters.
6145         (Sized_relobj::incremental_relocs_scan): Fix comment.
6146         (Sized_relobj::do_relocate): Pass output file offset to
6147         write_local_symbols.
6148         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6149         from class declaration.
6150         * script.cc (read_input_script): Allocate Script_info; pass
6151         argument serial number to report_script.
6152         * script.h (class Script_info): Move to incremental.h.
6153         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6154         * symtab.h (Symbol_table::add_from_incrobj): New function.
6155         (Symbol_table::set_file_offset): New function.
6156
6157 2011-04-05  Cary Coutant  <ccoutant@google.com>
6158
6159         * incremental-dump.cc (dump_incremental_inputs): Change signature
6160         to take a Sized_incremental_binary; change caller.  Use readers
6161         in Sized_incremental_binary.
6162         * incremental.cc
6163         (Sized_incremental_binary::find_incremental_inputs_sections):
6164         Rename do_find_incremental_inputs_sections to this.
6165         (Sized_incremental_binary::setup_readers): New function.
6166         (Sized_incremental_binary::do_check_inputs): Check
6167         has_incremental_info_ flag; move setup code to setup_readers;
6168         use input readers.
6169         (Sized_incremental_binary::do_file_is_unchanged): New function.
6170         (Sized_incremental_binary::do_get_input_reader): New function.
6171         * incremental.h (class Incremental_binary): Move to end of file.
6172         (Incremental_binary::file_is_unchanged): New function.
6173         (Incremental_binary::do_file_is_unchanged): New function.
6174         (Incremental_binary::Input_reader): New class.
6175         (Incremental_binary::get_input_reader): New function.
6176         (class Sized_incremental_binary): Move to end of file.
6177         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6178         input section reader classes.
6179         (Sized_incremental_binary::has_incremental_info): New function.
6180         (Sized_incremental_binary::inputs_reader): New function.
6181         (Sized_incremental_binary::symtab_reader): New function.
6182         (Sized_incremental_binary::relocs_reader): New function.
6183         (Sized_incremental_binary::got_plt_reader): New function.
6184         (Sized_incremental_binary::do_file_is_unchanged): New function.
6185         (Sized_incremental_binary::Sized_input_reader): New class.
6186         (Sized_incremental_binary::get_input_reader): New function.
6187         (Sized_incremental_binary::find_incremental_inputs_sections):
6188         Rename do_find_incremental_inputs_sections to this.
6189         (Sized_incremental_binary::setup_readers): New function.
6190         (Sized_incremental_binary::has_incremental_info_): New data member.
6191         (Sized_incremental_binary::inputs_reader_): New data member.
6192         (Sized_incremental_binary::symtab_reader_): New data member.
6193         (Sized_incremental_binary::relocs_reader_): New data member.
6194         (Sized_incremental_binary::got_plt_reader_): New data member.
6195         (Sized_incremental_binary::current_input_file_): New data member.
6196
6197 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6198
6199         PR gold/12640
6200         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6201         violation.
6202
6203 2011-03-30  Cary Coutant  <ccoutant@google.com>
6204
6205         * archive.cc (Archive::include_member): Adjust call to report_object.
6206         (Add_archive_symbols::run): Add script_info to call to
6207         report_archive_begin.
6208         (Lib_group::include_member): Adjust call to report_object.
6209         (Add_lib_group_symbols::run): Adjust call to report_object.
6210         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6211         blocks.  Add object count for script input files.
6212         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6213         script_info parameter; change all callers.
6214         (Incremental_inputs::report_object): Add script_info parameter;
6215         change all callers.
6216         (Incremental_inputs::report_script): Store backpointer to
6217         incremental info entry.
6218         (Output_section_incremental_inputs::set_final_data_size): Record
6219         additional information for scripts.
6220         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6221         * incremental.h (Incremental_script_entry::add_object): New function.
6222         (Incremental_script_entry::get_object_count): New function.
6223         (Incremental_script_entry::get_object): New function.
6224         (Incremental_script_entry::objects_): New data member; adjust
6225         constructor.
6226         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6227         (Incremental_inputs::report_object): Add script_info parameter.
6228         (Incremental_inputs_reader::get_object_count): New function.
6229         (Incremental_inputs_reader::get_object_offset): New function.
6230         * options.cc (Input_arguments::add_file): Return reference to
6231         new input argument.
6232         * options.h (Input_argument::set_script_info): New function.
6233         (Input_argument::script_info): New function.
6234         (Input_argument::script_info_): New data member; adjust all
6235         constructors.
6236         (Input_file_group::add_file): Return reference to new input argument.
6237         (Input_file_lib::add_file): Likewise.
6238         (Input_arguments::add_file): Likewise.
6239         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6240         * script.cc (Parser_closure::Parser_closure): Add script_info
6241         parameter; adjust all callers.
6242         (Parser_closure::script_info): New function.
6243         (Parser_closure::script_info_): New data member.
6244         (read_input_script): Report scripts earlier to incremental info.
6245         (script_add_file): Set script_info in Input_argument.
6246         (script_add_library): Likewise.
6247         * script.h (Script_options::Script_info): Rewrite class.
6248
6249 2011-03-29  Cary Coutant  <ccoutant@google.com>
6250
6251         * archive.cc (Library_base::should_include_member): Move
6252         method here from class Archive.
6253         (Archive::Archive): Initialize base class.
6254         (Archive::should_include_member): Move to base class.
6255         (Archive::do_for_all_unused_symbols): New function.
6256         (Add_archive_symbols::run): Remove redundant access to
6257         incremental_inputs.
6258         (Lib_group::Lib_group): Initialize base class.
6259         (Lib_group::do_filename): New function.
6260         (Lib_group::include_member): Pass pointer to Lib_group to
6261         report_object.
6262         (Lib_group::do_for_all_unused_symbols): New function.
6263         (Add_lib_group_symbols::run): Report archive information for
6264         incremental links.
6265         * archive.h (class Library_base): New base class.
6266         (class Archive): Derive from Library_base.
6267         (Archive::filename): Move to base class.
6268         (Archive::set_incremental_info): Likewise.
6269         (Archive::incremental_info): Likewise.
6270         (Archive::Should_include): Likewise.
6271         (Archive::should_include_member): Likewise.
6272         (Archive::Armap_entry): Remove.
6273         (Archive::Unused_symbol_iterator): Remove.
6274         (Archive::unused_symbols_begin): Remove.
6275         (Archive::unused_symbols_end): Remove.
6276         (Archive::do_filename): New function.
6277         (Archive::do_get_mtime): New function.
6278         (Archive::do_for_all_unused_symbols): New function.
6279         (Archive::task_): Move to base class.
6280         (Archive::incremental_info_): Likewise.
6281         (class Lib_group): Derive from Library_base.
6282         (Lib_group::do_filename): New function.
6283         (Lib_group::do_get_mtime): New function.
6284         (Lib_group::do_for_all_unused_symbols): New function.
6285         (Lib_group::task_): Move to base class.
6286         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6287         function.
6288         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6289         function.
6290         * incremental.cc (Incremental_inputs::report_archive_begin):
6291         Use Library_base; call library's get_mtime; add incremental inputs
6292         entry before members.
6293         (class Unused_symbol_visitor): New class.
6294         (Incremental_inputs::report_archive_end): Use Library_base; use
6295         visitor class to record unused symbols; don't add incremental inputs
6296         entry after members.
6297         (Incremental_inputs::report_object): Use Library_base.
6298         * incremental.h
6299         (Incremental_archive_entry::Incremental_archive_entry): Remove
6300         unused Archive parameter.
6301         (Incremental_inputs::report_archive_begin): Use Library_base.
6302         (Incremental_inputs::report_archive_end): Likewise.
6303         (Incremental_inputs::report_object): Likewise.
6304         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6305         function.
6306         * object.h (Object::for_all_global_symbols): New function.
6307         (Object::do_for_all_global_symbols): New function.
6308         (Sized_relobj::do_for_all_global_symbols): New function.
6309         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6310         function.
6311         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6312         function.
6313
6314 2011-03-27  Ian Lance Taylor  <iant@google.com>
6315
6316         * archive.cc (Archive::interpret_header): Return -1 if something
6317         goes wrong.  Change callers accordingly.
6318
6319 2011-03-25  Cary Coutant  <ccoutant@google.com>
6320
6321         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6322         * testsuite/Makefile.in: Regenerate.
6323
6324 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6325
6326         * plugin.cc (get_view): New.
6327         (Plugin::load): Pass get_view to the plugin.
6328         (Plugin_manager::get_view): New.
6329
6330 2011-03-21  Ian Lance Taylor  <iant@google.com>
6331
6332         * testsuite/final_layout.sh: Rewrite to not use dc.
6333         * testsuite/relro_test.sh: Fail if dc is not present.
6334
6335 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6336
6337         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6338         Change == to -eq.
6339         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6340         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6341         Change == to -eq.
6342         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6343         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6344
6345 2011-03-14  Ian Lance Taylor  <iant@google.com>
6346
6347         * script-sections.cc (Sort_output_sections::script_compare):
6348         Rename from is_before, change return type.
6349         (Sort_output_sections::operator()): Adjust accordingly.
6350
6351 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6352
6353         PR gold/12572
6354         * testsuite/odr_violation2.cc: Add comment to make all error line
6355         numbers double digits.
6356         * testsuite/debug_msg.sh: Adjust expected errors.
6357
6358 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6359
6360         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6361         but mark earlier ones as non-canonical
6362         (offset_to_iterator): Update search target and example
6363         (do_addr2line): Return extra lines in a vector*
6364         (format_file_lineno): Extract from do_addr2line
6365         (one_addr2line): Add vector* out-param
6366         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6367         when a lineno entry appeared last for its instruction
6368         (Dwarf_line_info): Add vector* out-param
6369         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6370         * symtab.cc (Odr_violation_compare): Include the lineno in the
6371         comparison again.
6372         (linenos_from_loc): New. Combine the canonical line for an
6373         address with its other lines.
6374         (True_if_intersect): New. Helper functor to make
6375         std::set_intersection a query.
6376         (detect_odr_violations): Compare sets of lines instead of just
6377         one line for each function. This became less deterministic, but
6378         has fewer false positives.
6379         * symtab.h: Declarations.
6380         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6381         mix an optimized and non-optimized object in the same binary
6382         (odr_violation2.so): Same.
6383         * testsuite/Makefile.in: Regenerate from Makefile.am.
6384         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6385         * testsuite/debug_msg.sh: Update line numbers and add
6386         assertions.
6387         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6388         non-optimized context.
6389         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6390         isn't inlined, and use OdrDerived in an optimized context.
6391         * testsuite/odr_header1.h: Defines OdrDerived, where
6392         optimization will change the
6393         first-instruction-in-the-destructor's file and line number.
6394         * testsuite/odr_header2.h: Defines OdrBase.
6395
6396 2011-03-09  Ian Lance Taylor  <iant@google.com>
6397
6398         * fileread.cc (File_read::clear_views): Don't delete the whole
6399         file view.
6400
6401 2011-03-08  Ian Lance Taylor  <iant@google.com>
6402
6403         PR gold/12525
6404         * fileread.cc: #include <climits>.
6405         (GOLD_IOV_MAX): Define.
6406         (File_read::read_multiple): Limit number of entries by iov_max.
6407         * fileread.h (class File_read): Always set max_readv_entries to
6408         128.
6409
6410 2011-03-07  Ian Lance Taylor  <iant@google.com>
6411
6412         PR gold/12525
6413         * options.h (class General_options): Add -dy and -dn.
6414
6415 2011-03-02  Cary Coutant  <ccoutant@google.com>
6416
6417         * testsuite/script_test_9.t: Add TLS segment.
6418
6419 2011-03-02  Simon Baldwin  <simonb@google.com>
6420
6421         * configure.ac: Add check for gnu_indirect_function support in
6422         the toolchain building binutils.
6423         * configure: Rebuild.
6424
6425 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6426
6427         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6428         plugin only symbols.
6429         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6430         in plugin files as not needed in the symbol table.
6431
6432 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6433
6434         * output.cc (Output_section::add_input_section): Delay fill
6435         generation for section ordering.
6436
6437 2011-02-09  Ian Lance Taylor  <iant@google.com>
6438
6439         PR gold/12316
6440         * object.h (class Sized_relobj): Remove clear_local_symbols.
6441         * reloc.cc (Sized_relobj::do_relocate): Don't call
6442         clear_local_symbols.
6443
6444 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6445
6446         * plugin.cc (is_visible_from_outside): Return true for symbols
6447         in the -u option.
6448
6449 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6450
6451         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6452         filename.
6453
6454 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6455
6456         * icf.h (is_section_foldable_candidate): Change type of parameter
6457         to std::string.
6458         * icf.cc (Icf::find_identical_sections): Change type of local variable
6459         section_name to be std::string.
6460         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6461
6462 2011-01-25  Ian Lance Taylor  <iant@google.com>
6463
6464         * script.cc (script_add_extern): Rewrite to use
6465         add_symbol_reference.
6466
6467 2011-01-25  Doug Kwan  <dougkwan@google.com>
6468
6469         * icf.cc (get_section_contents): Always lock section's object.
6470
6471 2011-01-24  Ian Lance Taylor  <iant@google.com>
6472
6473         * options.h (class General_options): Accept
6474         --no-detect-odr-violations.
6475
6476 2011-01-24  Ian Lance Taylor  <iant@google.com>
6477
6478         * version.cc (version_string): Bump to 1.11.
6479
6480 2011-01-24  Ian Lance Taylor  <iant@google.com>
6481
6482         * plugin.cc (class Plugin_rescan): Define new class.
6483         (Plugin_manager::claim_file): Set any_claimed_.
6484         (Plugin_manager::save_archive): New function.
6485         (Plugin_manager::save_input_group): New function.
6486         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6487         necessary.
6488         (Plugin_manager::new_undefined_symbol): New function.
6489         (Plugin_manager::rescan): New function.
6490         (Plugin_manager::rescannable_defines): New function.
6491         (Plugin_manager::add_input_file): Set any_added_.
6492         * plugin.h (class Plugin_manager): define new fields rescannable_,
6493         undefined_symbols_, any_claimed_, and any_added_.  Declare
6494         Plugin_rescan as friend.  Declare new functions.
6495         (Plugin_manager::Rescannable): Define type.
6496         (Plugin_manager::Rescannable_list): Define type.
6497         (Plugin_manager::Undefined_symbol_list): Define type.
6498         (Plugin_manager::Plugin_manager): Initialize new fields.
6499         * archive.cc (Archive::defines_symbol): New function.
6500         (Add_archive_symbols::run): Pass archive to plugins if any.
6501         * archive.h (class Archive): Declare defines_symbol.
6502         * readsyms.cc (Input_group::~Input_group): New function.
6503         (Finish_group::run): Pass input_group to plugins if any.
6504         * readsyms.h (class Input_group): Declare destructor.
6505         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6506         any.
6507
6508 2011-01-10  Ian Lance Taylor  <iant@google.com>
6509
6510         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6511         section as relro.
6512         (Layout::set_segment_offsets): Reset increase_relro before calling
6513         set_section_addresses a second time.
6514
6515 2011-01-04  Cary Coutant  <ccoutant@google.com>
6516
6517         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6518         sections before NOBITS sections.
6519
6520 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6521
6522         * version.cc (print_version): Update copyright to 2011.
6523
6524 2010-12-23  Cary Coutant  <ccoutant@google.com>
6525
6526         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6527         of OS to this->add.  Add OD parameter to second form of the function.
6528
6529 2010-12-20  Ian Lance Taylor  <iant@google.com>
6530
6531         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6532         second of two consecutive entries with same offset.
6533
6534 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6535
6536         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6537         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6538         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6539         to avoid unneeded links against $(LDADD).
6540         * testsuite/Makefile.in: Regenerate.
6541
6542 2010-12-15  Ian Lance Taylor  <iant@google.com>
6543
6544         PR gold/12324
6545         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6546         for R_X86_64_32 and R_X86_64_PC32.
6547         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6548         ver_matching_def_pic.o.
6549         (ver_matching_def_pic.o): New target.
6550
6551 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6552
6553         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6554         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6555         Move definition before File_read::View member definitions.
6556         (File_read::View::~View): Initialize and hold lock before
6557         updating current_mapped_bytes.
6558
6559 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6560
6561         * dwarf_reader.cc: Remove outdated comment.
6562         * gold-threads.cc: Fix typo in error message.
6563         * archive.cc: Fix typos in comments.
6564         * archive.h: Likewise.
6565         * arm-reloc-property.cc: Likewise.
6566         * arm-reloc-property.h: Likewise.
6567         * arm-reloc.def: Likewise.
6568         * arm.cc: Likewise.
6569         * attributes.h: Likewise.
6570         * cref.cc: Likewise.
6571         * ehframe.cc: Likewise.
6572         * fileread.h: Likewise.
6573         * gold.h: Likewise.
6574         * i386.cc: Likewise.
6575         * icf.cc: Likewise.
6576         * incremental.h: Likewise.
6577         * int_encoding.cc: Likewise.
6578         * layout.h: Likewise.
6579         * main.cc: Likewise.
6580         * merge.h: Likewise.
6581         * object.cc: Likewise.
6582         * object.h: Likewise.
6583         * options.cc: Likewise.
6584         * readsyms.cc: Likewise.
6585         * reduced_debug_output.cc: Likewise.
6586         * reloc.cc: Likewise.
6587         * script-sections.cc: Likewise.
6588         * sparc.cc: Likewise.
6589         * symtab.h: Likewise.
6590         * target-reloc.h: Likewise.
6591         * target.cc: Likewise.
6592         * target.h: Likewise.
6593         * timer.cc: Likewise.
6594         * timer.h: Likewise.
6595         * x86_64.cc: Likewise.
6596
6597 2010-12-09  Cary Coutant  <ccoutant@google.com>
6598
6599         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6600         stack.
6601         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6602         parameter; change all callers.
6603         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6604         * options.h (warn_execstack): New option.
6605
6606 2010-12-07  Doug Kwan  <dougkwan@google.com>
6607
6608         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6609         like function call relocations.
6610
6611 2010-12-07  Ian Lance Taylor  <iant@google.com>
6612
6613         * archive.cc (Archive::get_elf_object_for_member): Permit
6614         punconfigured to be NULL.
6615         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6616         (Archive::include_member): Pass NULL to get_elf_object_for_member
6617         if we searched for the archive and this is the first included
6618         object.
6619
6620 2010-12-01  Ian Lance Taylor  <iant@google.com>
6621
6622         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6623         track_relocs_type_ field.
6624         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6625         Set track_relocs_type_.
6626         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6627         contents when using RELA relocs.
6628         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6629         reloc_map_.
6630         * reloc.cc (Track_relocs::next_addend): New function.
6631         * reloc.h (class Track_relocs): Declare next_addend.
6632
6633 2010-12-01  Ian Lance Taylor  <iant@google.com>
6634
6635         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6636         virtual destructor.
6637
6638 2010-12-01  Ian Lance Taylor  <iant@google.com>
6639
6640         * README: Update compilers known to work and fail.
6641
6642 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6643
6644         * configure.in: For --enable-gold, handle value `default' instead of
6645         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6646         not the default.
6647         * configure: Regenerate.
6648
6649 2010-11-18  Doug Kwan  <dougkwan@google.com>
6650
6651         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6652         and right_alignment to be zero.  Store result alignment only if it is
6653         greater than existing alignment.
6654
6655 2010-11-16  Cary Coutant  <ccoutant@google.com>
6656
6657         PR gold/12220
6658         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6659         Check for ".zdebug_line".
6660
6661 2010-11-16  Doug Kwan  <dougkwan@google.com>
6662             Cary Coutant  <ccoutant@google.com>
6663
6664         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6665         by reference; adjust all callers.
6666         * output.cc (Output_segment::set_section_addresses): Adjust references
6667         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6668         list is empty.
6669         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6670         end at page boundary.
6671
6672 2010-11-16  Cary Coutant  <ccoutant@google.com>
6673
6674         PR gold/12220
6675         * layout.cc (Layout::choose_output_section): Transform names of
6676         compressed sections even when using a script with a SECTIONS clause.
6677         (Layout::output_section_name): Remove code to transform
6678         compressed debug section names.
6679         * output.cc (Output_section::add_input_section): Use uncompressed
6680         section size when tracking input sections.
6681
6682 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6683
6684         * symtab.h (Symbol::NON_PIC_REF): Remove.
6685         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6686         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6687         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6688         (Symbol::use_plt_offset): Take a flags argument and pass it
6689         directly to needs_dynamic_reloc.  Restrict check for undefined
6690         weak symbols to function calls.
6691         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6692         (Target_arm::Scan::global): Use it.
6693         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6694         (Target_arm::Relocate::relocate): Likewise.
6695         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6696         parameter with an r_type parameter.  Use get_reference_flags
6697         to get the flags.
6698         (Target_arm::Relocate::relocate): Update accordingly.
6699         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6700         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6701         (Target_i386::Scan::global): Likewise.
6702         (Target_i386::Relocate::relocate): Likewise.
6703         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6704         parameter with an r_type parameter.  Use get_reference_flags
6705         to get the flags.
6706         (Target_i386::Relocate::relocate): Update accordingly.
6707         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6708         (Target_powerpc::Scan::global): Use it.
6709         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6710         (Target_powerpc::Relocate::relocate): Likewise.
6711         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6712         (Target_sparc::Scan::global): Use it.
6713         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6714         (Target_sparc::Relocate::relocate): Likewise.
6715         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6716         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6717         (Target_x86_64::Scan::global): Likewise.
6718         (Target_x86_64::Relocate::relocate): Likewise.
6719
6720 2010-11-08  Doug Kwan  <dougkwan@google.com>
6721             Cary Coutant  <ccoutant@google.com>
6722
6723         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6724         (Arm_exidx_merge_section::section_contents_): New data member.
6725         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6726         (Arm_input_section::~Arm_input_section): De-allocate memory.
6727         (Arm_input_section::original_contents_): New data member.
6728         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6729         in parameters instead of calling Object::section_contents without
6730         locking.
6731         (Arm_output_section::group_section): New parameter TASK.  Pass it
6732         to callees that need locking objects.
6733         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6734         to lock EXIDX input sections.  Fix a formatting issue.  Call
6735         Arm_exidx_merged_section::build_contents to create merged section
6736         contents.
6737         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6738         to lock object of stub table owner.
6739         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6740         TEXT_SIZE to initialize data member TEXT_SIZE_.
6741         (Arm_exidx_input_section::addralign): Fix typo in comment.
6742         (Arm_exidx_input_section::text_size): New method.
6743         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6744         that require locking objects.  Lock objects before scanning for stubs
6745         and updating local symbols.
6746         (Arm_input_section<big_endian>::init): Copy contents of original
6747         input section.
6748         (Arm_input_section<big_endian>::do_write): Use saved contents of
6749         original input section instead of calling Object::section_contents
6750         without locking.
6751         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6752         size without calling Object::section_size().
6753         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6754         for size.  Allocate a buffer for merged EXIDX entries.
6755         (Arm_exidx_merged_section::build_contents): New method.
6756         (Arm_exidx_merged_section::do_write): Move merge section contents
6757         building code to Arm_exidx_merged_section::build_contetns.  Write
6758         out contetns in buffer instead of building it on the fly.
6759         (Arm_relobj::make_exidx_input_section): Also pass text section size
6760         to Arm_exidx_input_section constructor.
6761         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6762         (Arm_dynobj::do_read_symbols): Fix memory leak.
6763         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6764         * target.h: (class Task): Add forward declaration.
6765         (Target::relax): Add new parameter TASK and pass it to
6766         Target::do_relax().
6767         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6768
6769 2010-11-05  Cary Coutant  <ccoutant@google.com>
6770
6771         PR gold/10708
6772         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6773         object when reading from the file.
6774         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6775         second layout pass.
6776         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6777         when reading section contents.
6778         (get_section_contents): Likewise.
6779         (icf::find_identical_sections): Likewise.
6780         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6781         object when reading from the file.
6782         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6783         the object when doing deferred section layout.
6784
6785 2010-11-03  Nick Clifton  <nickc@redhat.com>
6786
6787         PR gold/12001
6788         * script.h (class Symbol_assignment: name): New member.  Returns
6789         the name of the symbol.
6790         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6791         Returns true if the given symbol name is on the list of
6792         assignments wating to be processed.
6793         * archive.cc (should_incldue_member): If the symbol is undefined,
6794         check to see if it is on the list of symbols pending assignment.
6795
6796 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6797
6798         * script-sections.cc (Script_sections::find_memory_region): Check
6799         for a NULL output section pointer.
6800
6801 2010-10-29  Doug Kwan  <dougkwan@google.com>
6802
6803         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6804         Output_section::add_relaxed_input_section.
6805         * output.cc (Output_section::add_relaxed_input_section): Add new
6806         arguments LAYOUT and NAME.  Set section order index.
6807         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6808         Copy section order index.
6809         * output.h (Output_section::add_relaxed_input_section): Add new
6810         arguments LAYOUT and NAME.
6811
6812 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6813
6814         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6815         NATIVE_OR_CROSS_LINKER.
6816         * testsuite/Makefile.in: Regenerate.
6817
6818 2010-10-20  Doug Kwan  <dougkwan@google.com>
6819
6820         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6821         without SHF_LINK_ORDER flags.
6822         * layout.cc (Layout::choose_output_section): Do not filter
6823         SHF_LINK_ORDER flag in a relocatable link.
6824
6825 2010-10-17  Cary Coutant  <ccoutant@google.com>
6826
6827         * output.h (Output_segment::set_section_addresses): Change function
6828         signature.  Update all callers.
6829         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6830         sections.
6831         (Output_segment::set_section_addresses): Align after last TLS
6832         section.  Add padding before last relro section instead of after.
6833
6834 2010-10-17  Doug Kwan  <dougkwan@google.com>
6835
6836         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6837         GOT output section to be writable.
6838
6839 2010-10-14  Cary Coutant  <ccoutant@google.com>
6840
6841         * debug.h (DEBUG_INCREMENTAL): New flag.
6842         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6843         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6844         mode.
6845         * incremental.cc (report_command_line): Ignore all forms of
6846         --incremental.
6847         * layout.cc (Layout::Layout): Check parameters for incremental link
6848         mode.
6849         * options.cc (General_options::parse_incremental): New function.
6850         (General_options::parse_no_incremental): New function.
6851         (General_options::parse_incremental_full): New function.
6852         (General_options::parse_incremental_update): New function.
6853         (General_options::incremental_mode_): New data member.
6854         (General_options::finalize): Check incremental_mode_.
6855         * options.h (General_options): Update help text for --incremental.
6856         Add --no-incremental, --incremental-full, --incremental-update.
6857         (General_options::Incremental_mode): New enum type.
6858         (General_options::incremental_mode): New function.
6859         (General_options::incremental_mode_): New data member.
6860         * parameters.cc (Parameters::incremental_mode_): New data member.
6861         (Parameters::set_options): Set incremental_mode_.
6862         (Parameters::set_incremental_full): New function.
6863         (Parameters::incremental): New function.
6864         (Parameters::incremental_update): New function.
6865         (set_parameters_incremental_full): New function.
6866         * parameters.h (Parameters::set_incremental_full): New function.
6867         (Parameters::incremental): New function.
6868         (Parameters::incremental_update): New function.
6869         (Parameters::incremental_mode_): New data member.
6870         (set_parameters_incremental_full): New function.
6871         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6872         incremental link mode.
6873         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6874         (Sized_relobj::do_relocate_sections): Likewise.
6875         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6876         option.
6877         * testsuite/Makefile.in: Regenerate.
6878         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6879
6880 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6881
6882         * script-sections.h (class Script_sections): Make
6883         Sections_elements typedef public.
6884         * script-sections.cc (class Sort_output_sections): Add elements_
6885         field.  Add constructor which sets it; change all callers.
6886         (Sort_output_sections::is_before): New function.
6887         (Sort_output_sections::operator()): Call is_before.
6888         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6889         conditional.
6890         * testsuite/script_test_10.sh: New test. Test script section
6891         order.
6892         * testsuite/script_test_10.t: Likewise.
6893         * testsuite/script_test_10.s: Likewise.
6894         * testsuite/Makefile.am: Wrap the cross linker tests and the
6895         common tests into NATIVE_OR_CROSS_LINKER.
6896         (check_SCRIPTS): Add script_test_10.sh.
6897         (check_DATA): Add script_test_10.stdout.
6898         (script_test_10.o, script_test_10): New targets.
6899         (script_test_10.stdout): New target.
6900         * configure, testsuite/Makefile.in: Regenerate.
6901
6902 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6903
6904         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6905         error for the deprecated relocations.
6906         (Target_arm::Scan::global): Likewise.
6907         (Target_arm::Relocate::relocate): Likewise.
6908
6909 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6910
6911         * fileread.cc (Input_file::find_file): Initialize *found_name
6912         and *namep when using the fallback search for case 4.
6913
6914 2010-10-11  Cary Coutant  <ccoutant@google.com>
6915
6916         * options.h (class General_options): Redefine -z lazy as an alias for
6917         the negation of -z now.
6918
6919 2010-10-11  Ian Lance Taylor  <iant@google.com>
6920
6921         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6922         binding.
6923
6924 2010-10-06  Nick Clifton  <nickc@redhat.com>
6925
6926         * script-sections.cc(class Memory_region): Remove
6927         current_lma_offset_ field.  Rename current_vma_offset_ to
6928         current_offset_.  Add last_section_ field.
6929         (Memory_region::get_current_vma_address): Rename to
6930         get_current_address.
6931         (Memory_region::get_current_lma_address): Delete.
6932         (Memory_region::increment_vma_offset): Rename to
6933         increment_offset.
6934         (Memory_region::increment_lma_offset): Delete.
6935         (Memory_region::attributes_compatible): New method.  Returns
6936         true if the provided section is compatible with the region.
6937         (Memory_region::get_last_section): New method.  Returns the last
6938         section to use the region.
6939         (Memory_region::set_last_section): New method.  Stores the last
6940         section to use the region.
6941         (Script_sections::block_in_region): New method.  Returns true if
6942         a block of memory is contained within a region.
6943         (Script_sections::find_memory_region): New method.  Locates a
6944         memory region to be used to set a VMA or LMA address.
6945         (Output_section_definition::set_section_addresses): Add code to
6946         check for addresses set by memory regions.
6947         (Output_segment::set_section_addresses): Remove memory region
6948         walking code.
6949         (Script_sections::create_segment): Add a warning if a header
6950         segment is created outside of any region.
6951         * script-sections.h (class Script_sections): Add prototypes for
6952         find_memory_region and block_in_region methods.
6953         * testsuite/memory_test.s: Use .long instead of .word.
6954         * testsuite/memory_test.t: Add some more output sections.
6955         * testsuite/memory_test.sh: Update expected output.
6956
6957 2010-10-02  Doug Kwan  <dougkwan@google.com>
6958
6959         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6960         defintion to symtab.h
6961         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6962         declaration to defintion.
6963
6964 2010-10-01  Nick Clifton  <nickc@redhat.com>
6965
6966         * expression.cc (eval): Replace dummy argument with NULL.
6967         (eval_maybe_dot): Check for a NULL result section pointer.
6968         (Symbol_expression::value): Likewise.
6969         (Dot_expression::value): Likewise.
6970         (BINARY_EXPRESSION): Likewise.
6971         (Max_expression::value): Likewise.
6972         (Min_expression::value): Likewise.
6973         (Absolute_expression::value): Likewise.
6974         (Addr_expression::value_from_output_section): Likewise.
6975         (Loaddddr_expression::value_from_output_section): Likewise.
6976         (Segment_start_expression::value): Likewise.
6977         * script-sections.cc
6978         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6979         argument with NULL.
6980         (Sections_elememt_dot_assignment::set_section_addresses):
6981         Likewise.
6982         (Output_data_expression::do_write_to_buffer): Likewise.
6983         (Output_section_definition::finalize_symbols): Likewise.
6984         (Output_section_definition::set_section_addresses): Likewise.
6985
6986 2010-09-30  Doug Kwan  <dougkwan@google.com>
6987
6988         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6989
6990 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6991
6992         * target.h (Target::can_icf_inline_merge_sections): New virtual
6993         function.
6994         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6995         virtual function.
6996         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6997         virtual function.
6998         * icf.cc (get_section_contents): Inline merge sections only when
6999         target allows it.
7000
7001 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7002
7003         * configure: Regenerate.
7004
7005 2010-09-17  Ian Lance Taylor  <iant@google.com>
7006
7007         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7008         * testsuite/Makefile.am (memory_test.o): New target.
7009         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7010         memory_test.t.
7011         * testsuite/Makefile.in: Rebuild.
7012
7013 2010-09-17  Doug Kwan  <dougkwan@google.com>
7014
7015         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7016         defintion if relocation uses GOT entries of the symbol.
7017         * testsuite/icf_safe_test.sh: Fix test.
7018         * testsuite/icf_safe_so_test.sh: Fix test.
7019
7020 2010-09-16  Cary Coutant  <ccoutant@google.com>
7021
7022         * script_sections.cc (class Memory_region): Remove "NULL" from
7023         vector initializations.
7024
7025 2010-09-15  Cary Coutant  <ccoutant@google.com>
7026
7027         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7028         Resolve forwarding symbols.
7029
7030 2010-09-15  Doug Kwan  <dougkwan@google.com>
7031
7032         * gold/testsuite/script_test_3.t: Add ARM special sections.
7033         * gold/testsuite/script_test_4.t: Same.
7034         * gold/testsuite/script_test_5.t: Same.
7035         * gold/testsuite/script_test_6.t: Same.
7036         * gold/testsuite/script_test_7.t: Same.
7037         * gold/testsuite/script_test_7.t: Same.
7038         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7039
7040 2010-09-14  Cary Coutant  <ccoutant@google.com>
7041
7042         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7043         (Target_x86_64::Relocate::relocate_tls): Replace check for
7044         saw_tls_block_reloc_ with test for executable section.
7045
7046 2010-09-12  Cary Coutant  <ccoutant@google.com>
7047
7048         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7049         position-independent executables to shared libraries need dynamic
7050         relocations.
7051         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7052         position-independent executables.
7053         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7054         * testsuite/Makefile.in: Regenerate.
7055
7056 2010-09-10  Nick Clifton  <nickc@redhat.com>
7057
7058         PR gold/11997
7059         * testsuite/memory_test.t: Discard any sections that are not
7060         needed.
7061
7062 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7063
7064         PR gold/11996
7065         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7066         "This::" to work around a bug in gcc 4.2.
7067
7068         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7069
7070 2010-09-09  Rafael Espindola  <espindola@google.com>
7071
7072         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7073         sections with different PF_X flags in the same segment.
7074         (Layout::find_first_load_seg): Search all segments to find the first
7075         one.
7076         * options.h (rosegment): New.
7077
7078 2010-09-08  Rafael Espindola  <espindola@google.com>
7079
7080         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7081
7082 2010-09-08  Doug Kwan  <dougkwan@google.com>
7083
7084         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7085         (Arm_relobj::do_relocate_sections): Add new parameter for output
7086         file to match the parent.
7087         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7088         of local symbols instead of input values.  Update code to track
7089         changes in gold::relocate_section.
7090         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7091         (Sized_relobj::compute_final_local_value_internal): New methods.
7092         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7093         body into private version of Sized_relobj::compute_final_local_value.
7094         Call the inline method.
7095         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7096         merged symbol value if there is one.
7097         (Symbol_value::has_output_value): New method defintiion.
7098         (Sized_relobj::Compute_final_local_value_status): New enum type.
7099         (Sized_relobj::compute_final_local_value): New methods.
7100         (Sized_relobj::compute_final_local_value_internal): New methods.
7101         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7102         and arm_cortex_a8.sh.
7103         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7104         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7105         New tests.
7106         * Makefile.in: Regenerate.
7107         * testsuite/arm_bl_out_of_range.s: Update test.
7108         * testsuite/thumb_bl_out_of_range.s: Ditto.
7109         * testsuite/thumb_blx_out_of_range.s: Ditto.
7110         * testsuite/arm_branch_out_of_range.sh: New file.
7111         * testsuite/arm_cortex_a8.sh: Ditto.
7112         * testsuite/arm_cortex_a8_b.s: Ditto.
7113         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7114         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7115         * testsuite/arm_cortex_a8_bl.s: Ditto.
7116         * testsuite/arm_cortex_a8_blx.s: Ditto.
7117         * testsuite/arm_cortex_a8_local.s: Ditto.
7118         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7119         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7120
7121 2010-09-08  Rafael Espindola  <espindola@google.com>
7122
7123         * Makefile.am (memory_test.stdout): Run readelf with -W.
7124         * Makefile.in: Regenerate.
7125         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7126         64 bit output.
7127
7128 2010-09-08  Rafael Espindola  <espindola@google.com>
7129
7130         * script-sections.cc (Script_sections::add_memory_region): Convert
7131         field precision to int.
7132         * script.cc (script_set_section_region, script_set_section_region):
7133         Convert field precision to int.
7134
7135 2010-09-08  Rafael Espindola  <espindola@google.com>
7136
7137         * arm.cc (do_finalize_sections): Create the __exidx_start and
7138         __exdix_end symbols even when the section is missing.
7139
7140 2010-09-08  Nick Clifton  <nickc@redhat.com>
7141
7142         * README: Remove claim that MEMORY is not supported.
7143         * expression.cc (script_exp_function_origin)
7144         (script_exp_function_length): Move from here to ...
7145         * script.cc: ... here.
7146         (script_set_section_region, script_add_memory)
7147         (script_parse_memory_attr, script_include_directive): New
7148         functions.
7149         * script-sections.cc
7150         (class Memory_region): New class.
7151         (class Output_section_definition): Add set_memory_region,
7152         set_section_vma, set_section_lma and get_section_name methods.
7153         (class Script_Sections): Add add_memory_region,
7154         find_memory_region, find_memory_region_origin,
7155         find_memory_region_length and set_memory_region methods.
7156         Have set_section_addresses method walk the list of set memory
7157         regions.
7158         Extend the print methos to display memory regions.
7159         * script-sections.h: Add prototypes for new methods.
7160         Add enum for MEMORY region attributes.
7161         * yyscript.y: Add support for parsing MEMORY regions.
7162         * script-c.h: Add prototypes for new functions.
7163         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7164         * testsuite/Makefile.in: Regenerate.
7165         * testsuite/memory_test.sh: New script.
7166         * testsuite/memory_test.s: New assembler source file.
7167         * testsuite/memory_test.t: New linker script.
7168
7169 2010-08-27  Doug Kwan  <dougkwan@google.com>
7170
7171         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7172         reference override an existing dynamic weak reference.
7173         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7174         * testsuite/Makefile.in: Regenerate.
7175         * testsuite/dyn_weak_ref.sh: New file.
7176         * testsuite/dyn_weak_ref_1.c: Ditto.
7177         * testsuite/dyn_weak_ref_2.c: Ditto.
7178
7179 2010-08-27  Ian Lance Taylor  <iant@google.com>
7180
7181         * incremental.h (class Incremental_input_entry): Add virtual
7182         destructor.
7183
7184 2010-08-27  Ian Lance Taylor  <iant@google.com>
7185
7186         * testsuite/start_lib_test_3.c: Mark t3 as used.
7187
7188 2010-08-27  Nick Clifton  <nickc@redhat.com>
7189
7190         * options.cc (version_script): Fix small typo in previous
7191         whitespace tidyup.
7192
7193 2010-08-25  Nick Clifton  <nickc@redhat.com>
7194
7195         * archive.cc: Formatting fixes: Remove whitespace between
7196         typename and following asterisk.  Remove whitespace between
7197         function name and opening parenthesis.
7198         * archive.h: Likewise.
7199         * arm.cc: Likewise.
7200         * attributes.cc: Likewise.
7201         * attributes.h: Likewise.
7202         * common.cc: Likewise.
7203         * copy-relocs.cc: Likewise.
7204         * dirsearch.h: Likewise.
7205         * dynobj.cc: Likewise.
7206         * ehframe.cc: Likewise.
7207         * ehframe.h: Likewise.
7208         * expression.cc: Likewise.
7209         * fileread.cc: Likewise.
7210         * fileread.h: Likewise.
7211         * gc.h: Likewise.
7212         * gold-threads.cc: Likewise.
7213         * gold.cc: Likewise.
7214         * i386.cc: Likewise.
7215         * icf.h: Likewise.
7216         * incremental-dump.cc: Likewise.
7217         * incremental.cc: Likewise.
7218         * layout.cc: Likewise.
7219         * layout.h: Likewise.
7220         * main.cc: Likewise.
7221         * merge.cc: Likewise.
7222         * merge.h: Likewise.
7223         * object.cc: Likewise.
7224         * object.h: Likewise.
7225         * options.cc: Likewise.
7226         * options.h: Likewise.
7227         * output.cc: Likewise.
7228         * output.h: Likewise.
7229         * plugin.cc: Likewise.
7230         * plugin.h: Likewise.
7231         * powerpc.cc: Likewise.
7232         * reloc.cc: Likewise.
7233         * script-c.h: Likewise.
7234         * script-sections.cc: Likewise.
7235         * script.cc: Likewise.
7236         * stringpool.cc: Likewise.
7237         * symtab.cc: Likewise.
7238         * symtab.h: Likewise.
7239         * target.cc: Likewise.
7240         * timer.cc: Likewise.
7241         * timer.h: Likewise.
7242         * version.cc: Likewise.
7243         * x86_64.cc: Likewise.
7244
7245 2010-08-24  Nick Clifton  <nickc@redhat.com>
7246
7247         PR 11899
7248         * layout.cc (segment_precedes): Sort segments by their physical
7249         addresses, if they have been set.
7250
7251 2010-08-23  Cary Coutant  <ccoutant@google.com>
7252
7253         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7254         symbols data.
7255         (Lib_group::include_member): Unlock object after deleting its
7256         symbols data.
7257         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7258         the bug fixed here.
7259
7260 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7261             Cary Coutant  <ccoutant@google.com>
7262
7263         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7264         constructor, and set_blocker.
7265         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7266         readsyms_blocker_.
7267         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7268         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7269         * testsuite/Makefile.am (start_lib_test): New test case.
7270         * testsuite/Makefile.in: Regenerate.
7271         * testsuite/start_lib_test_main.c: New file.
7272         * testsuite/start_lib_test_1.c: New file.
7273         * testsuite/start_lib_test_2.c: New file.
7274         * testsuite/start_lib_test_3.c: New file.
7275
7276 2010-08-19  Ian Lance Taylor  <iant@google.com>
7277
7278         * Makefile.in: Rebuild with automake 1.11.1.
7279         * aclocal.m4: Likewise.
7280         * testsuite/Makefile.in: Likewise.
7281
7282 2010-08-19  Ian Lance Taylor  <iant@google.com>
7283
7284         PR 10893
7285         * i386.cc (class Output_data_plt_i386): Update declarations.
7286         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7287         local_ifuncs_ fields.
7288         (Target_i386::do_plt_section_for_global): New function.
7289         (Target_i386::do_plt_section_for_local): New function.
7290         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7291         parameter; change all callers.  Initialize global_ifuncs_ and
7292         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7293         __rel_iplt_end.
7294         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7295         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7296         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7297         symbols.
7298         (Target_i386::make_plt_section): New function, broken out of
7299         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7300         (Target_i386::make_plt_entry): Call make_plt_section.
7301         (Target_i386::make_local_ifunc_plt_entry): New function.
7302         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7303         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7304         R_386_IRELATIVE to switch.
7305         (Target_i386::Scan::global): Likewise.
7306         (Target_i386::Relocate::relocate): Likewise.
7307         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7308         switch.
7309         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7310         (Target_x86_64::do_plt_section_for_global): New function.
7311         (Target_x86_64::do_plt_section_for_local): New function.
7312         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7313         parameter; change all callers.  If doing a static link define
7314         __rela_iplt_start and __rela_iplt_end.
7315         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7316         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7317         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7318         to point to .plt.
7319         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7320         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7321         switch.
7322         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7323         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7324         R_X86_64_IRELATIVE to switch.
7325         (Target_x86_64::Scan::global): Likewise.
7326         (Target_x86_64::Relocate::relocate): Likewise.
7327         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7328         switch.
7329         * target.h (class Target): Add plt_section_for_global and
7330         plt_section_for_local functions.  Add do_plt_section_for_global
7331         and do_plt_section_for_local virtual functions.
7332         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7333         clarifying comments.
7334         (Symbol::use_plt_offset): Handle IFUNC symbol.
7335         * object.cc (Sized_relobj::Sized_relobj): Initialize
7336         local_plt_offsets_.
7337         (Sized_relobj::local_has_plt_offset): New function.
7338         (Sized_relobj::local_plt_offset): New function.
7339         (Sized_relobj::set_local_plt_offset): New function.
7340         (Sized_relobj::do_count): Handle IFUNC symbol.
7341         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7342         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7343         is_ifunc_symbol functions.
7344         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7345         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7346         local_plt_offsets_ field.
7347         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7348         * output.h (class Output_section_data): Add non-const
7349         output_section function.
7350         (class Output_data_got): Update declarations.
7351         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7352         Add use_plt_offset parameter to global and local constructors.
7353         Change all callers.  Change local_sym_index_ field to 31 bits.
7354         Change GSYM_CODE and CONSTANT_CODE accordingly.
7355         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7356         doing a static link don't set sh_link field.
7357         (Output_data_got::Got_entry::write): Use PLT offset if
7358         appropriate.
7359         (Output_data_got::add_global_plt): New function.
7360         (Output_data_got::add_local_plt): New function.
7361         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7362         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7363         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7364         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7365         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7366         IFUNC conditional.
7367         * testsuite/ifunc-sel.h: New file.
7368         * testsuite/ifuncmain1.c: New file.
7369         * testsuite/ifuncmain1vis.c: New file.
7370         * testsuite/ifuncmod1.c: New file.
7371         * testsuite/ifuncdep2.c: New file.
7372         * testsuite/ifuncmain2.c: New file.
7373         * testsuite/ifuncmain3.c: New file.
7374         * testsuite/ifuncmod3.c: New file.
7375         * testsuite/ifuncmain4.c: New file.
7376         * testsuite/ifuncmain5.c: New file.
7377         * testsuite/ifuncmod5.c: New file.
7378         * testsuite/ifuncmain6pie.c: New file.
7379         * testsuite/ifuncmod6.c: New file.
7380         * testsuite/ifuncmain7.c: New file.
7381         * configure, testsuite/Makefile.in: Rebuild.
7382
7383 2010-08-18  Ian Lance Taylor  <iant@google.com>
7384
7385         * incremental.cc
7386         (Output_section_incremental_inputs::write_input_files): Add cast
7387         to avoid signed/unsigned comparison warning.
7388         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7389
7390 2010-08-12  Cary Coutant  <ccoutant@google.com>
7391
7392         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7393
7394 2010-08-13  Ian Lance Taylor  <iant@google.com>
7395
7396         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7397
7398 2010-08-12  Cary Coutant  <ccoutant@google.com>
7399             Doug Kwan  <dougkwan@google.com>
7400
7401         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7402         defintion overrides non-weak undef, remember that the original undef
7403         is not weak.
7404         * symtab.cc (Symbol_table::sized_write_global): For undef without
7405         an original weak binding, set binding to global in output.
7406         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7407         * testsuite/Makefile.in: Regenerate.
7408         * testsuite/strong_ref_weak_def.sh: New file.
7409         * testsuite/strong_ref_weak_def_1.c: Ditto.
7410         * testsuite/strong_ref_weak_def_2.c: Ditto.
7411
7412 2010-08-12  Cary Coutant  <ccoutant@google.com>
7413
7414         * testsuite/incremental_test.sh: Rewrite.
7415         * testsuite/incremental_test_1.c: Rewrite.
7416         * testsuite/incremental_test_2.c: Rewrite.
7417
7418 2010-08-12  Cary Coutant  <ccoutant@google.com>
7419
7420         * arm.cc (Target_arm::got_size): Add const.
7421         (Target_arm::got_entry_count): New function.
7422         (Target_arm::plt_entry_count): New function.
7423         (Target_arm::first_plt_entry_offset): New function.
7424         (Target_arm::plt_entry_size): New function.
7425         (Output_data_plt_arm::entry_count): New function.
7426         (Output_data_plt_arm::first_plt_entry_offset): New function.
7427         (Output_data_plt_arm::get_plt_entry_size): New function.
7428         * i386.cc (Target_i386::got_size): Add const.
7429         (Target_i386::got_entry_count): New function.
7430         (Target_i386::plt_entry_count): New function.
7431         (Target_i386::first_plt_entry_offset): New function.
7432         (Target_i386::plt_entry_size): New function.
7433         (Output_data_plt_i386::entry_count): New function.
7434         (Output_data_plt_i386::first_plt_entry_offset): New function.
7435         (Output_data_plt_i386::get_plt_entry_size): New function.
7436         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7437         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7438         * incremental.cc: Include target.h.
7439         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7440         parameter.  Adjust all callers.  Find incremental_got_plt section.
7441         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7442         section.
7443         (Output_section_incremental_inputs::set_final_data_size): Calculate
7444         size of incremental_got_plt section.
7445         (Output_section_incremental_inputs::do_write): Write the
7446         incremental_got_plt section.
7447         (Got_plt_view_info): New struct.
7448         (Local_got_offset_visitor): New class.
7449         (Global_got_offset_visitor): New class.
7450         (Global_symbol_visitor_got_plt): New class.
7451         (Output_section_incremental_inputs::write_got_plt): New function.
7452         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7453         Add parameter.  Adjust all callers.
7454         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7455         (Incremental_inputs::got_plt_section): New function.
7456         (Incremental_inputs::got_plt_section_): New data member.
7457         (Incremental_got_plt_reader): New class.
7458         * layout.cc (Layout::create_incremental_info_sections): Add the
7459         incremental_got_plt section.
7460         * object.h (Got_offset_list::get_list): New function.
7461         (Got offset_list::for_all_got_offsets): New function.
7462         (Sized_relobj::local_got_offset_list): New function.
7463         * powerpc.cc (Target_powerpc::got_size): Add const.
7464         (Target_powerpc::got_entry_count): New function.
7465         (Target_powerpc::plt_entry_count): New function.
7466         (Target_powerpc::first_plt_entry_offset): New function.
7467         (Target_powerpc::plt_entry_size): New function.
7468         (Output_data_plt_powerpc::entry_count): New function.
7469         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7470         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7471         * sparc.cc (Target_sparc::got_size): Add const.
7472         (Target_sparc::got_entry_count): New function.
7473         (Target_sparc::plt_entry_count): New function.
7474         (Target_sparc::first_plt_entry_offset): New function.
7475         (Target_sparc::plt_entry_size): New function.
7476         (Output_data_plt_sparc::entry_count): New function.
7477         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7478         (Output_data_plt_sparc::get_plt_entry_size): New function.
7479         * symtab.h (Symbol::got_offset_list): New function.
7480         (Symbol_table::for_all_symbols): New function.
7481         * target.h (Sized_target::got_entry_count): New function.
7482         (Sized_target::plt_entry_count): New function.
7483         (Sized_target::plt_entry_size): New function.
7484         * x86_64.cc (Target_x86_64::got_size): Add const.
7485         (Target_x86_64::got_entry_count): New function.
7486         (Target_x86_64::plt_entry_count): New function.
7487         (Target_x86_64::first_plt_entry_offset): New function.
7488         (Target_x86_64::plt_entry_size): New function.
7489         (Output_data_plt_x86_64::entry_count): New function.
7490         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7491         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7492
7493 2010-08-12  Cary Coutant  <ccoutant@google.com>
7494
7495         * archive.cc: Include incremental.h.
7496         (Archive::Archive): Initialize incremental_info_.
7497         (Archive::include_member): Record archive members in incremental info.
7498         (Add_archive_symbols::run): Record begin and end of an archive in
7499         incremental info.
7500         (Lib_group::include_member): Record objects in incremental info.
7501         * archive.h (Incremental_archive_entry): Forward declaration.
7502         (Archive::set_incremental_info): New member function.
7503         (Archive::incremental_info): New member function.
7504         (Archive::Unused_symbol_iterator): New class.
7505         (Archive::unused_symbols_begin): New member function.
7506         (Archive::unused_symbols_end): New member function.
7507         (Archive::incremental_info_): New data member.
7508         * incremental-dump.cc (find_input_containing_global): New function.
7509         (dump_incremental_inputs): Dump new incremental info sections.
7510         * incremental.cc: Include symtab.h.
7511         (Output_section_incremental_inputs): New class.
7512         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7513         new incremental info sections.
7514         (Sized_incremental_binary::do_check_inputs): Likewise.
7515         (Incremental_inputs::report_archive): Remove.
7516         (Incremental_inputs::report_archive_begin): New function.
7517         (Incremental_inputs::report_archive_end): New function.
7518         (Incremental_inputs::report_object): New function.
7519         (Incremental_inputs::finalize_inputs): Remove.
7520         (Incremental_inputs::report_input_section): New function.
7521         (Incremental_inputs::report_script): Rewrite.
7522         (Incremental_inputs::finalize): Do nothing but finalize string table.
7523         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7524         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7525         (Incremental_inputs::create_data_sections): New function.
7526         (Incremental_inputs::relocs_entsize): New function.
7527         (Output_section_incremental_inputs::set_final_data_size): New function.
7528         (Output_section_incremental_inputs::do_write): New function.
7529         (Output_section_incremental_inputs::write_header): New function.
7530         (Output_section_incremental_inputs::write_input_files): New function.
7531         (Output_section_incremental_inputs::write_info_blocks): New function.
7532         (Output_section_incremental_inputs::write_symtab): New function.
7533         * incremental.h (Incremental_script_entry): Forward declaration.
7534         (Incremental_object_entry): Forward declaration.
7535         (Incremental_archive_entry): Forward declaration.
7536         (Incremental_inputs): Forward declaration.
7537         (Incremental_inputs_header_data): Remove.
7538         (Incremental_inputs_header): Remove.
7539         (Incremental_inputs_header_write): Remove.
7540         (Incremental_inputs_entry_data): Remove.
7541         (Incremental_inputs_entry): Remove.
7542         (Incremental_inputs_entry_write): Remove.
7543         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7544         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7545         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7546         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7547         Likewise.
7548         (Incremental_input_entry): New class.
7549         (Incremental_script_entry): New class.
7550         (Incremental_object_entry): New class.
7551         (Incremental_archive_entry): New class.
7552         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7553         (Incremental_inputs::report_inputs): Remove.
7554         (Incremental_inputs::report_archive): Remove.
7555         (Incremental_inputs::report_archive_begin): New function.
7556         (Incremental_inputs::report_archive_end): New function.
7557         (Incremental_inputs::report_object): Change prototype.
7558         (Incremental_inputs::report_input_section): New function.
7559         (Incremental_inputs::report_script): Change prototype.
7560         (Incremental_inputs::get_reloc_count): New function.
7561         (Incremental_inputs::set_reloc_count): New function.
7562         (Incremental_inputs::create_data_sections): New function.
7563         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7564         (Incremental_inputs::inputs_section): New function.
7565         (Incremental_inputs::symtab_section): New function.
7566         (Incremental_inputs::relocs_section): New function.
7567         (Incremental_inputs::get_stringpool): Add const.
7568         (Incremental_inputs::command_line): Add const.
7569         (Incremental_inputs::inputs): Remove.
7570         (Incremental_inputs::command_line_key): New function.
7571         (Incremental_inputs::input_file_count): New function.
7572         (Incremental_inputs::input_files): New function.
7573         (Incremental_inputs::relocs_entsize): New function.
7574         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7575         (Incremental_inputs::finalize_inputs): Remove.
7576         (Incremental_inputs::Input_info): Remove.
7577         (Incremental_inputs::lock_): Remove.
7578         (Incremental_inputs::inputs_): Change type.
7579         (Incremental_inputs::inputs_map_): Remove.
7580         (Incremental_inputs::current_object_entry_): New data member.
7581         (Incremental_inputs::inputs_section_): New data member.
7582         (Incremental_inputs::symtab_section_): New data member.
7583         (Incremental_inputs::relocs_section_): New data member.
7584         (Incremental_inputs::reloc_count_): New data member.
7585         (Incremental_inputs_reader): New class.
7586         (Incremental_symtab_reader): New class.
7587         (Incremental_relocs_reader): New class.
7588         * layout.cc (Layout::finalize): Move finalization of incremental info
7589         and creation of incremental info sections to follow finalization of
7590         symbol table.  Set offsets for postprocessing sections.
7591         (Layout::create_incremental_info_sections): Call
7592         Incremental_inputs::create_data_sections.  Add incremental symtab
7593         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7594         sections to layout after input sections.
7595         * layout.h (struct Timespec): Forward declaration.
7596         (Layout::incremental_inputs): Add const.
7597         (Layout::create_incremental_info_sections): Add parameter.
7598         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7599         * object.cc: Include incremental.h.
7600         (Relobj::finalize_incremental_relocs): New function.
7601         (Sized_relobj::do_layout): Record input sections in incremental info.
7602         * object.h (Object::output_section): New function.
7603         (Object::output_section_offset): Moved from Relobj.
7604         (Object::get_incremental_reloc_base): New function.
7605         (Object::get_incremental_reloc_count): New function.
7606         (Object::do_output_section): New function.
7607         (Object::do_output_section_offset): Moved from Relobj.
7608         (Object::do_get_incremental_reloc_base): New function.
7609         (Object::do_get_incremental_reloc_count): New function.
7610         (Object::Object): Initialize new data members.
7611         (Relobj::output_section): Renamed do_output_section and moved to
7612         protected.
7613         (Relobj::output_section_offset): Moved to Object.
7614         (Relobj::do_get_incremental_reloc_base): New function.
7615         (Relobj::do_get_incremental_reloc_count): New function.
7616         (Relobj::allocate_incremental_reloc_counts): New function.
7617         (Relobj::count_incremental_reloc): New function.
7618         (Relobj::finalize_incremental_relocs): New function.
7619         (Relobj::next_incremental_reloc_index): New function.
7620         (Relobj::reloc_counts_): New data member.
7621         (Relobj::reloc_bases_): New data member.
7622         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7623         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7624         (Sized_relobj::incremental_relocs_scan): New function.
7625         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7626         (Sized_relobj::incremental_relocs_write): New function.
7627         (Sized_relobj::incremental_relocs_write_reltype): New function.
7628         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7629         incremental link.
7630         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7631         archives and object files elsewhere.
7632         (Add_symbols::run): Report object files here.
7633         (Finish_group::run): Report end of archive at end of group.
7634         * reloc.cc: Include layout.h, incremental.h.
7635         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7636         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7637         (Sized_relobj::incremental_relocs_scan): New function.
7638         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7639         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7640         (Sized_relobj::incremental_relocs_write): New function.
7641         (Sized_relobj::incremental_relocs_write_reltype): New function.
7642         * script.cc (read_input_script): Rewrite test for incremental link.
7643         Change call to Incremental_inputs::report_script.
7644         * symtab.h (Symbol_table::first_global_index): New function.
7645         (Symbol_table::output_count): New function.
7646
7647 2010-08-12  Doug Kwan  <dougkwan@google.com>
7648
7649         * arm.cc (Target_arm::merge_object_attributes): Check command line
7650         options --no-wchar-size-warning and --no-enum-size-warning.
7651         * options.h (General_options): Add ld-compatible options
7652         --no-enum-size-warning and --no-wchar-size-warning.
7653
7654 2010-08-04  Ian Lance Taylor  <iant@google.com>
7655
7656         * x86_64.cc (Target_x86_64::Scan::local): Use
7657         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7658         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7659         (Target_x86_64::Scan::global): Likewise.
7660         (Target_x86_64::Relocate::relocate): Likewise.
7661         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7662         Likewise.
7663
7664 2010-08-03  Cary Coutant  <ccoutant@google.com>
7665
7666         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7667         to reserve space in merged_strings vector. Keep total input size
7668         for stats.
7669         (Output_merge_string::do_print_merge_stats): Print total input size.
7670         * merge.h (Output_merge_string): Add input_size_ field.
7671         * stringpool.cc (Stringpool_template::string_length): Move
7672         implementations out of Stringpool_template class and place in
7673         stringpool.h.
7674         * stringpool.h (string_length): Move out of Stringpool_template.
7675
7676 2010-08-03  Ian Lance Taylor  <iant@google.com>
7677
7678         PR 11712
7679         * layout.cc (relaxation_loop_body): If address of load segment is
7680         set, adjust address to include headers if possible.
7681
7682 2010-08-03  Ian Lance Taylor  <iant@google.com>
7683
7684         * version.cc (version_string): Bump to 1.10.
7685
7686 2010-08-03  Ian Lance Taylor  <iant@google.com>
7687
7688         PR 11805
7689         * layout.h (enum Output_section_order): Define.
7690         (class Layout): Update declarations.
7691         * layout.cc (Layout::get_output_section): Add order parameter.
7692         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7693         is_first_non_relro parameters.  Change all callers.
7694         (Layout::choose_output_section): Likewise.
7695         (Layout::add_output_section_data): Likewise.
7696         (Layout::make_output_section): Likewise.  Set order.
7697         (Layout::default_section_order): New function.
7698         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7699         * output.cc (Output_section::Output_section): Initialize order_.
7700         Don't initialize deleted fields.
7701         (Output_segment::Output_segment): Don't initialize deleted
7702         fields.
7703         (Output_segment::add_output_section_to_load): New function
7704         replacing add_output_section.  Change all callers to call this or
7705         add_output_section_to_nonload.
7706         (Output_segment::add_output_section_to_nonload): New function.
7707         (Output_segment::remove_output_section): Rewrite.
7708         (Output_segment::add_initial_output_data): Likewise.
7709         (Output_segment::has_any_data_sections): Likewise.
7710         (Output_segment::is_first_section_relro): Likewise.
7711         (Output_segment::maximum_alignment): Likewise.
7712         (Output_segment::has_dynamic_reloc): New function replacing
7713         dynamic_reloc_count.  Change all callers.
7714         (Output_segment::has_dynamic_reloc_list): New function replacing
7715         dynamic_reloc_count_list.  Change all callers.
7716         (Output_segment::set_section_addresses): Rewrite.
7717         (Output_segment::set_offset): Rewrite.
7718         (Output_segment::find_first_and_last_list): Remove.
7719         (Output_segment::set_tls_offsets): Rewrite.
7720         (Output_segment::first_section_load_address): Likewise.
7721         (Output_segment::output_section_count): Likewise.
7722         (Output_segment::section_with_lowest_load_address): Likewise.
7723         (Output_segment::write_section_headers): Likewise.
7724         (Output_segment::print_sections_to_map): Likewise.
7725         * output.h (class Output_data): Remove dynamic_reloc_count_
7726         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7727         (Output_data::add_dynamic_reloc): Rewrite.
7728         (Output_data::has_dynamic_reloc): New function.
7729         (Output_data::dynamic_reloc_count): Remove.
7730         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7731         is_last_relro_, is_first_non_relro_, is_interp_,
7732         is_dynamic_linker_section_ fields.  Add order and set_order
7733         functions.  Remove is_relro_local, set_is_relro_local,
7734         is_last_relro, set_is_last_relro, is_first_non_relro,
7735         set_is_first_non_relro functions, is_interp, set_is_interp,
7736         is_dynamic_linker_section, and set_is_dynamic_linker_section
7737         functions.
7738         (class Output_segment): Change Output_data_list from std::list to
7739         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7740         output_bss_ fields.  Update declarations.
7741
7742 2010-08-02  Ian Lance Taylor  <iant@google.com>
7743
7744         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7745         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7746         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7747
7748 2010-08-02  Ian Lance Taylor  <iant@google.com>
7749
7750         PR 11855
7751         * script.cc (Script_options::Script_options): Initialize
7752         symbol_definitions_ and symbol_references_.
7753         (Script_options::add_symbol_assignment): Update
7754         symbol_definitions_ and symbol_references_.
7755         (Script_options::add_symbol_reference): New function.
7756         (script_symbol): New function.
7757         * script.h (class Script_options): Add symbol_definitions_ and
7758         symbol_references_ fields.
7759         (Script_options::referenced_const_iterator): New type.
7760         (Script_options::referenced_begin): New function.
7761         (Script_options::referenced_end): New function.
7762         (Script_options::is_referenced): New function.
7763         (Script_options::any_unreferenced): New function.
7764         * script-c.h (script_symbol): Declare.
7765         * yyscript.y (exp): Call script_symbol.
7766         * symtab.cc: Include "script.h".
7767         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7768         Change all callers.  Check symbols referenced by scripts.
7769         (Symbol_table::add_undefined_symbols_from_command_line): Add
7770         layout parameter.  Change all callers.
7771         (Symbol_table::do_add_undefined_symbols_from_command_line):
7772         Likewise.  Break out loop body.  Check symbols referenced by
7773         scripts.
7774         (Symbol_table::add_undefined_symbol_from_command_line): New
7775         function broken out of
7776         do_add_undefined_symbols_from_command_line.
7777         * symtab.h (class Symbol_table): Update declarations.
7778         * archive.cc: Include "layout.h".
7779         (Archive::should_include_member): Add layout parameter.  Change
7780         all callers.  Check for symbol mentioned in expression.
7781         * archive.h (class Archive): Update declaration.
7782         * object.cc (Sized_relobj::do_should_include_member): Add layout
7783         parameter.
7784         * object.h (Object::should_include_member): Add layout parameter.
7785         Change all callers.
7786         (Object::do_should_include_member): Add layout parameter.
7787         (class Sized_relobj): Update declaration.
7788         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7789         parameter.
7790         * dynobj.h (class Sized_dynobj): Update declaration.
7791         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7792         layout parameter.
7793         * plugin.h (class Sized_pluginobj): Update declaration.
7794
7795 2010-08-02  Ian Lance Taylor  <iant@google.com>
7796
7797         PR 11866
7798         * output.cc (Output_segment::set_offset): Search for the first and
7799         last sections rather than assuming that the list is in order.
7800         (Output_segment::find_first_and_last_list): New function.
7801         * output.h (class Output_segment): Update declarations.
7802         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7803         (relro_strip_test_SOURCES): New variable.
7804         (relro_strip_test_DEPENDENCIES): New variable.
7805         (relro_strip_test_LDFLAGS): New variable.
7806         (relro_strip_test_LDADD): New variable.
7807         (relro_strip_test.so): New target.
7808
7809 2010-08-02  Ian Lance Taylor  <iant@google.com>
7810
7811         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7812         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7813         (Target_i386::got_tlsdesc_section): New function.
7814         (Target_i386::got_section): Create space for GOT entries for
7815         TLSDESC relocations.
7816         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7817         R_386_TLS_GOTDESC.
7818         (Target_i386::Scan::global): Likewise.
7819         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7820         using TLSDESC GOT.
7821         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7822         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7823         (Target_x86_64::got_tlsdesc_section): New function.
7824         (Target_x86_64::got_section): Create space for GOT entries for
7825         TLSDESC relocations.
7826         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7827         R_386_TLS_GOTDESC.
7828         (Target_x86_64::Scan::global): Likewise.
7829         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7830         using TLSDESC GOT.
7831
7832 2010-08-02  Ian Lance Taylor  <iant@google.com>
7833
7834         * testsuite/final_layout.sh: Use dc to convert from hex to
7835         decimal.
7836
7837 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7838
7839         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7840         paramter to the call to gold::gc_process_relocs.
7841         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7842         paramter to the call to gold::gc_process_relocs.
7843         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7844         parameter to the call to gold::gc_process_relocs.
7845         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7846         template parameter to the call to gold::gc_process_relocs.
7847         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7848         paramter to the call to gold::gc_process_relocs.
7849         * gc.h (get_embedded_addend_size): New function.
7850         (gc_process_relocs): Save the size of the reloc for use by ICF.
7851         * icf.cc (get_section_contents): Get the addend from the text section
7852         for SHT_REL relocation sections.
7853         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7854         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7855         * int_encoding.h (read_from_pointer): New overloaded function.
7856         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7857         * testsuite/icf_sht_rel_addend_test.sh: New file.
7858         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7859         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7860
7861 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7862
7863         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7864         * Makefile.in: Regenerate.
7865         * testsuite/Makefile.in: Regenerate.
7866
7867 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7868
7869         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7870         * gold/testsuite/debug_msg.cc: Likewise.
7871         * gold/testsuite/odr_violation1.cc
7872         * gold/testsuite/odr_violation2.cc
7873
7874 2010-07-21  Cary Coutant  <ccoutant@google.com>
7875
7876         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7877         string, and length fields.
7878         (Output_merge_string::Merged_strings_list): New type.
7879         (Output_merge_string::Merged_strings_lists): New typedef.
7880         (Output_merge_string): Replace merged_strings_ with
7881         merged_strings_lists_.
7882         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7883         Merged_strings_list per input object and section.  Don't store pointer
7884         to the string.  Don't store length with each merged string entry.
7885         (Output_merge_string::finalize_merged_data): Loop over list of merged
7886         strings lists.  Recompute length of each merged string.
7887
7888 2010-07-15  Cary Coutant  <ccoutant@google.com>
7889
7890         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7891         here.
7892
7893 2010-07-14  Ian Lance Taylor  <iant@google.com>
7894
7895         * descriptors.cc (Descriptors::open): Report correct name in error
7896         message.
7897
7898 2010-07-13  Doug Kwan  <dougkwan@google.com>
7899
7900         * arm.cc (Arm_input_section::Arm_input_section): For a
7901         SHT_ARM_EXIDX section, always keeps the input sections.
7902         (Arm_input_section::set_exidx_section_link): New method.
7903         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7904         has_errors_ to false.
7905         (Arm_exidx_input_section::has_errors,
7906         Arm_exidx_input_section::set_has_errors): New methods.
7907         (Arm_exidx_input_section::has_errors_): New data member.
7908         (Arm_relobj::get_exidx_shndx_list): New method.
7909         (Arm_output_section::append_text_sections_to_list): Do not skip
7910         section without SHF_EXECINSTR.
7911         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7912         errors.
7913         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7914         section header.  Make error messages more verbose.  Check for
7915         a non-executable section linked to an EXIDX section.
7916         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7917         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7918         check that there is no deferred EXIDX section if we exit early.
7919         Instead of not making an EXIDX section in case of an error, make one
7920         and set the has_errors flag of it.
7921         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7922         in a relocatable link.
7923         (Target_arm::do_relax): Look for the EXIDX output section instead of
7924         assuming that it is called .ARM.exidx.
7925         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7926         section list.  Do not check for SHF_EXECINSTR section flags but
7927         skip any input section with errors.
7928         * output.cc (Output_section::Output_section): Initialize
7929         always_keeps_input_sections_ to false.
7930         (Output_section::add_input_section): Check for
7931         always_keeps_input_sections_.
7932         *  output.h (Output_section::always_keeps_input_sections,
7933         Output_section::set_always_keeps_input_sections): New methods.
7934         (Output_section::always_keeps_input_sections): New data member.
7935
7936 2010-07-13  Rafael Espindola  <espindola@google.com>
7937
7938         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7939         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7940
7941 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7942             Ian Lance Taylor  <iant@google.com>
7943
7944         * output.h (Output_section_lookup_maps::add_merge_section):
7945         Correct check of whether value was inserted.
7946         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7947         (Output_section_lookup_maps::add_relaxed_input_section):
7948         Likewise.
7949         * arm.cc (Target_arm::got_section): Remove used local os.
7950         * i386.cc (Target_i386::got_section): Likewise.
7951         * x86_64.cc (Target_x86_64::got_section): Likewise.
7952         * sparc.cc (Target_sparc::got_section): Likewise.
7953         (Target_sparc::relocate): Remove unused local have_got_offset.
7954         * powerpc.cc (Target_powerpc::relocate): Likewise.
7955
7956 2010-07-13  Ian Lance Taylor  <iant@google.com>
7957
7958         * compressed_output.cc (zlib_decompress): Fix signature in
7959         !HAVE_ZLIB_H case.
7960
7961         * archive.cc (Archive::include_member): Unlock an external member
7962         of a thin archive.  Don't bother to delete an object we know is
7963         NULL.
7964
7965 2010-07-12  Cary Coutant  <ccoutant@google.com>
7966
7967         * compressed_output.cc (zlib_decompress): New function.
7968         (get_uncompressed_size): New function.
7969         (decompress_input_section): New function.
7970         * compressed_output.h (get_uncompressed_size): New function.
7971         (decompress_input_section): New function.
7972         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7973         Handle compressed debug sections.
7974         * layout.cc (is_compressed_debug_section): New function.
7975         (Layout::output_section_name): Map compressed section names to
7976         canonical names.
7977         * layout.h (is_compressed_debug_section): New function.
7978         (is_debug_info_section): Recognize compressed debug sections.
7979         * merge.cc: Include compressed_output.h.
7980         (Output_merge_data::do_add_input_section): Handle compressed
7981         debug sections.
7982         (Output_merge_string::do_add_input_section): Handle compressed
7983         debug sections.
7984         * object.cc: Include compressed_output.h.
7985         (Sized_relobj::Sized_relobj): Initialize new data members.
7986         (build_compressed_section_map): New function.
7987         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7988         * object.h (Object::section_is_compressed): New method.
7989         (Object::do_section_is_compressed): New method.
7990         (Sized_relobj::Compressed_section_map): New type.
7991         (Sized_relobj::do_section_is_compressed): New method.
7992         (Sized_relobj::compressed_sections_): New data member.
7993         * output.cc (Output_section::add_input_section): Handle compressed
7994         debug sections.
7995         * reloc.cc: Include compressed_output.h.
7996         (Sized_relobj::write_sections): Handle compressed debug sections.
7997
7998 2010-07-08  Cary Coutant  <ccoutant@google.com>
7999
8000         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8001         weak when resolving to a dynamic def.
8002         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8003         for weak undef/dynamic def cases. Adjust callers.
8004         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8005         undef_binding_weak_.
8006         (Symbol_table::sized_write_globals): Adjust symbol binding.
8007         (Symbol_table::sized_write_symbol): Add binding parameter.
8008         * symtab.h (Symbol::set_undef_binding): New method.
8009         (Symbol::is_undef_binding_weak): New method.
8010         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8011         (Symbol_table::should_override): Add new parameter.
8012         (Symbol_table::sized_write_symbol): Add new parameter.
8013
8014         * testsuite/weak_undef_file1.cc: Add new test case.
8015         * testsuite/weak_undef_file2.cc: Fix header comment.
8016         * testsuite/weak_undef_test.cc: Add new test case.
8017
8018 2010-06-29  Doug Kwan  <dougkwan@google.com>
8019
8020         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8021         Initialize USE_SYMBOL_.
8022         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8023         definition.
8024         (Arm_reloc_property::uses_symbol_): New data member declaration.
8025         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8026         uses symbol value and symbol is undefined but not weakly undefined.
8027
8028 2010-06-28  Rafael Espindola  <espindola@google.com>
8029
8030         * plugin.cc (Plugin::load): Use dlerror.
8031
8032 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8033
8034         * symtab.cc (detect_odr_violations): When reporting an ODR
8035         violation, report an object where the symbol is defined.
8036
8037 2010-06-25  Doug Kwan  <dougkwan@google.com>
8038
8039         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8040         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8041         definition.
8042         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8043         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8044         target hook to detect function points.
8045         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8046         * icf.h (Icf::check_section_for_function_pointers): Change type of
8047         parameter SECTION_NAME to const reference to std::string.  Use
8048         target hook to determine if section may have unsafe pointers.
8049         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8050         method definition.
8051
8052 2010-06-21  Rafael Espindola  <espindola@google.com>
8053
8054         * fileread.cc (Input_file::find_fie): New
8055         (Input_file::open): Use Input_file::find_fie.
8056         * fileread.h (Input_file::find_fie): New
8057         * plugin.cc (set_extra_library_path): New.
8058         (Plugin::load): Add set_extra_library_path to the transfer vector.
8059         (Plugin_manager::set_extra_library_path): New.
8060         (Plugin_manager::add_input_file): Use the extra search path if set.
8061         (set_extra_library_path(): New.
8062         * plugin.h (Plugin_manager): Add set_extra_library_path and
8063         extra_search_path_.
8064
8065 2010-06-19  Cary Coutant  <ccoutant@google.com>
8066
8067         * layout.cc (gdb_sections): Add .debug_types.
8068         (lines_only_debug_sections): Likewise.
8069
8070 2010-06-18  Rafael Espindola  <espindola@google.com>
8071
8072         * plugin.cc (add_input_file,add_input_library)
8073         (Plugin_manager::add_input_file): Make filename arguments const.
8074         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8075         const.
8076
8077 2010-06-16  Doug Kwan  <dougkwan@google.com>
8078
8079         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8080         .ARM.attributes section if we have not merged any input
8081         attributes sections.
8082
8083 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8084
8085         * arm.cc: Allow combining objects with no EABI version
8086         information.
8087
8088 2010-06-15  Rafael Espindola  <espindola@google.com>
8089
8090         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8091
8092 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8093
8094         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8095         (struct iovec): Correct !HAVE_READV definition.
8096
8097 2010-06-10  Cary Coutant  <ccoutant@google.com>
8098
8099         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8100         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8101         reloc sections.
8102         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8103
8104         PR 11683
8105         * symtab.h (Symbol::is_placeholder): New member function.
8106         * target-reloc.h (relocate_section): Check for placeholder symbols.
8107
8108         * testsuite/Makefile.am (plugin_test_8): New test.
8109         (plugin_test_9): New test.
8110         * testsuite/Makefile.in: Regenerate.
8111
8112 2010-06-09  Nick Clifton  <nickc@redhat.com>
8113
8114         * yyscript.y (input_list_element): Allow strings prefixed with
8115         the '-' character.  Treat these as libraries.
8116         * script.cc (script_add_library): New function.  Adds a library
8117         specified by "-l<name>" found in an input script.
8118         * script-c.h: Add prototype for script_add_library.
8119
8120 2010-06-07  Doug Kwan  <dougkwan@google.com>
8121
8122         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8123         Restrict stub-group size to be within long conditional branch
8124         range when working around cortex-A8 erratum.
8125
8126 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8127
8128         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8129         #ifdef typo.
8130
8131 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8132
8133         PR gold/11658
8134         * output.cc
8135         (Output_section::Input_section_sort_entry::compare_section_ordering):
8136         Change to return non-zero correctly.
8137         (Output_section::Input_section_sort_section_order_index_compare
8138         ::operator()): Change to fix ambiguity in comparisons.
8139
8140 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8141
8142         * gold.h (is_wildcard_string): New function.
8143         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8144         (Layout::layout_eh_frame): Ditto.
8145         (Layout::find_section_order_index): New method.
8146         (Layout::read_layout_from_file): New method.
8147         * layout.h (Layout::find_section_order_index): New method.
8148         (Layout::read_layout_from_file): New method.
8149         (Layout::input_section_position_): New private member.
8150         (Layout::input_section_glob_): New private member.
8151         * main.cc (main): Call read_layout_from_file here.
8152         * options.h (--section-ordering-file): New option.
8153         * output.cc (Output_section::input_section_order_specified_): New
8154         member.
8155         (Output_section::Output_section): Initialize new member.
8156         (Output_section::add_input_section): Add new parameter.
8157         Keep input sections when --section-ordering-file is used.
8158         (Output_section::set_final_data_size): Sort input sections when
8159         section ordering file is specified.
8160         (Output_section::Input_section_sort_entry): Add new parameter.
8161         Check sorting type.
8162         (Output_section::Input_section_sort_entry::compare_section_ordering):
8163         New method.
8164         (Output_section::Input_section_sort_compare::operator()): Change to
8165         consider section_order_index.
8166         (Output_section::Input_section_sort_init_fini_compare::operator()):
8167         Change to consider section_order_index.
8168         (Output_section::Input_section_sort_section_order_index_compare
8169         ::operator()): New method.
8170         (Output_section::sort_attached_input_sections): Change to sort
8171         according to section order when specified.
8172         (Output_section::add_input_section<32, true>): Add new parameter.
8173         (Output_section::add_input_section<64, true>): Add new parameter.
8174         (Output_section::add_input_section<32, false>): Add new parameter.
8175         (Output_section::add_input_section<64, false>): Add new parameter.
8176         * output.h (Output_section::add_input_section): Add new parameter.
8177         (Output_section::input_section_order_specified): New
8178         method.
8179         (Output_section::set_input_section_order_specified): New method.
8180         (Input_section::Input_section): Initialize section_order_index_.
8181         (Input_section::section_order_index): New method.
8182         (Input_section::set_section_order_index): New method.
8183         (Input_section::section_order_index_): New member.
8184         (Input_section::Input_section_sort_section_order_index_compare): New
8185         struct.
8186         (Output_section::input_section_order_specified_): New member.
8187         * script-sections.cc (is_wildcard_string): Delete and move modified
8188         method to gold.h.
8189         (Output_section_element_input::Output_section_element_input): Modify
8190         call to is_wildcard_string.
8191         (Output_section_element_input::Input_section_pattern
8192         ::Input_section_pattern): Ditto.
8193         (Output_section_element_input::Output_section_element_input): Ditto.
8194         * testsuite/Makefile.am (final_layout): New test case.
8195         * testsuite/Makefile.in: Regenerate.
8196         * testsuite/final_layout.cc: New file.
8197         * testsuite/final_layout.sh: New file.
8198
8199 2010-06-01  Rafael Espindola  <espindola@google.com>
8200
8201         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8202
8203 2010-06-01  Rafael Espindola  <espindola@google.com>
8204
8205         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8206         visibility of symbols.
8207
8208 2010-05-27  Doug Kwan  <dougkwan@google.com>
8209
8210         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8211         from start of output section instead of address for a local symbol
8212         in a merged or relaxed section when doing a relocatable link.
8213
8214 2010-05-26  Rafael Espindola  <espindola@google.com>
8215
8216         PR 11604
8217         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8218         adding sections the garbage collector removed.
8219         * gold/testsuite/Makefile.am: Add test.
8220         * gold/testsuite/Makefile.in: Regenerate.
8221         * gold/testsuite/plugin_test_7.sh: New.
8222         * gold/testsuite/plugin_test_7_1.c: New.
8223         * gold/testsuite/plugin_test_7_2.c: New.
8224
8225 2010-05-26  Rafael Espindola  <espindola@google.com>
8226
8227         * script-sections.cc (Output_section_definition::set_section_addresses):
8228         Check for --section-start.
8229
8230 2010-05-26  Doug Kwan  <dougkwan@google.com>
8231
8232         * arm.cc (Arm_scan_relocatable_relocs): New class.
8233         (Target_arm::relocate_special_relocatable): New method.
8234         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8235         (Arm_relocate_functions::thumb_branch_common): Same.
8236         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8237         instead of Default_scan_relocatable_relocs.
8238         * target-reloc.h (relocate_for_relocatable): Let target handle
8239         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8240         * target.h (Sized_target::relocate_special_relocatable): New method.
8241
8242 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8243
8244         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8245
8246 2010-05-23  Doug Kwan  <dougkwan@google.com>
8247
8248         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8249         instead of a cast.
8250         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8251         with a direct branch, not a conditional branch, to a stub.
8252         * merge.cc (Output_merge_base::record_input_section): New method
8253         defintion.
8254         (Output_merge_data::do_add_input_section): Record input section if
8255         keeps-input-sections flag is set.
8256         (Output_merge_string::do_add_input_section): Ditto.
8257         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8258         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8259         INPUT_SECTIONS_.
8260         (Output_merge_base::keeps_input_sections,
8261         Output_merge_base::set_keeps_input_sections,
8262         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8263         method definitions.
8264         (Output_merge_base::Input_sections): New type declaration.
8265         (Output_merge_base::input_sections_begin,
8266         Output_merge_base::input_sections_end,
8267         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8268         (Output_merge_base::bool keeps_input_sections_,
8269         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8270         Output_merge_base::input_sections_): New data members.
8271         (Output_merge_data::do_set_keeps_input_sections): New method
8272         defintion.
8273         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8274         * output.cc (Output_section::Input_section::relobj): Move method
8275         defintion from class declaration to here and handle merge sections.
8276         (Output_section::Input_section::shndx): Ditto.
8277         (Output_section::Output_section): Remove initializations of removed
8278         data members and initialize new data member LOOKUP_MAPS_.
8279         (Output_section::add_input_section): Set keeps-input-sections flag
8280         for a newly created merge output section as appropriate.  Adjust code
8281         to use Output_section_lookup_maps class.
8282         (Output_section::add_relaxed_input_section): Adjst code for lookup
8283         maps code refactoring.
8284         (Output_section::add_merge_input_section): Add a new parameter
8285         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8286         class.  If adding input section to a newly created merge output
8287         section fails, remove the new merge section.
8288         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8289         Adjust code for use of the Output_section_lookup_maps class.
8290         (Output_section::find_merge_section): Ditto.
8291         (Output_section::build_lookup_maps): New method defintion.
8292         (Output_section::find_relaxed_input_section): Adjust code to use
8293         Output_section_lookup_maps class.
8294         (Output_section::get_input_sections): Export merge sections.  Adjust
8295         code to use Output_section_lookup_maps class.
8296         (Output_section:::add_script_input_section): Adjust code to use
8297         Output_section_lookup_maps class.  Update lookup maps for merge
8298         sections also.
8299         (Output_section::discard_states): Use Output_section_lookup_maps.
8300         (Output_section::restore_states): Same.
8301         * output.h (Merge_section_properties): Move class defintion out of
8302         Output_section.
8303         (Output_section_lookup_maps): New class.
8304         (Output_section::Input_section::is_merge_section): New method
8305         defintion.
8306         (Output_section::Input_section::relobj): Move defintion out of class
8307         defintion.  Declare method only.
8308         (Output_section::Input_section::shndx): Ditto.
8309         (Output_section::Input_section::output_merge_base): New method defintion.
8310         (Output_section::Input_section::u2_.pomb): New union field.
8311         (Output_section::Merge_section_by_properties_map,
8312         Output_section::Output_section_data_by_input_section_map,
8313         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8314         Remove types.
8315         (Output_section::add_merge_input_section): Add new parameter
8316         KEEPS_INPUT_SECTIONS.
8317         (Output_section::build_lookup_maps): New method declaration.
8318         (Output_section::merge_section_map_,
8319         Output_section::merge_section_by_properties_map_,
8320         Output_section::relaxed_input_section_map_,
8321         Output_section::is_relaxed_input_section_map_valid_): Remove data
8322         members.
8323         (Output_section::lookup_maps_): New data member.
8324
8325 2010-05-21  Doug Kwan  <dougkwan@google.com>
8326
8327         PR gold/11619
8328         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8329         avoid a compilation error.
8330
8331 2010-05-19  Rafael Espindola  <espindola@google.com>
8332
8333         * script-sections.cc (Output_section_definition::allocate_to_segment):
8334         Update the phdrs_list even when the output section is NULL.
8335         * testsuite/Makefile.am: Add test.
8336         * testsuite/Makefile.in: Regenerate.
8337         * testsuite/script_test_9.cc: New.
8338         * testsuite/script_test_9.sh: New.
8339         * testsuite/script_test_9.t: New.
8340
8341 2010-05-19  Doug Kwan  <dougkwan@google.com>
8342
8343         * arm.cc (Arm_input_section::original_size): New method.
8344         (Arm_input_section::do_addralign): Add a cast.
8345         (Arm_input_section::do_output_offset): Remove static cast.
8346         (Arm_input_section::original_addralign,
8347          Arm_input_section::original_size_): Change type to uint32_t.
8348         (Arm_input_section::init): Add safe casts for section alignment
8349         and size.
8350         (Arm_input_section::set_final_data_size): Do not set address and
8351         offset of stub table.
8352         (Arm_output_section::fix_exidx_coverage): Change use of of
8353         Output_section::Simple_input_section to that of
8354         Output_section::Input_section.
8355         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8356         except for the first pass.
8357         * output.cc (Output_section::get_input_sections): Change type of
8358         input_sections to std::list<Input_section>.
8359         (Output_section::add_script_input_section): Rename from
8360         Output_section::add_simple_input_section.  Change type of SIS
8361         parameter from Simple_input_section to Input_section.
8362         * output.h (Output_section::Simple_input_section): Remove class.
8363         (Output_section::Input_section): Change class visibility to public.
8364         (Output_section::Input_section::addralign): Use stored alignments
8365         for special input sections if set.
8366         (Output_section::Input_section::set_addralign): New method.
8367         (Output_section::get_input_sections): Change parameter type from
8368         list of Simple_input_section to list of Input_section.
8369         (Output_section::add_script_input_section): Rename from
8370         Output_section::add_simple_input_section. Change first parameter's
8371         type from Simple_input_section to Input_section and remove the
8372         second and third parameters.
8373         * script-sections.cc (Input_section::Input_section_list): Change
8374         type to list of Output_section::Input_section/
8375         (Input_section_info::Input_section_info): Change parameter type of
8376         INPUT_SECTION to Output_section::Input_section.
8377         (Input_section_info::input_section): Change return type.
8378         (Input_section_info::input_section_): Change type to
8379         Output_section::Input_section.
8380         (Output_section_element_input::set_section_addresses): Adjust code
8381         to use Output_section::Input_section instead of
8382         Output_section::Simple_input_section.  Adjust code for renaming
8383         of Output_section::add_simple_input_section.
8384         (Orphan_output_section::set_section_addresses): Ditto.
8385
8386 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8387
8388         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8389         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8390
8391 2010-05-18  Rafael Espindola  <espindola@google.com>
8392
8393         * options.cc (General_options::finalize): Handle -nostdlib.
8394         * options.h (nostdlib): New option.
8395         * script.cc (script_add_search_dir): Handle -nostdlib.
8396
8397 2010-05-12  Doug Kwan  <dougkwan@google.com>
8398
8399         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8400         attributes section only if there no attributes section after merging.
8401         (Target_arm::merge_object_attributes): Move value of
8402         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8403         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8404         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8405         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8406         and arm_attr_merge_7.stdout.
8407         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8408         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8409         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8410         arm_attr_merge_7b.o): New rules.
8411         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8412         arm_attr_merge_7
8413         * testsuite/Makefile.in: Regenerate.
8414         * testsuite/arm_attr_merge.sh: New file.
8415         * testsuite/arm_attr_merge_[67][ab].s: Same.
8416
8417 2010-05-05  Nick Clifton  <nickc@redhat.com>
8418
8419         * po/es.po: Updated Spanish translation.
8420
8421 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8422
8423         * Makefile.am (install-exec-local): Properly install gold as
8424         default cross linker.
8425         * Makefile.in: Regenerated.
8426
8427 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8428             Nick Clifton  <nickc@redhat.com>
8429
8430         * configure.ac (install_as_default): Define and set to false
8431         unless --enable-gold or --enable-gold=both/gold has been
8432         specified.
8433         * configure: Regenerate.
8434
8435         * Makefile.am (install-exec-local): Install the executable as
8436         'ld.gold'.  If install_as_default is true then also install it as
8437         'ld'.
8438         * Makefile.in: Regenerated.
8439
8440 2010-04-24  Ian Lance Taylor  <iant@google.com>
8441
8442         * layout.cc (Layout::layout_reloc): In relocatable link don't
8443         combine reloc sections for grouped sections.
8444
8445 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8446
8447         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8448         sections that are not ordinary to icf.
8449         * icf.cc (get_section_contents): Handle relocation pointing to section
8450         with no object or shndx information.
8451         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8452         * testsuite/Makefile.in: Regenerate.
8453         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8454         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8455
8456 2010-04-22  Ian Lance Taylor  <iant@google.com>
8457
8458         * expression.cc (Expression::Expression_eval_info): Add
8459         result_alignment_pointer field.
8460         (Expression::eval_with_dot): Add result_alignment_pointer
8461         parameter.  Change all callers.
8462         (Expression::eval_maybe_dot): Likewise.
8463         (class Binary_expression): Add alignment_pointer parameter to
8464         left_value and right_value.  Change all callers.
8465         (BINARY_EXPRESSION): Set result alignment.
8466         (class Trinary_expression): Add alignment_pointer parameter to
8467         arg2_value and arg3_value.  Change all callers.
8468         (Trinary_cond::value): Set result alignment.
8469         (Max_expression::value, Min_expression::value): Likewise.
8470         (Align_expression::value): Likewise.
8471         * script-sections.cc (class Sections_element): Add dot_alignment
8472         parameter to set_section_addresses virtual function.  Update
8473         instantiations.
8474         (class Output_section_element): Likewise.
8475         (Script_sections::create_segments): Add dot_alignment parameter.
8476         Change all callers.
8477         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8478         (Script_sections::set_phdrs_clause_addresses): Likewise.
8479         * script-sections.h: Update declarations.
8480         * script.h: Update declarations.
8481         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8482         min_p_align.
8483         * testsuite/script_test_3.t: Set large alignment.
8484         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8485         segment has expected alignment.
8486
8487 2010-04-22  Nick Clifton  <nickc@redhat.com>
8488
8489         * po/gold.pot: Updated by the Translation project.
8490         * po/vi.po: Updated Vietnamese translation.
8491
8492 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8493
8494         * testsuite/Makefile.am (check_PROGRAMS): Add
8495         icf_virtual_function_folding_test.
8496         * testsuite/Makefile.in: Regenerated.
8497
8498 2010-04-15  Andrew Haley  <aph@redhat.com>
8499
8500         * options.h (merge_exidx_entries): New option.
8501         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8502         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8503         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8504         (Target_arm::merge_exidx_entries): New function.
8505         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8506         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8507         to Arm_exidx_fixup constructor.
8508         Add new arg, merge_exidx_entries.
8509         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8510         Arm_output_section::fix_exidx_coverage.
8511
8512 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8513
8514         * icf.cc (get_section_contents): Check for preemptible functions.
8515         Ignore addend when appropriate.
8516         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8517         section folded.
8518         (add_from_relobj): Check for section folded.
8519         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8520         * symtab.h (should_add_dynsym_entry): Add new parameter.
8521         * target-reloc.h (scan_relocs): Check for section folded.
8522         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8523         Check reloc types for function pointers in shared objects.
8524         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8525         case.
8526         (icf_preemptible_functions_test): New test case.
8527         (icf_string_merge_test): New test case.
8528         * testsuite.Makefile.in: Regenerate.
8529         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8530         bar_glob.  Refactor code.
8531         * testsuite/icf_preemptible_functions_test.cc: New file.
8532         * testsuite/icf_preemptible_functions_test.sh: New file.
8533         * testsuite/icf_string_merge_test.cc: New file.
8534         * testsuite/icf_string_merge_test.sh: New file.
8535         * testsuite/icf_virtual_function_folding_test.cc: New file.
8536         * testsuite/icf_virtual_function_folding_test.sh: New file.
8537
8538 2010-04-14  Doug Kwan  <dougkwan@google.com>
8539
8540         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8541         for local symbol recounting if we remove a section due to ICF.
8542         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8543         there are no regular objects in input.
8544
8545 2010-04-13  Doug Kwan  <dougkwan@google.com>
8546
8547         * arm.cc (Arm_input_section::set_final_data_size): Compute
8548         accurate final data size instead of using current data size.
8549
8550 2010-04-09  Doug Kwan  <dougkwan@google.com>
8551
8552         * layout.cc (Layout::choose_output_section): Handle script section
8553         types.
8554         (Layout::make_output_section_for_script): Add section type parameter.
8555         Handle script section types.
8556         * layout.h (Layout::make_output_section_for_script): Add section
8557         type parameter.
8558         * output.cc (Output_section::Output_section): Initialize data member
8559         is_noload_.
8560         (Output_section::do_reset_address_and_file_offset): Do not set address
8561         to 0 if section is a NOLOAD section.
8562         * output.h (Output_section::is_noload): New method.
8563         (Output_section::set_is_noload): Ditto.
8564         (Output_section::is_noload_): New data member.
8565         * script-c.h (Script_section_type): New enum type.
8566         (struct Parser_output_section_header): Add new file section_type.
8567         * script-sections.cc (Sections_element::output_section_name): Add
8568         parameter for returning script section type.
8569         (Output_section_definition::output_section_name): Ditto.
8570         (Output_section_definition::section_type)P; New method.
8571         (Output_section_definiton::script_section_type_name): Ditto.
8572         (Output_section_definition::script_section_type_): New data member.
8573         (Output_section_definition::Output_section_definition): Initialize
8574         data member Output_section_definition::script_section_type_.
8575         (Output_section_definition::create_sections): Pass script section type
8576         to Layout::make_output_section_for_script.
8577         (Output_section_definition::output_section_name): Return script
8578         section type to caller.
8579         (Output_section_definition::set_section_address): Do not advance
8580         dot value and load address if section type is NOLOAD.  Set address
8581         of NOLOAD sections regardless of section flags.
8582         (Output_section_definition::print): Print section type if it is
8583         not SCRIPT_SECTION_TYPE_NONE.
8584         (Output_section_definition::section_type): New method.
8585         (Output_section_definition::script_section_type_name): Ditto.
8586         (Script_sections::output_section_name): Add new parameter
8587         PSECTION_TYPE for returning script section type.  Pass it to
8588         section elements.  Handle discard sections.
8589         (Sort_output_sections::operator()): Handle NOLOAD sections.
8590         * script-sections.h (Script_sections::Section_type): New enum type.
8591         (Script_sections::output_section_name): Add a new parameter for
8592         returning script section type.
8593         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8594         INFO and NOLOAD.
8595         * yyscript.y (union): Add new field SECTION_TYPE.
8596         (COPY, DSECT, INFO, NOLOAD): New tokens.
8597         (opt_address_and_section_type): Change type to output_section_header.
8598         (section_type): New non-terminal
8599         (section_header): Handle section type.
8600         (opt_address_and_section_type): Return section type value.
8601
8602 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8603
8604         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8605         * testsuite/plugin_common_test_2.c (foo): Likewise.
8606
8607 2010-04-08  Doug Kwan  <dougkwan@google.com>
8608
8609         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8610         Output_merge_data.
8611         * output.cc (Output_section::add_merge_input_section): Simplify
8612         code and return status of Output_merge_base::add_input_section.
8613         Update merge section map only if Output_merge_base::add_input_section
8614         returns true.
8615
8616 2010-04-07  Doug Kwan  <dougkwan@google.com>
8617
8618         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8619         if section is marked as containing instructions but has no mapping
8620         symbols.
8621         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8622         correct section index.
8623         (Arm_relobj::find_linked_text_section): Ditto.
8624
8625 2010-04-07  Cary Coutant  <ccoutant@google.com>
8626
8627         * archive.cc (include_member): Destroy Read_symbols_data object before
8628         releasing file.
8629         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8630         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8631         (Read_symbols_data::~Read_symbols_data) New destructor.
8632         (Section_relocs::Section_relocs) New constructor.
8633         (Section_relocs::~Section_relocs) New destructor.
8634         (Read_relocs_data::Read_relocs_data) New constructor.
8635         (Read_relocs_data::~Read_relocs_data) New destructor.
8636         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8637         pointers to NULL after deleting.
8638
8639 2010-04-07  Doug Kwan  <dougkwan@google.com>
8640
8641         * arm.cc: Replace "endianity" with "endianness" in comments.
8642         (Arm_exidx_cantunwind): Ditto.
8643         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8644         (Arm_relobj::merge_flags_and_attributes): New method.
8645         (Arm_relobj::merge_flags_and_attributes_): New data member.
8646         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8647         (Arm_relobj::scan_sections_for_stubs): Ditto.
8648         (Arm_relobj::do_read_symbols): Check to see if we really want to
8649         merge processor-specific flags and attributes.  Exit early if
8650         an object is empty except for section names and the undefined symbol.
8651         (Target_arm::do_finalize_sections): Move check for ELF format to
8652         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8653         attributes from a regular object only when we have determined that
8654         it is aapropriate.  Do not create an .ARM.attributes section in
8655         output if there is no regular input object.
8656         (Target_arm::merge_processor_specific_flags): Check
8657         --warn-mismatch before printing any error.
8658         (Target_arm::merge_object_attributes): Ditto.
8659         * gold.cc (queue_middle_tasks): Handle the case in which there is
8660         no regular object in input.
8661         * options.cc (General_options::parse_EB): New method.
8662         (General_options::parse_EL): Same.
8663         (General_options::General_options): Initialize endianness_.
8664         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8665         New options.
8666         (General_options::Endianness): New enum.
8667         (General_options::endianness): New method.
8668         (General_options::endianness_): New data member.
8669         * parameters.cc (Parameters::set_options): Check target endianness.
8670         (Parameters::set_target_once): Ditto.
8671         (Parameters::check_target_endianness): New method.
8672         (parameters_force_valid_target): If either -EL or -EB is specified,
8673         use it to define endianness of default target.
8674         * parameters.h (Parameters::check_target_endianness): New method
8675         declaration.
8676         * target.h (class Target): Change "endianity" to "endianness"
8677         in comments.
8678
8679 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8680
8681         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8682         * configure: Regenerate.
8683         * Makefile.in: Regenerate.
8684         * testsuite/Makefile.in: Regenerate.
8685
8686 2010-04-06  Cary Coutant  <ccoutant@google.com>
8687
8688         gcc PR lto/42757
8689         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8690         prevailing definitions of common symbols.
8691         * testsuite/plugin_test_6.sh: New test case.
8692         * testsuite/plugin_common_test_1.c: New test case.
8693         * testsuite/plugin_common_test_2.c: New test case.
8694         * testsuite/Makefile.am (plugin_test_6): New test case.
8695         * testsuite/Makefile.in: Regenerate.
8696
8697 2010-04-06  Nick Clifton  <nickc@redhat.com>
8698
8699         * po/vi.po: New Vietnamese translation.
8700
8701 2010-03-30  Doug Kwan  <dougkwan@google.com>
8702
8703         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8704
8705 2010-03-25  Doug Kwan  <dougkwan@google.com>
8706
8707         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8708         to avoid a conversion warning on a 32-bit host.
8709
8710 2010-03-24  Ian Lance Taylor  <iant@google.com>
8711
8712         * testsuite/script_test_3.t: Add a TLS segment.
8713         * testsuite/Makefile.am (check_PROGRAMS): Add
8714         tls_phdrs_script_test.
8715         (tls_phdrs_script_test_SOURCES): Define.
8716         (tls_phdrs_script_test_DEPENDENCIES): Define.
8717         (tls_phdrs_script_test_LDFLAGS): Define.
8718         (tls_phdrs_script_test_LDADD): Define.
8719         * testsuite/Makefile.in: Rebuild.
8720
8721 2010-03-23  Cary Coutant  <ccoutant@google.com>
8722
8723         * fileread.cc (find_or_make_view): Fix comment.
8724
8725 2010-03-23  Ian Lance Taylor  <iant@google.com>
8726
8727         * script-sections.cc (class Orphan_section_placement): Define
8728         PLACE_TLS and PLACE_TLS_BSS.
8729         (Orphan_section_placement::Orphan_section_placement): Initialize
8730         new places.
8731         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8732         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8733         (tls_script_test_SOURCES): Define.
8734         (tls_script_test_DEPENDENCIES): Define.
8735         (tls_script_test_LDFLAGS): Define.
8736         (tls_script_test_LDADD): Define.
8737         * testsuite/Makefile.in: Rebuild.
8738
8739 2010-03-22  Doug Kwan  <dougkwan@google.com>
8740
8741         * arm.cc (Arm_relocate_functions::abs8,
8742         Arm_relocate_functions::abs16): Use correct check for overflow
8743         specified in the ARM ELF specs.
8744         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8745         target of a BLX instruction specially.
8746         (Reloc_stub::stub_type_for_reloc): Ditto.
8747         (Relocate::relocate): Use symbolic names instead of numeric relocation
8748         codes to report error.
8749         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8750         workaround.
8751         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8752         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8753         thumb2_blx_out_of_range.stdout
8754         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8755         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8756         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8757         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8758         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8759         thumb2_blx_in_range, thumb2_blx_in_range.o,
8760         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8761         thumb2_blx_out_of_range.o): New rules.
8762         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8763         thumb2_blx_in_range and thumb2_blx_out_of_range.
8764         * testsuite/Makefile.in: Regenerate.
8765         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8766         * testsuite/thumb_blx_in_range.s: New file.
8767         * testsuite/thumb_blx_out_of_range.s: New file.
8768
8769 2010-03-22  Rafael Espindola  <espindola@google.com>
8770
8771         * archive.cc (Should_include): Move to archive.h.
8772         (should_include_member): Make it a member of Archive.
8773         (Lib_group): New.
8774         (Add_lib_group_symbols): New.
8775         * archive.h: Include options.h.
8776         (Archive_member): Moved from Archive.
8777         (Should_include): Moved from archive.cc.
8778         (Lib_group): New.
8779         (Add_lib_group_symbols): New.
8780         * dynobj.cc (do_should_include_member): New.
8781         * dynobj.h (do_should_include_member): New.
8782         * gold.cc (queue_initial_tasks): Update call to queue.
8783         * main.cc (main): Print lib group stats.
8784         * object.cc (do_should_include_member): New.
8785         * object.h: Include archive.h.
8786         (Object::should_include_member): New.
8787         (Object::do_should_include_member): New.
8788         (Sized_relobj::do_should_include_member): New.
8789         * options.cc (General_options::parse_start_lib): New.
8790         (General_options::parse_end_lib): New.
8791         (Input_arguments::add_file): Handle lib groups.
8792         (Input_arguments::start_group): Check we are not in a lib.
8793         (Input_arguments::start_lib): New.
8794         (Input_arguments::end_lib): New.
8795         * options.h (General_options): Add start_lib and end_lib.
8796         (Input_argument::lib_): New.
8797         (Input_argument::lib): New.
8798         (Input_argument::is_lib): New.
8799         (Input_file_lib): New.
8800         (Input_arguments::in_lib_): New.
8801         (Input_arguments::in_lib): New.
8802         (Input_arguments::start_lib): New.
8803         (Input_arguments::end_lib_): New.
8804         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8805         in unused members as preempted.
8806         (Sized_pluginobj::do_should_include_member): New.
8807         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8808         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8809         return the blocker.
8810         (Read_symbols::do_whole_lib_group): New.
8811         (Read_symbols::do_lib_group): New.
8812         (Read_symbols::do_read_symbols): Handle lib groups.
8813         (Read_symbols::get_name): Handle lib groups.
8814         * readsyms.h (Read_symbols): Add an archive member pointer.
8815         (Read_symbols::do_whole_lib_group): New.
8816         (Read_symbols::do_lib_group): New.
8817         (Read_symbols::member_): New.
8818         * script.cc (read_input_script): Update call to queue_soon.
8819
8820 2010-03-19  Doug Kwan  <dougkwan@google.com>
8821
8822         * arm.cc (Stub_table::Stub_table): Initialize new data members
8823         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8824         (Stub_table::add_reloc_stub): Assign stub offset and update
8825         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8826         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8827         New data members.
8828         (Stub_table::update_data_size_and_addralign): Use
8829         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8830         instead of going over all reloc stubs.
8831         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8832         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8833         Stringpool_template::offset_ to size of Stringpool_char.
8834         (Stringpool_template::new_key_offset): Remove code to initialize
8835         Stringpool_template::offset_.
8836         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8837         Stringpool_template::offset_ to zero.
8838
8839 2010-03-15  Doug Kwan  <dougkwan@google.com>
8840
8841         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8842         offset_.
8843         (Stringpool_template::new_key_offset): New method.
8844         (Stringpool_template::add_string): Assign offsets when adding new
8845         strings.
8846         (Stringpool_template::set_string_offsets): Do not set string offsets
8847         when not optimizing.
8848         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8849         member size_.
8850         (Chunked_vector::clear): Clear size_.
8851         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8852         (Chunked_vector::size): Return size_.
8853         (Chunked_vector::push_back): Use size_ to find insert position.
8854         (Chunked_vector::size_): New data member.
8855         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8856         (Stringpool_template::new_key_offset): New method declaration.
8857         (Stringpool_template::offset_): New data member.
8858
8859 2010-03-15   Rafael Espindola  <espindola@google.com>
8860
8861         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8862         Add_symbols' constructor.
8863         * readsyms.h (Add_symbols): Remove the input_group member.
8864
8865 2010-03-10  Ian Lance Taylor  <iant@google.com>
8866
8867         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8868         target to ask whether a reference to a symbol requires a stack
8869         split.
8870         * target.h (Target::is_call_to_non_split): New function.
8871         (Target::do_is_call_to_non_split): Declare virtual function.
8872         * target.cc: Include "symtab.h".
8873         (Target::do_is_call_to_non_split): New function.
8874         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8875
8876 2010-03-10  Cary Coutant  <ccoutant@google.com>
8877
8878         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8879         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8880         (File_read::open[2]): Add whole_file_view_ to list of views.
8881         (File_read::make_view): Remove test of whole_file_view_.
8882         (File_read::find_or_make_view): Create whole_file_view_ if
8883         necessary.
8884         (File_read::clear_views): Replace bool parameter with enum;
8885         adjust all callers.  Don't delete views with permanent data;
8886         do delete cached views and views from archives if
8887         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8888         if clearing the corresponding view.
8889         * fileread.h (File_read::Clear_views_mode): New enum.
8890         (File_read::View::is_permanent_view): New method.
8891         (File_read::clear_views): Replace bool parameter
8892         with enum; adjust all callers.
8893         * options.h (General_options): Change keep_files_mapped option;
8894         add map_whole_files.
8895         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8896         releasing the file.
8897         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8898         the file.
8899
8900 2010-03-10  David S. Miller  <davem@davemloft.net>
8901
8902         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8903
8904 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8905
8906         * icf.cc (get_section_contents): Add '@' marker after processing the
8907         merge reloc.
8908
8909 2010-03-08  Doug Kwan  <dougkwan@google.com>
8910
8911         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8912         due to a conversion warning.
8913         (Arm_relobj::update_output_local_symbol_count): Check for local
8914         symbol with unset output index.
8915
8916 2010-03-05  Ian Lance Taylor  <iant@google.com>
8917
8918         * options.h (class General_options): Add --spare-dynamic-tags.
8919         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8920         --spare-dynamic-tags.
8921
8922 2010-03-05  Ian Lance Taylor  <iant@google.com>
8923
8924         * incremental.cc: Include "libiberty.h".
8925
8926 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8927
8928         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8929         function, is_info_ member.
8930         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8931         (Versions::Versions): Update caller.
8932         (Versions::define_base_version): Likewise.
8933         (Versions::add_def): Likewise.
8934
8935 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8936
8937         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8938         (Scan::possible_function_pointer_reloc): New function.
8939         (Scan::local_reloc_may_be_function_pointer): Change to call
8940         possible_function_pointer_reloc.
8941         (Scan::global_reloc_may_be_function_pointer): Ditto.
8942         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8943         relocations in ".data.rel.ro._ZTV" section.
8944         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8945         * testsuite/icf_safe_so_test.cc: Ditto.
8946         * testsuite/icf_safe_test.cc: Ditto.
8947         * testsuite/icf_safe_test.sh: Ditto.
8948
8949 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8950             Ian Lance Taylor  <iant@google.com>
8951
8952         * target-reloc.h (relocate_section): Check the symbol table index
8953         for -1U before setting the local symbol index.
8954         (scan_relocatable_relocs): If copying the relocation, record that
8955         the local symbol is required.
8956         * object.h (Symbol_value::is_output_symtab_index_set): New
8957         function.
8958         (Symbol_value::may_be_discarded_from_output_symtab): New
8959         function.
8960         (Symbol_value::has_output_symtab_entry): New function.
8961         (Symbol_value::needs_output_symtab_entry): Remove.
8962         (Symbol_value::output_symtab_index): Make sure the symbol index is
8963         set.
8964         (Symbol_value::set_output_symtab_index): Make sure the symbol
8965         index is not set.  Make sure the new index is valid.
8966         (Symbol_value::set_must_have_output_symtab_entry): New function.
8967         (Symbol_value::has_output_dynsym_entry): New function.
8968         (Symbol_value::set_output_dynsym_index): Make sure the new index
8969         is valid.
8970         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8971         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8972         local symbol if permitted.
8973         (Sized_relobj::do_finalize_local_symbols): Call
8974         is_output_symtab_index_set rather than needs_output_symtab_entry.
8975         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8976         rather than needs_output_symtab_entry.  Call
8977         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8978         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8979         is_output_symtab_index_set rather than needs_output_symtab_entry.
8980         * testsuite/discard_locals_relocatable_test.c: New file.
8981         * testsuite/discard_locals_test.sh: Test -r.
8982         * testsuite/Makefile.am (check_DATA): Add
8983         discard_locals_relocatable_test1.syms,
8984         discard_local_relocatable_test2.syms.
8985         (MOSTLYCLEANFILES): Likewise.  Also add
8986         discard_locals_relocatable_test1.lout and
8987         discard_locals_relocatable_test2.out.
8988         (discard_locals_relocatable_test1.syms): New target.
8989         (discard_locals_relocatable_test.o): New target.
8990         (discard_locals_relocatable_test1.out): New target.
8991         (discard_locals_relocatable_test2.syms): New target.
8992         (discard_locals_relocatable_test2.out): New target.
8993         (various): Add missing ../ld-new dependencies.
8994         * testsuite/Makefile.in: Rebuild.
8995
8996 2010-03-03  Nick Clifton  <nickc@redhat.com>
8997
8998         * po/fi.po: New Finnish translation.
8999
9000 2010-03-01  Doug Kwan  <dougkwan@google.com>
9001
9002         * layout.cc (Layout::Layout): Force section types of .init_array*,
9003         .preinit_array* and .fini_array* sections.
9004         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9005         Fix check of return value of std::string::find.().
9006         (Output_section::Input_section_sort_compare::operator()): Remove
9007         comment about .init_array.
9008         (Output_section::Input_section_sort_init_fini_compare::operator()):
9009         New method.
9010         (Output_section::sort_attached_input_sections): Handle .init_array
9011         and .fini_array specially.
9012         * output.h (Output_section::Inut_section_sort_compare): Update
9013         comment.
9014         (Output_section::Input_section_sort_init_fini_compare): New struct.
9015
9016 2010-02-26  Doug Kwan  <dougkwan@google.com>
9017
9018         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9019         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9020         * testsuite/debug_msg.sh: Avoid matching source line number for
9021         use of global variable undef_int.
9022
9023 2010-02-26  Doug Kwan  <dougkwan@google.com>
9024
9025         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9026         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9027         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9028         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9029         * options.cc (General_options::General_options): Initialize member
9030         fix_v4bx_.
9031         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9032         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9033         and rm_no_fix_v4bx.stdout
9034         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9035         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9036         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9037         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9038         and arm_no_fix_v4bx.
9039         * Makefile.in: Regenerate.
9040         * testsuite/arm_fix_v4bx.s: New file.
9041         * testsuite/arm_fix_v4bx.sh: Ditto.
9042
9043 2010-02-24  Doug Kwan  <dougkwan@google.com>
9044
9045         * arm.cc (Target_arm::got_section): Make the .got section the first
9046         non RELRO section in the data segment.
9047         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9048         suffixes of section names.
9049
9050 2010-02-24  Doug Kwan  <dougkwan@google.com>
9051
9052         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9053         flags and attributes merging if an input file is a binary file.
9054         * fileread.cc (Input_file::open): Record format of original file.
9055         * fileread.h (Input_file::Format): New enum type.
9056         (Input_file::Input_file): Initialize data member format_.
9057         (Input_file::format): New method definition.
9058         (Input_file::format_):: New data member.
9059
9060 2010-02-24  Doug Kwan  <dougkwan@google.com>
9061
9062         * arm.cc (Arm_output_data_got): New class.
9063         (ARM_TCB_SIZE): New constant
9064         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9065         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9066         If user uses a script with a SECTIONS clause, issue only a warning
9067         for a misplaced EXIDX input section.  Otherwise, issue an error.
9068         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9069         garbage collection.
9070         (Target_arm::got_mode_index_entry): Handle static linking.
9071         (Target_arm::Scan::local): Ditto.
9072         (Target_arm::Scan::global): Ditto.
9073         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9074         all incorrectly implemented relocations.
9075         (Target_arm::fix_exidx_coverage): Pass layout to
9076         Arm_output_section::fix_exidx_coverage.
9077         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9078         from ".ARM.exidx." and ".ARM.extab.".
9079
9080 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9081
9082         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9083         section if it does not already exist.
9084         * attributes.cc (Attributes_section_data::Attributes_section_data):
9085         Don't crash if size is zero.
9086
9087 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9088             Ian Lance Taylor  <iant@google.com>
9089
9090         * gold.cc (queue_middle_tasks): If no input files were opened,
9091         exit.
9092         * workqueue.h (Task_function::Task_function): Assert that there is
9093         a blocker.
9094
9095 2010-02-22  Doug Kwan  <dougkwan@google.com>
9096
9097         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9098         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9099         types to avoid warnings due to different uint64_t implementations
9100         on different hosts.
9101
9102 2010-02-21  Doug Kwan  <dougkwan@google.com>
9103
9104         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9105         handling of the maximum backward branch offset.
9106         (Arm_relocate_functions::thumb_branch_common): Ditto.
9107         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9108         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9109         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9110         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9111         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9112         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9113         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9114         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9115         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9116         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9117         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9118         thumb2_bl_out_of_range.o): New rules.
9119         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9120         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9121         thumb2_bl_out_of_range
9122         * testsuite/Makefile.in: Regenerate.
9123         * testsuite/arm_bl_in_range.s: New file.
9124         * testsuite/arm_bl_out_of_range.s: Ditto.
9125         * testsuite/arm_branch_in_range.sh: Ditto.
9126         * testsuite/arm_branch_range.t: Ditto.
9127         * testsuite/thumb2_branch_range.t: Ditto.
9128         * testsuite/thumb_bl_in_range.s: Ditto.
9129         * testsuite/thumb_bl_out_of_range.s: Ditto.
9130         * testsuite/thumb_branch_range.t: Ditto.
9131
9132 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9133
9134         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9135         Add reloc offset information.
9136         * icf.cc (get_section_contents): Change iterators to point to the new
9137         vectors. Add reloc offset information to the contents.
9138         * icf.h (Icf::Sections_reachable_info): New typedef.
9139         (Icf::Sections_reachable_list): New typedef.
9140         (Icf::Offset_info): New typedef.
9141         (Icf::Reloc_info): New struct typedef.
9142         (Icf::Reloc_info_list): New typedef.
9143         (Icf::symbol_reloc_list): Delete method.
9144         (Icf::addend_reloc_list): Delete method.
9145         (Icf::section_reloc_list): Delete method.
9146         (Icf::reloc_info_list): New method.
9147         (Icf::reloc_info_list_): New member.
9148
9149 2010-02-19  Doug Kwan  <dougkwan@google.com>
9150
9151         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9152         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9153         * arm.cc (Arm_relocation_functions): New forward declaration.
9154         (Target_arm::Target_arm): Initialize new data members
9155         got_mod_index_offset_ and tls_base_symbol_defined_.
9156         (Target_arm::Relocate::relocate_tls): New method.
9157         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9158          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9159         New methods.
9160         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9161         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9162         (Target_arm::got_mod_index_offset_,
9163         Target_arm::tls_base_symbol_defined_): New data members.
9164         (Target_arm::Scan::local, Target::Scan::global,
9165         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9166         relocations.
9167
9168 2010-02-18  Doug Kwan  <dougkwan@google.com>
9169
9170         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9171         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9172         text section as a parameter becuase some broken tools may not set
9173         the link in section header.
9174         (Target_arm::has_got_section): New method.
9175         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9176         without any mapping symbol as data only.  Remove warning.
9177         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9178         link in its section header, try to discover the link by inspecting the
9179         REL31 relocation at the beginning of the section.
9180         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9181         in error message.
9182         (Target_arm::Scan::global): Treat any reference to the symbol
9183         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9184
9185 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9186
9187         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9188         (Scan::global_reloc_may_be_function_pointer): New function.
9189         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9190         (Scan::global_reloc_may_be_function_pointer): New function.
9191         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9192         (Scan::global_reloc_may_be_function_pointer): New function.
9193         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9194         (Scan::global_reloc_may_be_function_pointer): New function.
9195         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9196         (Scan::global_reloc_may_be_function_pointer): New function.
9197         (Scan::possible_function_pointer_reloc): New function.
9198         (Target_x86_64::can_check_for_function_pointers): New function.
9199         * gc.h (gc_process_relocs): Scan relocation types to determine if
9200         function pointers were taken for targets that support it.
9201         * icf.cc (Icf::find_identical_sections): Include functions for
9202         folding in safe ICF whose pointer is not taken.
9203         * icf.h (Secn_fptr_taken_set): New typedef.
9204         (fptr_section_id_): New member.
9205         (section_has_function_pointers): New function.
9206         (set_section_has_function_pointers): New function.
9207         (check_section_for_function_pointers): New function.
9208         * options.h: Fix comment for safe ICF option.
9209         * target.h (can_check_for_function_pointers): New function.
9210         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9211         Modify icf_safe_test for X86-64.
9212         * testsuite/Makefile.in: Regenerate.
9213         * testsuite/icf_safe_so_test.cc: New file.
9214         * testsuite/icf_safe_so_test.sh: New file.
9215         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9216         (main): Change to take pointer to function kept_func_3.
9217         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9218         folding is done correctly for X86-64.
9219
9220 2010-02-12  David S. Miller  <davem@davemloft.net>
9221
9222         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9223         is_symbolless parameter.
9224         (Output_reloc<SHT_REL>::is_symbolless): New.
9225         (Output_reloc<SHT_REL>::is_symbolless_): New.
9226         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9227         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9228         (Output_reloc<SHT_RELA>::is_symbolless): New.
9229         (Output_data_reloc::add_global): Handle is_symbolless.
9230         (Output_data_reloc::add_global_relative): Likewise.
9231         (Output_data_reloc::add_local): Likewise.
9232         (Output_data_reloc::add_local_relative): Likewise.
9233         (Output_data_reloc::add_symbolless_global_addend): New.
9234         (Output_data_reloc::add_symbolless_local_addend): New.
9235         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9236         is_symbolless.
9237         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9238         instead of ->is_relative_
9239         (Output_reloc::write): Likewise.
9240         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9241         (Output_reloc::write_rel): Simplify.
9242
9243         * sparc.cc (Target_sparc::Scan::local): Use
9244         ->add_symbolless_local_addend as needed.
9245         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9246         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9247         based upon relocation offset.
9248
9249 2010-02-11  Doug Kwan  <dougkwan@google.com>
9250
9251         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9252         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9253         beginning of function.
9254         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9255         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9256         parameter is_32bit in calls to should_apply_static_reloc.
9257         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9258         (check_DATA): Add arm_abs_global.stdout.
9259         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9260         arm_abs_global.stdout): New rules.
9261         (MOSTLLYCLEANFILES): Add arm_abs_global
9262         * Makefile.in: Regenerate.
9263         * testsuite/arm_abs_global.s: New file.
9264         * testsuite/arm_abs_global.sh: Ditto.
9265         * testsuite/arm_abs_lib.s: Ditto.
9266
9267 2010-02-11  Ian Lance Taylor  <iant@google.com>
9268
9269         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9270         Read_relocs task.
9271         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9272         Allocate_commons_task first.
9273         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9274         task, rather than symtab_lock_.
9275         (Gc_process_relocs::~Gc_process_relocs): New function.
9276         (Gc_process_relocs::is_runnable): Check this_blocker_.
9277         (Gc_process_relocs::locks): Use next_blocker_ rather than
9278         blocker_.
9279         (Scan_relocs::~Scan_relocs): New function.
9280         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9281         symtab_lock_.
9282         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9283         next_blocker_.
9284         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9285         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9286         constructor accordingly.
9287         (class Gc_process_relocs): Likewise.
9288         (class Scan_relocs): Likewise.
9289         * common.h (class Allocate_commons_task): Remove symtab_lock_
9290         field, and corresponding constructor parameter.
9291         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9292         symtab_lock_.
9293         (Allocate_commons_task::locks): Likewise.
9294
9295 2010-02-11  Ian Lance Taylor  <iant@google.com>
9296
9297         * gold-threads.h (class Once): Define.
9298         (class Initialize_lock): Rewrite as child of Once.
9299         * gold-threads.cc (class Once_initialize): Define.
9300         (once_pointer_control): New static variable.
9301         (once_pointer, once_arg): New static variables.
9302         (c_run_once): New static function.
9303         (Once::Once, Once::run_once, Once::internal_run): New functions.
9304         (class Initialize_lock_once): Remove.
9305         (initialize_lock_control): Remove.
9306         (initialize_lock_pointer): Remove.
9307         (initialize_lock_once): Remove.
9308         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9309         (Initialize_lock::initialize): Rewrite.
9310         (Initialize_lock::do_run_once): New function.
9311         * archive.cc (Archive::interpret_header): Only clear name if it is
9312         not already empty.
9313         * fileread.cc: Include "gold-threads.h"
9314         (file_counts_lock): New static variable.
9315         (file_counts_initialize_lock): Likewise.
9316         (File_read::release): Only increment counts when using --stats.
9317         Use a lock around the increment.
9318         * parameters.cc (class Set_parameters_target_once): Define.
9319         (set_parameters_target_once): New static variable.
9320         (Parameters::Parameters): Move here from parameters.h.
9321         (Parameters::set_target): Rewrite.
9322         (Parameters::set_target_once): New function.
9323         (Parameters::clear_target): Move here and rewrite.
9324         * parameters.h (class Parameters): Update declarations.  Add
9325         set_parameters_target_once_ field.
9326         (Parameters::Parameters): Move to parameters.cc.
9327         (Parameters::clear_target): Likewise.
9328         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9329         task.
9330         (Start_group::~Start_group): New function.
9331         (Start_group::is_runnable): New function.
9332         (Start_group::locks, Start_group::run): New functions.
9333         (Finish_group::run): Change saw_undefined to size_t.
9334         * readsyms.h (class Start_group): Define.
9335         (class Finish_group): Change saw_undefined_ field to size_t.
9336         (Finish_group::Finish_group): Remove saw_undefined and
9337         this_blocker parameters.  Change all callers.
9338         (Finish_group::set_saw_undefined): New function.
9339         (Finish_group::set_blocker): New function.
9340         * symtab.h (class Symbol_table): Change saw_undefined to return
9341         size_t.  Change saw_undefined_ field to size_t.
9342         * target-select.cc (Set_target_once::do_run_once): New function.
9343         (Target_selector::Target_selector): Initialize set_target_once_
9344         field.  Don't initialize lock_ and initialize_lock_ fields.
9345         (Target_selector::instantiate_target): Rewrite.
9346         (Target_selector::set_target): New function.
9347         * target-select.h (class Set_target_once): Define.
9348         (class Target_selector): Update declarations.  Make
9349         Set_target_once a friend.  Remove lock_ and initialize_lock_
9350         fields.  Add set_target_once_ field.
9351
9352 2010-02-10  Ian Lance Taylor  <iant@google.com>
9353
9354         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9355         queueing any tasks.
9356         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9357         (queue_middle_tasks): Add all blockers before queueing any tasks.
9358         (queue_final_tasks): Likewise.
9359         * token.h (Task_token::add_blockers): New function.
9360         * object.h (Input_objects::number_of_relobjs): New function.
9361
9362 2010-02-10  Ian Lance Taylor  <iant@google.com>
9363
9364         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9365         shared, not if not position independent.
9366         * x86_64.cc (Relocate::relocate_tls): Likewise.
9367         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9368         (tls_pie_pic_test): New target.
9369         * testsuite/Makefile.in: Rebuild.
9370
9371         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9372         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9373         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9374         * testsuite/Makefile.in: Rebuild.
9375
9376 2010-02-09  David S. Miller  <davem@davemloft.net>
9377
9378         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9379         R_SPARC_RELATIVE using ->add_local_relative().
9380         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9381
9382         * output.h (Output_data_dynamic::add_section_size): New method
9383         that takes two Output_data objects.
9384         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9385         entry param.  Handle it in initializers.
9386         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9387         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9388         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9389         arg.
9390         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9391         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9392         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9393         for dynrel_includes_plt.
9394         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9395         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9396         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9397         before .rela.plt
9398         (Target_sparc::do_finalize_sections): Update to pass true for
9399         dynrel_includes_plt.
9400         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9401         output before .rela.plt
9402         (Target_powerpc::do_finalize_sections): Update to pass true for
9403         dynrel_includes_plt when 32-bit.
9404
9405 2010-02-08  Doug Kwan  <dougkwan@google.com>
9406
9407         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9408         method.
9409         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9410         Arm_relobj::scan_section_for_cortex_a8_stubs,
9411         Arm_relobj::do_relocation_section): Instead of calling
9412         Output_section::output_address, use faster
9413         Arm_relobj::simple_input_section_output_address.
9414
9415 2010-02-08  David S. Miller  <davem@davemloft.net>
9416
9417         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9418         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9419         relocation helper function.
9420
9421         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9422         just like R_SPARC_GOT{10,13,22}.
9423         (Target_sparc::Scan::local): Likewise.
9424         (Target_sparc::Relocate:relocate): Likewise.
9425
9426 2010-02-06  Ian Lance Taylor  <iant@google.com>
9427
9428         * configure.ac: Rewrite targetobjs duplicate removal code to use
9429         only shell constructs.
9430         * configure: Rebuild.
9431
9432 2010-02-05  Doug Kwan  <dougkwan@google.com>
9433
9434         PR 11247
9435         * arm.cc (Arm_relobj::section_is_scannable): New method.
9436         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9437         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9438
9439 2010-02-04  Doug Kwan  <dougkwan@google.com>
9440
9441         PR 11247
9442         * arm-reloc-property.cc (cstdio): Include.
9443         * configure.ac (targetobjs): Remove duplicates.
9444         * configure: Regenerate.
9445         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9446         big and little endian version for a given address size.
9447
9448 2010-02-03  Doug Kwan  <dougkwan@google.com>
9449
9450         * arm-reloc-property.cc
9451         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9452         definition.
9453         * arm-reloc-property.h
9454         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9455         New method definition.
9456         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9457         declaration.
9458         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9459         overflow to N.
9460         (GOT_PREL): Change implemented to Y.
9461         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9462         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9463         (Arm_relocate_functions::movw_abs_nc): Remove method.
9464         (Arm_relocate_functions::movt_abs): Ditto.
9465         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9466         (Arm_relocate_functions::thm_movt_abs): Ditto.
9467         (Arm_relocate_functions::movw_rel_nc): Ditto.
9468         (Arm_relocate_functions::movw_rel): Ditto.
9469         (Arm_relocate_functions::movt_rel): Ditto.
9470         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9471         (Arm_relocate_functions:thm_movw_rel): Ditto.
9472         (Arm_relocate_functions:thm_movt_rel): Ditto.
9473         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9474         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9475         New method definitions.
9476         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9477         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9478         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9479         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9480         (Target_arm::Relocate::relocate): Check for non-static or
9481         unimplemented relocation code and exit early.  Change calls to
9482         Target_arm::reloc_uses_thumb_bit and
9483         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9484         instead.  Refactor code to handle similar relocations to increase
9485         code sharing.  Remove check for unsupported relocation code in switch
9486         statement.
9487         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9488         relocation property table to find out size.  Change error message to
9489         print out the name of a relocation code instead of the numeric value.
9490         (Target_arm::scan_reloc_for_stub): Use relocation property table
9491         instead of calling Target_arm::reloc_uses_thumb_bit().
9492
9493 2010-02-02  Doug Kwan  <dougkwan@google.com>
9494
9495         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9496         types of relaxed input section.
9497
9498 2010-02-02  Doug Kwan  <dougkwan@google.com>
9499
9500         * Makefile.am (HFILES): Add arm-reloc-property.h.
9501         (DEFFILES): New.
9502         (TARGETSOURCES): Add arm-reloc-property.cc
9503         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9504         (libgold_a_SOURCES): $(DEFFILES)
9505         * Makefile.in: Regenerate.
9506         * arm-reloc-property.cc: New file.
9507         * arm-reloc-property.h: New file.
9508         * arm-reloc.def: New file.
9509         * arm.cc: Update comments.
9510         (arm-reloc-property.h): New included header.
9511         (arm_reloc_property_table): New global variable.
9512         (Target_arm::do_select_as_default_target): New method definition.
9513         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9514         arm-reloc-property to targ_extra_obj.
9515         * parameters.cc (set_parameters_target): Call
9516         Target::select_as_default_target().
9517         * target.h (Target::select_as_default_target): New method definition.
9518         (Target::do_select_as_default_target): Same.
9519
9520 2010-02-01  Doug Kwan  <dougkwan@google.com>
9521
9522         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9523         first_output_text_section_.
9524         (Arm_exidx_fixup::first_output_text_section): New method definition.
9525         (Arm_exidx_fixup::first_output_text_section_): New data member.
9526         (Arm_exidx_fixup::process_exidx_section): Record the first text
9527         output section seen.
9528         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9529         and entsize in output section header.
9530
9531 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9532
9533         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9534         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9535         (Arm_relocate_functions::thm_alu11): New Method.
9536         (Arm_relocate_functions::thm_pc8): New Method.
9537         (Arm_relocate_functions::thm_pc12): New Method.
9538         (Target_arm::Scan::local): Handle the relocations.
9539         (Target_arm::Scan::global): Likewise.
9540         (Target_arm::Relocate::relocate): Likewise.
9541         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9542
9543 2010-01-29  Doug Kwan  <dougkwan@google.com>
9544
9545         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9546         of relocation types as ld.
9547
9548 2010-01-29  Doug Kwan  <dougkwan@google.com>
9549
9550         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9551         to public.
9552         (Arm_relocate_functions::thumb_branch_common): Ditto.
9553         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9554         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9555         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9556         Arm_relocate_functions::jump24): Remove.
9557         (Target_arm::Relocate::relocate): Adjust code to call
9558         Arm_relocation_functions::arm_branch_common and
9559         Arm_relocation_functions::thumb_branch_common instead of their removed
9560         wrappers.  Merge switch-cases together to reduce source code size.
9561
9562 2010-01-29  Doug Kwan  <dougkwan@google.com>
9563
9564         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9565         output_local_symbol_count_needs_update_.
9566         (Arm_relobj::output_local_symbol_count_needs_update,
9567          Arm_relobj::set_output_local_symbol_count_needs_update,
9568          Arm_relobj::update_output_local_symbol_count): New methods.
9569         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9570         member.
9571         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9572         of pointed function as in a R_ARM_PREL31 relocation.
9573         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9574         for output local symbol count updating.
9575         (Target_arm::do_relax): Update output local symbol counts in objects
9576         if necessary.
9577         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9578
9579 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9580
9581         * arm.cc: Added support for the ARM relocations:
9582         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9583         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9584         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9585         movw_prel_nc).
9586         (Arm_relocate_functions::movw_rel): New method.
9587         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9588         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9589         thm_movw_prel_nc).
9590         (Arm_relocate_functions::thm_movw_rel): New method.
9591         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9592         thm_movt_prel).
9593         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9594         relocations.
9595         (Target_arm::Scan::global): Likewise.
9596         (Target_arm::Relocate::relocate): Likewise.
9597         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9598         Likewise.
9599
9600 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9601
9602         * arm.cc: Added support for ARM group relocations.
9603         (Target_arm::reloc_needs_sym_origin): New method.
9604         (Arm_relocate_functions::calc_grp_kn): New method.
9605         (Arm_relocate_functions::calc_grp_residual): New method.
9606         (Arm_relocate_functions::calc_grp_gn): New method.
9607         (Arm_relocate_functions::arm_grp_alu): New Method.
9608         (Arm_relocate_functions::arm_grp_ldr): New Method.
9609         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9610         (Arm_relocate_functions::arm_grp_ldc): New Method.
9611         (Target_arm::Scan::local): Handle the ARM group relocations.
9612         (Target_arm::Scan::global): Likewise.
9613         (Target_arm::Relocate::relocate): Likewise.
9614         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9615         Likewise.
9616
9617 2010-01-26  Doug Kwan  <dougkwan@google.com>
9618
9619         * arm.cc (set): Include.
9620         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9621         pointer type.
9622         (Arm_output_section::Text_section_list): New type.
9623         (Arm_output_section::append_text_sections_to_list): New method.
9624         (Arm_output_section::fix_exidx_coverage): Ditto.
9625         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9626         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9627         Relobj::set_section_offset() instead of
9628         Sized_relobj::invalidate_section_offset().
9629         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9630         parameter for section headers. Ignore relocation sections for
9631         unallocated sections and EXIDX sections.
9632         (Target_arm::fix_exidx_coverage): New method.
9633         (Target_arm::output_section_address_less_than): New type.
9634         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9635         linked text section instead of the EXIDX section.
9636         (Arm_output_section::create_stub_group): Add an assertion to check
9637         that this is not an EXIDX output section.
9638         (Arm_output_section::append_text_sections_to_list): New method.
9639         (Arm_output_section::fix_exidx_coverage): Ditto.
9640         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9641         Arm_relobj::section_needs_reloc_stub_scanning.
9642         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9643         first pass.
9644         (Target_arm::fix_exidx_coverage): New method.
9645         * object.h (Relobj::set_output_section): New method.
9646         (Sized_relobj::invalidate_section_offset): Remove method.
9647         (Sized_relobj::do_invalidate_section_offset): Remove method.
9648         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9649
9650 2010-01-25  Doug Kwan  <dougkwan@google.com>
9651
9652         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9653         Fix warning due to signed and unsigned comparison on a 32-bit host.
9654
9655 2010-01-22  Doug Kwan  <dougkwan@google.com>
9656
9657         * arm.cc (Target_arm::do_relax): Record an output section for section
9658         offset adjustment it contains any stub table that has changed.
9659         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9660         offsets in an output section if necessary.
9661         * output.cc (Output_section::Output_section): Initialize
9662         section_offsets_need_adjustments_.
9663         (Output_section::add_input_section_for_script): Renamed to
9664         Output_section::add_simple_input_section.
9665         (Output_section::save_states): Add a comment.
9666         (Output_section::discard_states): New method defintion.
9667         (Output_section::adjust_section_offsets): Same.
9668         * output.h (Output_section::add_input_section_for_script): Renamed to
9669         Output_section::add_simple_input_section.
9670         (Output_section::discard_states): New method declaration.
9671         (Output_section::adjust_section_offsets): Same.
9672         (Output_section::section_offsets_need_adjustment,
9673         Output_section::set_section_offsets_need_adjustment): New method
9674         definitions.
9675         (Output_section::section_offsets_need_adjustment_): New data member.
9676         * script-sections.cc
9677         (Output_section_element_input::set_section_address): Adjust code for
9678         renaming of Output_section::add_input_section_for_script.
9679         (Orphan_output_section::set_section_address): Same.
9680
9681 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9682
9683         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9684         Fix_v4bx enum values .
9685         * gold/options.h (General_options): New option definitions.
9686         (General_options::fix_v4bx): New method.
9687         (General_options::Fix_v4bx): New enum.
9688         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9689         (General_options::parse_fix_v4bx_interworking): New method.
9690
9691 2010-01-22  Doug Kwan  <dougkwan@google.com>
9692
9693         * arm.cc (Arm_exidx_fixup): New class.
9694
9695 2010-01-21  Doug Kwan  <dougkwan@google.com>
9696
9697         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9698         classes.
9699         (Arm_exidx_section_offset_map): New type.
9700
9701 2010-01-21  Doug Kwan  <dougkwan@google.com>
9702
9703         * arm.cc (Arm_exidx_input_section): New class.
9704         (Arm_relobj::exidx_input_section_by_link,
9705         Arm_relobj::exidx_input_section_by_shndx,
9706         Arm_relobj::make_exidx_input_section): New methods.
9707         (read_arm_attributes_section): Remove.
9708         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9709         information about them.
9710         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9711         to here.
9712
9713 2010-01-20  Doug Kwan  <dougkwan@google.com>
9714
9715         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9716         Input_section_specifier to Section_id.
9717         (Target_arm::new_arm_input_section: Adjust code for change of key
9718         type.
9719         (Target_arm::find_arm_input_section): Ditto.
9720         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9721         (Section_id): Remove.
9722         (Garbage_collection::Section_id_hash): Remove.
9723         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9724         (Section_id): Remove.
9725         (Icf::Section_id_hash): Remove.
9726         * object.h (Section_id, Const_section_id, Section_id_hash,
9727         Const_section_id_hash): New type definitions.
9728         * output.cc (Output_section::add_relaxed_input_section): Change to
9729         use Const_section_id instead of Input_section_specifier as key type.
9730         (Output_section::add_merge_input_section): Ditto.
9731         (Output_section::build_relaxation_map): Change to use Section_id
9732         instead of Input_section_specifier as key type.
9733         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9734         Ditto.
9735         (Output_section::convert_input_sections_to_relaxed_sections): Change
9736         to use Const_section_id instead of Input_section_specifier as key type.
9737         (Output_section::find_merge_section): Ditto.
9738         (Output_section::find_relaxed_input_section): Ditto.
9739         * output.h (Input_section_specifier): Remove class.
9740         (Output_section::Output_section_data_by_input_section_map): Change
9741         key type to Const_section_id.
9742         (Output_section::Output_relaxed_input_section_by_input_section_map):
9743         Ditto.
9744         (Output_section::Relaxation_map): Change key type to Section_id.
9745
9746 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9747
9748         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9749         (class Arm_v4bx_stub): New class.
9750         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9751         (Stub_factory::make_arm_v4bx_stub): New method.
9752         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9753         (Stub_table::empty): Handle v4bx stubs.
9754         (Stub_table::add_arm_v4bx_stub): New method.
9755         (Stub_table::find_arm_v4bx_stub): New method.
9756         (Arm_relocate_functions::v4bx): New method.
9757         (Target_arm::fix_v4bx): New method.
9758         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9759         (Stub_table::relocate_stubs): Likewise.
9760         (Stub_table::do_write): Likewise.
9761         (Stub_table::update_data_size_and_addralign): Likewise.
9762         (Stub_table::finalize_stubs):  Likewise.
9763         (Target_arm::Scan::local): Likewise.
9764         (Target_arm::Scan::global): Likewise.
9765         (Target_arm::do_finalize_sections): Likewise.
9766         (Target_arm::Relocate::relocate): Likewise.
9767         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9768         Likewise.
9769         (Target_arm::scan_reloc_for_stub): Likewise.
9770         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9771
9772 2010-01-19  Ian Lance Taylor  <iant@google.com>
9773
9774         * output.cc (Output_section_headers::do_sized_write): Write large
9775         segment count to sh_info field.
9776         (Output_file_header::do_sized_write): For large segment count,
9777         write PN_XNUM to e_phnum field.
9778
9779 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9780
9781         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9782         (Arm_relocate_functions::thm_jump8): New function.
9783         (Arm_relocate_functions::thm_jump11): New function.
9784         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9785         R_ARM_THM_JUMP11.
9786         (Target_arm::Scan::global): Likewise.
9787         (Target_arm::Relocate::relocate): Likewise.
9788         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9789         Likewise.
9790
9791 2010-01-14  Doug Kwan  <dougkwan@google.com>
9792
9793         * arm.cc (map, utility): Include headers.
9794         (Target_arm::apply_cortex_a8_workaround): New method.
9795         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9796         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9797         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9798         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9799         the --[no-]fix-cortex-a8 command line options.
9800         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9801         (Target_arm::relocate_stub): Use addend in instruction template.
9802         * options.h (DEFINE_bool): Set the user-set flag.
9803         (General_options): Add --[no-]-fix-cortex options.
9804         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9805         : Update fast look-up map after conversion.
9806
9807 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9808
9809         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9810         in the first pass of do_layout.
9811
9812 2010-01-13  Doug Kwan  <dougkwan@google.com>
9813
9814         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9815         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9816         apparent compiler problem of not folding static constant integral
9817         data members of elfcpp::Elf_sizes<32>.
9818
9819 2010-01-13  Doug Kwan  <dougkwan@google.com>
9820
9821         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9822         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9823         Arm_relobj::scan_section_for_cortex_a8_erratum,
9824         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9825         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9826         sections to scan for relocation stubs into a new method
9827         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9828         relocation and Cortex-A8 stub scanning.
9829         (Target_arm::do_relax): Force stubs to be after stubbed sections
9830         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9831         the beginning of a new relaxation pass.  Update a comment.
9832         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9833
9834 2010-01-12  Ian Lance Taylor  <iant@google.com>
9835
9836         * target-reloc.h (visibility_error): New inline function.
9837         (relocate_section): Call visibility_error.
9838         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9839         (MOSTLYCLEANFILES): Likewise.
9840         (protected_4_pic.o, protected_3.err): New targets.
9841         * testsuite/protected_4.cc: New file.
9842
9843 2010-01-12  Doug Kwan  <dougkwan@google.com>
9844
9845         * arm.cc (Cortex_a8_reloc): New class.
9846         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9847         and cortex_a8_relocs_info_.
9848         (Target_arm::fix_cortex_a8): New method definition.
9849         (Target_arm::Cortex_a8_relocs_info): New type.
9850         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9851         New data member declarations.
9852         (Target_arm::scan_reloc_for_stub): Record information about
9853         relocations for THUMB branches that might be exempted from the
9854         Cortex-A8 workaround.
9855         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9856         at the beginning of a relaxation pass.
9857
9858 2010-01-12  Doug Kwan  <dougkwan@google.com>
9859
9860         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9861         (Arm_relobj::Mapping_symbol_position,
9862          Arm_reloj::Mapping_symbol_position_less,
9863          Arm_relobj::Mapping_symbols_info): New types.
9864         (Target_arm::is_mapping_symbol_name): New method definition.
9865         (Arm_relobj::do_count_local_symbols): Save information about mapping
9866         symbols.
9867
9868 2010-01-11  Doug Kwan  <dougkwan@google.com>
9869
9870         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9871         Arm_relocate_functions::thumb32_branch_upper,
9872         Arm_relocate_functions::thumb32_branch_lower,
9873         Arm_relocate_functions::thumb32_cond_branch_offset,
9874         Arm_relocate_functions::thumb32_cond_branch_upper,
9875         Arm_relocate_functions::thumb32_cond_branch_lower,
9876         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9877         branch offset encoding.
9878         (Arm_relocate_functions::thumb_branch_common): Use new branch
9879         offset encoding methods to avoid code duplication.
9880         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9881         (Stub_addend_reader::operator()): Use new branch encoding method
9882         to avoid code duplication.
9883
9884 2010-01-11  Doug Kwan  <dougkwan@google.com>
9885
9886         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9887         (Target_arm::do_finalize_sections): Define special EXIDX section
9888         symbols only if referenced.
9889         * gc.h (Garbage_collection::add_reference): New method.
9890         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9891         code duplication.
9892
9893 2010-01-11  Ian Lance Taylor  <iant@google.com>
9894
9895         * script.cc (Version_script_info::build_expression_list_lookup):
9896         Change complaing about duplicate wildcard match from error to
9897         warning.
9898
9899         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9900         of 2009-12-30.
9901         (Version_script_info::Version_script_info): Initialize globs_,
9902         default_version_, default_is_global_, and exact_.  Don't
9903         initialize globals_ or locals_.
9904         (Version_script_info::build_lookup_tables): Build local symbols
9905         first.
9906         (Version_script_info::unquote): New function.
9907         (Version_script_info::add_exact_match): New function.
9908         (Version_script_info::build_expression_list_lookup): Remove lookup
9909         parameter.  Add is_global parameter.  Change all callers.  Handle
9910         wildcard pattern specially.  Unquote pattern.  Call
9911         add_exact_match.
9912         (Version_script_info::get_name_to_match): New function.
9913         (Version_script_info::get_symbol_version): New function.
9914         (Version_script_info::get_symbol_version_helper): Remove.
9915         (Version_script_info::check_unmatched_names): Call unquote.
9916         * script.h (class Version_script_info): Change get_symbol_version
9917         to be non-inline and add is_global parameter; change all callers.
9918         Rewrite symbol_is_local.  Update declarations.  Define struct
9919         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9920         Remove globals_ and locals_ members.  Add exact_, globs_,
9921         default_version_, is_global_.
9922         (Version_script_info::Glob): Remove pattern, add expression and
9923         is_global.  Update constructor.  Change all callers.
9924         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9925         default version.
9926         (Versions::symbol_section_contents): If a symbol is undefined, or
9927         defined in a dynamic object, set the version index to
9928         VER_NDX_LOCAL.
9929         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9930         symbol_is_local.
9931         (Symbol_table::add_from_pluginobj): Likewise.
9932         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9933
9934 2010-01-11  Doug Kwan  <dougkwan@google.com>
9935
9936         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9937         (incremental_dump_LDADD): Add linking option for libintl.
9938         * Makefile.in: Regenerate.
9939
9940 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9941
9942         PR gold/11144
9943         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9944         instead of -Ds.
9945         * testsuite/Makefile.in: Regenerated.
9946
9947 2010-01-10  Doug Kwan  <dougkwan@google.com>
9948
9949         * options.h (DEFINE_var): Use parentheses around argument varname__
9950         in macro body to avoid any unintended subsequent substitutions.
9951
9952 2010-01-10  Ian Lance Taylor  <iant@google.com>
9953
9954         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9955         candidates before doing symbol resolution.
9956
9957         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9958         ODR candidates if only one is weak.
9959
9960 2010-01-08  Ian Lance Taylor  <iant@google.com>
9961
9962         * script.cc (Version_script_info::build_expression_list_lookup):
9963         Don't warn about ambiguous version, just record the ambiguity.
9964         (Version_script_info::get_symbol_version_helper): Give error if
9965         version is ambiguous.
9966
9967 2010-01-08  Doug Kwan  <dougkwan@google.com>
9968
9969         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9970         prev_data_size_ and prev_addralign_.  Remove initializer for
9971         deleted data member has_been_changed_.
9972         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9973         to determine if the table is empty.
9974         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9975         Remove.
9976         (Stub_table::add_reloc_stub): Define method in class definition
9977         instead of just declaring it there.
9978         (Stub_table::add_cortex_a8_stub): New method definition.
9979         (Stub_table::update_data_size_and_addralign): Ditto.
9980         (Stub_table::finalize_stubs): Ditto.
9981         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9982         (Stub_table::do_addralign_): Return address alignment in the
9983         (Stub_table::do_reset_address_and_file_offset): Define method in
9984         class definition instead of declaring it there.  Set current data
9985         size to be the data size of the previous pass.
9986         (Stub_table::set_final_data_size): Use current data size as the
9987         final data size.
9988         (Stub_table::relocate_stub): Change parameter type of stub from
9989         Reloc_stub pointer to Stub pointer.
9990         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9991         (Stub_table::Cortex_a8_stub_list): New typedef.
9992         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9993          Stub_table::prev_addralign_): New data member.
9994         (Arm_relobj::Arm_relobj): Initialize data member
9995         section_has_cortex_a8_workaround_.
9996         (Arm_relobj::section_has_cortex_a8_workaround,
9997          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9998          definitions.
9999         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10000         declarations.
10001         (Target_arm::relocate_stub): Change parameter type of stub from
10002         Reloc_stub pointer to Stub pointer.
10003         (Insn_template::size, Insn_template::alignment): Handle
10004         THUMB16_SPECIAL_TYPE.
10005         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10006          Stub_table::update_data_size_and_addralign,
10007          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10008         definitions.
10009         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10010         (Stub_table::do_write): Ditto.
10011         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10012
10013 2010-01-08  Ian Lance Taylor  <iant@google.com>
10014
10015         PR 11108
10016         * symtab.h (class Symbol): Remove fields is_target_special_ and
10017         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10018         (Symbol::is_defined_in_discarded_section): New function.
10019         (Symbol::set_is_defined_in_discarded_section): New function.
10020         (Symbol::has_plt_offset): Rewrite.
10021         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10022         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10023         Don't initialize is_target_special_ or has_plt_offset_.
10024         Initialize is_defined_in_discarded_section_.
10025         (Symbol_table::add_from_relobj): If appropriate, set
10026         is_defined_in_discarded_section.
10027         * resolve.cc (Symbol::override_base_with_special): Don't test
10028         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10029         * target-reloc.h (relocate_section): Do special handling for
10030         symbols defined in discarded sections for global symbols as well
10031         as local symbols.
10032
10033 2010-01-08  Ian Lance Taylor  <iant@google.com>
10034
10035         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10036         the SHT_SYMTAB case.
10037
10038 2010-01-08  Ian Lance Taylor  <iant@google.com>
10039
10040         * object.cc (Sized_relobj::do_layout): Don't get confused if
10041         layout_eh_frame returns NULL.
10042
10043 2010-01-08  Ian Lance Taylor  <iant@google.com>
10044
10045         PR 11084
10046         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10047         dynamic symbol table, use the normal symbol table.
10048         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10049         symbol table.
10050
10051 2010-01-08  Ian Lance Taylor  <iant@google.com>
10052
10053         PR 11072
10054         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10055         sections.
10056
10057 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10058
10059         * version.cc (print_version): Change to "Copyright 2010".
10060
10061 2010-01-08  Ian Lance Taylor  <iant@google.com>
10062
10063         PR 10287
10064         PR 11063
10065         * i386.cc (class Target_i386): Change return type of plt_section
10066         to be non-const.
10067         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10068         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10069         tls_desc_rel_ field.
10070         (Output_data_plt_i386::rel_tls_desc): New function.
10071         (Target_i386::rel_tls_desc_section): New function.
10072         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10073         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10074         R_386_TLS_DESC reloc in rel_tls_desc_section.
10075         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10076         Define struct Tlsdesc_info.
10077         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10078         (Target_x86_64::do_reloc_symbol_index): New function.
10079         (Target_x86_64::add_tlsdesc_info): New function.
10080         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10081         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10082         tlsdesc_rel_ field.
10083         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10084         all callers.
10085         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10086         (Target_x86_64::rela_tlsdesc_section): New function.
10087         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10088         handling.
10089         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10090         (Target_x86_64::do_reloc_addend): New function.
10091         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10092         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10093         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10094         (Output_reloc::type): New function.
10095         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10096         (Output_reloc::is_target_specific): New function.
10097         (Output_reloc::target_arg): New function.
10098         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10099         absolute relocs and target specific relocs.
10100         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10101         add_target_specific.
10102         (class Output_data_reloc) [SHT_RELA]: Likewise.
10103         * output.cc (Output_reloc::Output_reloc): Add four new versions
10104         for absolute relocs and target specific relocs.
10105         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10106         (Output_reloc::get_symbol_index): Likewise.
10107         (Output_reloc::local_section_offset): Check that local_sym_index_
10108         is not TARGET_CODE or 0.
10109         (Output_reloc::symbol_value): Likewise.
10110         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10111         reloc.
10112         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10113         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10114         functions.
10115         * layout.cc (add_target_dynamic_tags): Use output section for
10116         DT_PLTRELSZ and DT_JMPREL.
10117
10118 2010-01-07  Ian Lance Taylor  <iant@google.com>
10119
10120         PR 11061
10121         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10122         function.
10123         (class Output_data_reloc_generic): Define.
10124         (class Output_data_reloc_base): Change base class to
10125         Output_data_reloc_generic.  Change add() method to call
10126         bump_relative_reloc_count for a relative reloc.  Remove
10127         sort_relocs_ field.
10128         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10129         to sort_relocs().
10130         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10131         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10132         appropriate.
10133         * layout.h (class Layout): Update declaration.
10134
10135 2010-01-07  Ian Lance Taylor  <iant@google.com>
10136
10137         * output.h (class Output_data): Add const version of
10138         output_section and do_output_section.
10139         (class Output_section_data): Add const version of
10140         do_output_section.
10141         (class Output_section): Likewise.
10142         * layout.cc (Layout::add_target_dynamic_tags): New function.
10143         * layout.h (class Layout): Update declarations.
10144         * arm.cc (Target_arm::do_finalize_sections): Use
10145         add_target_dynamic_tags.
10146         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10147         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10148         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10149         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10150
10151 2010-01-07  Ian Lance Taylor  <iant@google.com>
10152
10153         PR 11042
10154         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10155         object as needed.
10156
10157 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10158             Ian Lance Taylor  <iant@google.com>
10159
10160         PR 11019
10161         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10162         Xindex::read_symtab_xindex.
10163
10164 2010-01-07  Doug Kwan  <dougkwan@google.com>
10165
10166         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10167         (Insn_template::thumb16_bcond_insn): New method declaration.
10168         (Insn_template): Fix spelling.
10169         (Stub::thumb16_special): New method declaration.
10170         (Stub::do_write): Define virtual method which was previously pure
10171         virtual.
10172         (Stub::do_thumb16_special): New method declaration.
10173         (Stub::do_fixed_endian_write): New template member.
10174         (Reloc_stub::do_write): Remove.
10175         (Reloc_stub::do_fixed_endian_write): Remove.
10176         (Cortex_a8_stub): New class definition.
10177         (Stub_factory::make_cortex_a8_stub): New method definition.
10178         (Stub_factory::Stub_factory): Add missing static storage class
10179         qualifier for elf32_arm_stub_a8_veneer_blx.
10180
10181 2010-01-07  Ian Lance Taylor  <iant@google.com>
10182
10183         PR 10980
10184         * options.h (class General_options): Add --warn-unresolved-symbols
10185         and --error-unresolved-symbols.
10186         * errors.cc (Errors::undefined_symbol): Implement
10187         --warn-unresolved-symbols.
10188
10189         * options.h (class General_options): Add -z text and -z textoff.
10190         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10191
10192 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10193
10194         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10195         (Garbage_collection::cident_sections): New function.
10196         (Garbage_collection::add_cident_section): New function.
10197         (Garbage_collection::cident_sections_): New member.
10198         (gc_process_relocs): Add references to sections whose names are C
10199         identifiers.
10200         * gold.h (cident_section_start_prefix): New constant.
10201         (cident_section_stop_prefix): New constant.
10202         (is_cident): New function.
10203         * layout.cc (Layout::define_section_symbols): Replace string constants
10204         with the newly defined constants.
10205         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10206         C identifiers.
10207         * testsuite/Makefile.am: Add gc_orphan_section_test.
10208         * testsuite/Makefile.in: Regenerate.
10209         * testsuite/gc_orphan_section_test.cc: New file.
10210         * testsuite/gc_orphan_section_test.sh: New file.
10211
10212 2010-01-06  Ian Lance Taylor  <iant@google.com>
10213
10214         PR 10980
10215         * options.h (class General_options): Add --warn-shared-textrel.
10216         * layout.cc (Layout::finish_dynamic_section): Implement
10217         --warn-shared-textrel.
10218
10219         PR 10980
10220         * options.h (class General_options): Add --warn-multiple-gp.
10221
10222 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10223
10224         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10225         $(THREADSLIB) and $(LIBDL).
10226         * Makefile.in: Rebuild.
10227
10228 2010-01-06  Ian Lance Taylor  <iant@google.com>
10229
10230         PR 10980
10231         * options.cc (General_options::parse_section_start): New function.
10232         (General_options::section_start): New function.
10233         (General_options::General_options): Initialize all members.
10234         * options.h: Include <map>
10235         (class General_options): Add --section-start.  Add section_starts_
10236         member.
10237         * layout.cc (Layout::attach_allocated_section_to_segment): If
10238         --section-start was used, set the address of the segment.  Remove
10239         local sort_sections.
10240         (Layout::relaxation_loop_body): If the address of the load segment
10241         has been set by --section-start, don't use it.
10242         * output.h (Output_segment::update_flags_for_output_section): New
10243         function.
10244         * output.cc (Output_segment::add_output_section): Call
10245         update_flags_for_output_section.
10246
10247 2010-01-05  Ian Lance Taylor  <iant@google.com>
10248
10249         PR 10980
10250         * options.h (class General_options): Add --undefined-version.
10251         * script.cc (struct Version_expression): Add was_matched_by_symbol
10252         field.
10253         (Version_script_info::matched_symbol): New function.
10254         (Version_script_info::get_symbol_version_helper): Call
10255         matched_symbol.
10256         (Version_script_info::check_unmatched_names): New function.
10257         * script.h (class Version_script_info): Update declarations.
10258         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10259
10260         * options.h (class General_options): Use DEFINE_bool_alias for
10261         allow_multiple_definition.
10262         * resolve.cc (Symbol_table::should_override): Don't test
10263         allow_multiple_definition.
10264
10265         PR 10980
10266         * options.h (class General_options): Add --cref.
10267         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10268         until after printing cref table.
10269         * cref.cc: Include "symtab.h".
10270         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10271         (Cref_table_compare::operator()): New function.
10272         (Cref_inputs::gather_cref): New function.
10273         (filecol): New static const.
10274         (Cref_inputs::print_cref): New function.
10275         (Cref::print_cref): New function.
10276         * cref.h: Include <cstdio>.
10277         (class Cref): Update declarations.
10278         * mapfile.h (Mapfile::file): New function.
10279         * object.h (class Object): Define Symbols.  Declare virtual
10280         do_get_global_symbols.
10281         (Object::get_global_symbols): New function.
10282         * object.cc (Input_objects::add_object): Pass object to cref_ if
10283         --cref.
10284         (Input_objects::archive_start): Likewise.
10285         (Input_objects::archive_stop): Likewise.
10286         (Input_objects::print_cref): New function.
10287         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10288         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10289         --cref.
10290         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10291         function.
10292         * plugin.h (class Sized_pluginobj): Update declarations.
10293
10294 2010-01-05  Ian Lance Taylor  <iant@google.com>
10295
10296         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10297         to is_default_version.  Rename insdef to insdefault.
10298         (Symbol_table::add_from_relobj): Rename def to is_default_version
10299         and local to is_forced_local.
10300         (Symbol_table::add_from_pluginobj): Likewise.
10301         (Symbol_table::add_from_dynobj): Likewise.
10302         (Symbol_table::define_special_symbol): Rename insdef to
10303         insdefault.
10304
10305 2010-01-04  Ian Lance Taylor  <iant@google.com>
10306
10307         PR 10980
10308         * options.h (class General_options): Add
10309         --allow-multiple-definition and -z muldefs.
10310         * resolve.cc (Symbol_table::should_override): Don't warn about a
10311         multiple symbol definition if --allow-multiple-definition or -z
10312         muldefs.
10313
10314         PR 10980
10315         * options.h (class General_options): Add --add-needed and
10316         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10317         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10318         error if --copy-dt-needed-entries aka --add-needed is used and
10319         would cause a change in behaviour.
10320
10321         PR 10980
10322         * options.h (class General_options): Add -G as a short version of
10323         --shared.  Add no-op options -assert, -g, and -i.
10324
10325 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10326
10327         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10328         check for .text or .gnu.linkonce.t sections.
10329         * icf.cc (Icf::find_identical_sections): Ditto.
10330         Change the detection for mangled function name within the section
10331         name.
10332         * icf.h (is_section_foldable_candidate): New function.
10333
10334 2009-12-30  Ian Lance Taylor  <iant@google.com>
10335
10336         PR 10980
10337         * options.h (class General_options): Permit two dashes with
10338         --retain-symbols-file.
10339
10340 2009-12-30  Ian Lance Taylor  <iant@google.com>
10341
10342         PR 10979
10343         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10344         don't put the file header and segment headers in the text
10345         segment.
10346
10347         PR 10979
10348         * common.cc (Sort_commons::operator()): Stabilize sort when both
10349         entries are NULL.
10350         (Symbol_table::do_allocate_commons_list): When allocating common
10351         symbols, skip a symbol which is no longer common.
10352         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10353         an object before checking its type.
10354         * testsuite/common_test_2.c: New file.
10355         * testsuite/common_test_3.c: New file.
10356         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10357         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10358         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10359         (common_test_2_pic.o, common_test_2.so): New targets.
10360         (common_test_3_pic.o, common_test_3.so): New targets.
10361         * testsuite/Makefile.in: Rebuild.
10362
10363         PR 10979
10364         * script.cc (read_input_script): If we see a new SECTIONS clause,
10365         and we have added an input section, give an error.
10366         * layout.h (class Layout): Add have_added_input_section function.
10367         Add have_added_input_section_ field.
10368         * layout.cc (Layout::Layout): Initialize
10369         have_added_input_section_.
10370         (Layout::layout): Set have_added_input_section_.
10371         (Layout::layout_eh_frame): Likewise.
10372
10373 2009-12-30  Ian Lance Taylor  <iant@google.com>
10374
10375         PR 10931
10376         * options.h (class General_options): Add --sort-common option.
10377         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10378         * common.cc (Sort_common): Add sort_order parameter to
10379         constructor.  Add sort_order_ field.
10380         (Sort_commons::operator): Check sort_order_.
10381         (Symbol_table::allocate_commons): Determine the sort order.
10382         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10383         Change all callers.
10384         (Symbol_table::do_allocate_commons_list): Likewise.
10385
10386 2009-12-30  Ian Lance Taylor  <iant@google.com>
10387
10388         PR 10916
10389         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10390         symbols from this object, don't change the visibility of an
10391         undefined symbol.
10392         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10393
10394 2009-12-30  Ian Lance Taylor  <iant@google.com>
10395
10396         PR 10861
10397         * script.h (class Version_script_info): Define Language enum.
10398         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10399         new fields globals_, locals_, and is_finalized_.
10400         * script.cc: Various formatting fixes.
10401         (class Parser_closure): Change language_stack_ from a vector of
10402         std::string to one of Version_script_info::Language.  Adjust all
10403         uses accordingly.
10404         (class Lazy_demangler): Remove.
10405         (struct Version_expression): Change language from std::string to
10406         Version_script_info::Language.
10407         (Version_script_info::Version_script_info): New function.
10408         (Version_script_info::~Version_script_info): Don't call clear.
10409         (Version_script_info::finalize): New function.
10410         (Version_script_info::build_lookup_tables): New function.
10411         (Version_script_info::build_expression_list_lookup): New
10412         function.
10413         (Version_script_info::get_symbol_version_helper): Rewrite to use
10414         lookup tables.
10415         (Version_script_info::print_expression_list): Adjust to use
10416         Version_script_info::Language.
10417         (script_push_lex_into_version_mode): Check that the version script
10418         has not been finalized.
10419         (version_script_push_lang): Change language string to
10420         Version_script_info::Language.
10421         * options.cc (Command_line::version_script): New function.
10422         * options.h (class General_options): Add finalize_dynamic_list
10423         function.  Change version_script from declaration to definition.
10424         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10425         * testsuite/version_script.map: Remove duplicate def of foo.
10426         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10427         version_script.map.
10428         * testsuite/Makefile.in: Rebuild.
10429
10430 2009-12-30  Ian Lance Taylor  <iant@google.com>
10431
10432         PR 10843
10433         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10434         if the input symbol index is 0, make the output symbol index 0.
10435
10436 2009-12-30  Ian Lance Taylor  <iant@google.com>
10437
10438         PR 10670
10439         * options.h (class General_options): Add -x/--discard-all.
10440         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10441         --discard-all.  If the local symbol needs a dynamic entry, check
10442         that before handling --discard-locals.
10443
10444 2009-12-30  Ian Lance Taylor  <iant@google.com>
10445
10446         PR 10450
10447         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10448         flags to PF_R.
10449         (Output_segment::add_output_section): Don't change the flags if
10450         the type is PT_TLS.
10451
10452         PR 10450
10453         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10454         GNU hash table if they need a dynamic value.  Otherwise, don't add
10455         them if they are defined in a dynamic object or are forced local.
10456
10457 2009-12-29  Ian Lance Taylor  <iant@google.com>
10458
10459         PR 10450
10460         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10461         .gnu.hash table for a 32-bit target.
10462
10463         PR 10450
10464         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10465         regular and a dynamic object only needs a dynamic symbol table
10466         entry if it is externally visible.
10467
10468         PR 10450
10469         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10470         constructor.  Add global_offset_table_ field.
10471         (Target_i386::got_section): Set global_offset_table_.
10472         (Target_i386::do_finalize_sections): Set global_offset_table_
10473         size.
10474         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10475         in constructor.  Add global_offset_table_ field.
10476         (Target_x86_64::got_section): Set global_offset_table_.
10477         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10478         size.
10479
10480         * layout.cc (Layout::Layout): Initialize increase_relro_.
10481         (Layout::get_output_section): Add is_relro, is_last_relro, and
10482         is_first_non_relro parameters.  Change all callers.
10483         (Layout::choose_output_section): Likewise.
10484         (Layout::add_output_section_data): Likewise.
10485         (Layout::make_output_section): Likewise.
10486         (Layout::set_segment_offsets): Clear increase_relro when using a
10487         linker script.
10488         * layout.h (class Layout): Add increase_relro method.  Add
10489         increase_relro_ field.  Update declarations.
10490         * output.cc (Output_section::Output_section): Initialize
10491         is_last_relro_ and is_first_non_relro_.
10492         (Output_segment::add_output_section): Group relro sections is
10493         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10494         (Output_segment::maximum_alignment): Remove relro handling.
10495         (Output_segment::set_section_addresses): Add increase_relro
10496         parameter.  Change all callers.  Add initial alignment to align
10497         relro sections on separate page.  Remove old relro handling.
10498         (Output_segment::set_section_list_addresses): Remove in_relro
10499         parameter.  Change all callers.
10500         (Output_segment::set_offset): Add increase parameter.  Change all
10501         callers.  Remove old relro handling.
10502         * output.h (class Output_section): Add new methods: is_last_relro,
10503         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10504         Add is_last_relro_ and is_first_non_relro_ fields.
10505         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10506         Create separate .got.plt section.  Call increase_relro.
10507         * x86_64.cc (Target_x86_64::got_section): Likewise.
10508         * testsuite/relro_script_test.t: Add .got.plt.
10509
10510         PR 10450
10511         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10512         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10513         (Layout::finalize): Call set_dynamic_symbol_size.
10514         (Layout::set_dynamic_symbol_size): New function.
10515         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10516         set_dynamic_symbol_size.
10517
10518         PR 10450
10519         * output.h (class Output_section): Add is_entsize_zero_ field.
10520         * output.cc (Output_section::Output_section): Initialize
10521         is_entsize_zero_.
10522         (Output_section::set_entsize): If two different entsizes are
10523         requested, force it to zero.
10524         (Output_section::add_input_section): Set flags for .debug_str
10525         before updating section flags.  Set entsize.
10526         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10527         and SHF_STRING if all input sections have those flags.
10528
10529 2009-12-29   Rafael Espindola  <espindola@google.com>
10530
10531         * main.cc (main): Fix the sys time reporting.
10532         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10533         reporting.
10534
10535 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10536
10537         * options.cc (General_options::parse_version): Allow -v to exit
10538         without an error if there is nothing to link.
10539
10540 2009-12-29  Ian Lance Taylor  <iant@google.com>
10541
10542         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10543         using a version of gcc before 4.1.
10544         * configure: Rebuild.
10545
10546 2009-12-28  Chris Demetriou  <cgd@google.com>
10547
10548         * attributes.cc (Output_attributes_section_data::do_write): Use
10549         std::vector::front rather than std::vector::data.
10550
10551 2009-12-28  Ian Lance Taylor  <iant@google.com>
10552
10553         * symtab.h (class Symbol_table): Add enum Defined.
10554         * resolve.cc (Symbol_table::should_override): Add defined
10555         parameter.  Change all callers.  Test whether object is NULL
10556         before calling a method on it.
10557         (Symbol_table::report_resolve_problem): Add defined parameter.
10558         Change all callers.
10559         (Symbol_table::should_override_with_special): Likewise.
10560         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10561         parameter.  Change all callers.
10562         (Symbol_table::do_define_in_output_data): Likewise.
10563         (Symbol_table::define_in_output_segment): Likewise.
10564         (Symbol_table::do_define_in_output_segment): Likewise.
10565         (Symbol_table::define_as_constant): Likewise.
10566         (Symbol_table::do_define_as_constant): Likewise.
10567         * script.h (class Symbol_assignment): Add is_defsym parameter to
10568         constructor; change all callers.
10569         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10570         parameter.  Change all callers.  Add is_defsym_ field.
10571         (class Parser_closure): Add parsing_defsym parameter to
10572         constructor; change all callers.  Add parsing_defsym accessor
10573         function.  Add parsing_defsym_ field.
10574
10575 2009-12-28  Ian Lance Taylor  <iant@google.com>
10576
10577         * gold.cc (queue_middle_tasks): Fix formatting.
10578         * object.cc (Relobj::is_section_name_included): Likewise.
10579
10580 2009-12-23  Ian Lance Taylor  <iant@google.com>
10581
10582         * i386.cc (Target_i386::do_calls_non_split): Recognize
10583         -fsplit-stack prologue for a function with a static chain.
10584         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10585         -fsplit-stack prologue when using %r11.
10586
10587 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10588
10589         * options.cc (General_options::parse_version): Make -v continue and do
10590         the link like GNU ld does.
10591
10592 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10593
10594         * Makefile.am (CCFILES): Add timer.cc.
10595         (HFILES): Add timer.h.
10596         * configure.ac: Check for sysconf and times.
10597         * main.cc: include timer.h.
10598         (main): Use Timer instead of get_run_time.
10599         * timer.cc: New.
10600         * timer.h: New.
10601         * workqueue.cc: include timer.h.
10602         (Workqueue::find_and_run_task):
10603         Report user, sys and wall time.
10604         * Makefile.in: Regenerate.
10605         * config.in: Regenerate.
10606         * configure: Regenerate.
10607
10608 2009-12-16  Doug Kwan  <dougkwan@google.com>
10609
10610         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10611         sections.
10612         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10613         relaxed input sections.
10614         * output.cc (Output_section::find_relaxed_input_section): Change
10615         return type to Output_relaxed_input_section pointer.  Adjust code
10616         for new type of relaxed_input_section_map_.
10617         * output.h (Output_section::find_relaxed_input_section): Change
10618         return type to Output_relaxed_input_section pointer.
10619         (Output_section::Output_relaxed_input_section_by_input_section_map):
10620         New type.
10621         (Output_section::relaxed_input_section_map_): Change type to
10622         Output_section::Output_relaxed_input_section_by_input_section_map.
10623         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10624         input section.
10625
10626 2009-12-15  Ian Lance Taylor  <iant@google.com>
10627
10628         * layout.cc (Layout::create_shstrtab): Only write out after input
10629         sections if we are compressing debug sections.
10630
10631 2009-12-15  Ian Lance Taylor  <iant@google.com>
10632
10633         * archive.cc (Archive::add_symbols): Only look up a symbol without
10634         a version if there is, in fact, a version.
10635
10636 2009-12-14  Ian Lance Taylor  <iant@google.com>
10637
10638         Revert -Wshadow changes, all changes from:
10639         2009-12-11  Doug Kwan  <dougkwan@google.com>
10640         2009-12-11  Nick Clifton  <nickc@redhat.com>
10641         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10642
10643 2009-12-11  Doug Kwan  <dougkwan@google.com>
10644
10645         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10646         due to -Wshadow.
10647         * attributes.cc (Object_attribute::size): Ditto.
10648         (Attributes_section_data::size): Ditto.
10649         (Attributes_section_data::Attributes_section_data): Ditto.
10650         (Output_attributes_section_data::do_write): Ditto.
10651         * attributes.h (Object_attribute::set_type): Ditto.
10652         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10653
10654 2009-12-11  Nick Clifton  <nickc@redhat.com>
10655
10656         * archive.cc: Fix shadowed variable warnings.
10657         * arm.cc: Likewise.
10658         * compressed_output.cc: Likewise.
10659         * compressed_output.h: Likewise.
10660         * configure: Likewise.
10661         * dwarf_reader.cc: Likewise.
10662         * dynobj.cc: Likewise.
10663         * dynobj.h: Likewise.
10664         * ehframe.cc: Likewise.
10665         * ehframe.h: Likewise.
10666         * errors.cc: Likewise.
10667         * expression.cc: Likewise.
10668         * fileread.cc: Likewise.
10669         * fileread.h: Likewise.
10670         * freebsd.h: Likewise.
10671         * i386.cc: Likewise.
10672         * icf.cc: Likewise.
10673         * incremental.h: Likewise.
10674         * layout.cc: Likewise.
10675         * layout.h: Likewise.
10676         * mapfile.cc: Likewise.
10677         * merge.cc: Likewise.
10678         * merge.h: Likewise.
10679         * object.cc: Likewise.
10680         * object.h: Likewise.
10681         * options.h: Likewise.
10682         * output.cc: Likewise.
10683         * output.h: Likewise.
10684         * parameters.cc: Likewise.
10685         * plugin.cc: Likewise.
10686         * powerpc.cc: Likewise.
10687         * reduced_debug_output.cc: Likewise.
10688         * reduced_debug_output.h: Likewise.
10689         * reloc.cc: Likewise.
10690         * reloc.h: Likewise.
10691         * resolve.cc: Likewise.
10692         * script-sections.cc: Likewise.
10693         * script.cc: Likewise.
10694         * script.h: Likewise.
10695         * sparc.cc: Likewise.
10696         * symtab.cc: Likewise.
10697         * symtab.h: Likewise.
10698         * target-select.cc: Likewise.
10699         * target-select.h: Likewise.
10700         * token.h: Likewise.
10701         * workqueue.cc: Likewise.
10702         * workqueue.h: Likewise.
10703         * x86_64.cc: Likewise.
10704
10705 2009-12-10  Doug Kwan  <dougkwan@google.com>
10706
10707         * arm.cc (attributes.h): New include.
10708         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10709         (Arm_relobj::~Arm_relobj): Delete object pointed by
10710         attributes_section_data_.
10711         (Arm_relobj::attributes_section_data): New method definition.
10712         (Arm_relobj::attributes_section_data_): New data member declaration.
10713         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10714         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10715         attributes_section_data_.
10716         (Arm_dynobj::attributes_section_data): New method definition.
10717         (Arm_dynobj::attributes_section_data_): New data member declaration.
10718         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10719         initialization value of may_use_blx_ to false.
10720         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10721         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10722         object attributes to compute results instead of hard-coding.
10723         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10724         Target_arm::get_secondary_compatible_arch,
10725         Target_arm::set_secondary_compatible_arch
10726         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10727         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10728         New method declarations.
10729         (Target_arm::get_aeabi_object_attribute): New method definition.
10730         (Target_arm::attributes_section_data_): New data member declaration.
10731         (read_arm_attributes_section): New template definition.
10732         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10733         (Arm_dynobj::do_read_symbols): Ditto.
10734         (Target_arm::do_finalize_sections): Merge attributes sections from
10735         input.  Check for BLX use after attributes section merging.
10736         Fix __exidx_start and __exidx_end visibility.  Create an
10737         .ARM.attributes section if necessary.
10738         (Target_arm::get_secondary_compatible_arch,
10739         Target_arm::set_secondary_compatible_arch,
10740         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10741         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10742         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10743         New method definitions.
10744
10745 2009-12-09  Ian Lance Taylor  <iant@google.com>
10746
10747         * plugin.cc (Plugin::load): Don't cast from void* to a function
10748         pointer.
10749
10750 2009-12-09  Ian Lance Taylor  <iant@google.com>
10751
10752         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10753         information fields.
10754
10755 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10756
10757         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10758         Replace two_file_shared_1.so with two_file_shared_2.so.
10759         * testsuite/Makefile.in: Regenerated.
10760
10761 2009-12-08  Doug Kwan  <dougkwan@google.com>
10762
10763         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10764         (HFILES): Add attributes.h and int_encoding.h.
10765         * Makefile.in: Regenerate.
10766         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10767         function definitions to int_encoding.cc
10768         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10769         prototypes to int_encoding.h
10770         * reduced_debug_output.cc (int_encoding.h): New include.
10771         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10772         function definitions to int_encoding.cc
10773         (insert_into_vector, read_from_pointer): Move template definitions to
10774         int_encoding.h
10775         * attributes.cc: New file.
10776         * attributes.h: New file.
10777         * int_encoding.cc: New file.
10778         * int_encoding.h: New file.
10779
10780 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10781
10782         PR gold/11055
10783         * incremental-dump.cc (dump_incremental_inputs): New.
10784         (main): Use dump_incremental_inputs.
10785
10786 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10787
10788         PR gold/10893
10789         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10790         checking elfcpp::STT_FUNC.
10791         (Target_i386::Relocate::relocate): Likewise.
10792         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10793
10794         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10795         symbols from shared libraries into normal FUNC symbols.
10796
10797         * symtab.h (Symbol): Add is_func and use it.
10798
10799 2009-12-05  Doug Kwan  <dougkwan@google.com>
10800
10801         * arm.cc (Target_arm::arm_info): Initialize new fields
10802         attributes_section and attributes_vendor.
10803         * i386.cc (Target_i386::i386_info): Same.
10804         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10805         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10806         fields attributes_section and attributes_vendor.
10807         * sparc.cc (Target_sparc::sparc_info): Same.
10808         * target.h (Target::attributes_section, Target::attributes_vendor,
10809         Target::is_attributes_section, Target::attribute_arg_type,
10810         Target::attributes_order): New method definitions.
10811         (Target::Target_info::attributes_section,
10812         Target::Target_info::attributes_vendor): New fields.
10813         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10814         virtual method definitions.
10815         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10816         attributes_section and attributes_vendor.
10817         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10818
10819 2009-12-05  Doug Kwan  <dougkwan@google.com>
10820
10821         * arm.cc: Update comments about interworking and stub generation.
10822         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10823         considered as non-PIC.
10824         (Arm_relocate_functions::base_abs): Fix formatting.
10825         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10826         of function to use GOT entry address instead of offset.
10827         (Target_arm::Scan::global): Issue an error if a symbol would need a
10828         PLT does not get one because it is untyped.  Remove code to create
10829         dynamic symbols for relative branches.
10830         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10831         takes unsigned integer instead of boolean.
10832
10833 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10834
10835         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10836         (two_file_test_LDADD): Likewise.
10837         (common_test_1_LDADD): Likewise.
10838         (exception_test_LDADD) Likewise.
10839         (weak_test_LDADD): Likewise.
10840         (many_sections_test_LDADD): Likewise.
10841         (initpri1_LDADD): Likewise.
10842         (script_test_1_LDADD): Likewise.
10843         (script_test_2_LDADD): Likewise.
10844         (justsyms_LDADD): Likewise.
10845         (binary_test_LDADD): Likewise.
10846         (large_LDADD): Likewise.
10847         * testsuite/Makefile.in: Regenerated.
10848
10849 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10850
10851         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10852         (Symbol_table::override_with_special): Likewise.
10853         (Symbol_table::add_from_object): Likewise.
10854
10855 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10856
10857         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10858         Don't set the data_offset twice.
10859
10860 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10861
10862         * testsuite/Makefile.in: Regenerate.
10863
10864 2009-12-03  Doug Kwan  <dougkwan@google.com>
10865
10866         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10867         (Target_arm::do_finalize_sections): Add parameter for symbol table
10868         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10869         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10870         parameter for symbol table pointer.
10871         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10872         an additional parameter for a pointer to symbol table.
10873         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10874         parameter for a symbol table pointer.
10875         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10876         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10877         Ditto.
10878         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10879         parameter for a symbol table pointer.
10880
10881 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10882
10883         * incremental.cc (Incremental_inputs_header)
10884         (Incremental_inputs_header_write, Incremental_inputs_entry)
10885         (Incremental_inputs_entry_write): Move ...
10886         * incremental.h (Incremental_inputs_header)
10887         (Incremental_inputs_header_write, Incremental_inputs_entry)
10888         (Incremental_inputs_entry_write): here.
10889
10890 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10891
10892         * incremental.cc (make_sized_incremental_binary): Set the target.
10893         Error if it is incompatible.
10894         * output.h (Output_file): Add filename method.
10895
10896 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10897
10898         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10899         from the get_* methods.
10900
10901 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10902
10903         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10904         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10905         Write 0 for the data_offset of scripts.
10906
10907 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10908
10909         * testsuite/Makefile.am: Add the incremental_test.sh test.
10910         * testsuite/incremental_test.sh: New.
10911         * testsuite/incremental_test_1.c: New.
10912         * testsuite/incremental_test_2.c: New.
10913
10914 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10915
10916         * incremental-dump.cc (main): Fix typos.
10917
10918 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10919
10920         PR gold/11025
10921         * incremental-dump.cc (main): Use llu to print 64 bit values.
10922
10923 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10924             H.J. Lu  <hongjiu.lu@intel.com>
10925
10926         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10927         $(LIBDL).
10928         (incremental_dump_LDADD): Likewise.
10929         * Makefile.in: Regenerated.
10930
10931 2009-11-25  Doug Kwan  <dougkwan@google.com>
10932
10933         Revert:
10934
10935         2009-11-25  Doug Kwan  <dougkwan@google.com>
10936
10937                 * arm.cc (Target_arm::Target_arm): Move method definition
10938                 outside of class definition.  Add code to handle
10939                 --target1-rel, --target1-abs and --target2= options.
10940                 (Target_arm::get_reloc_reloc_type): Change method to be
10941                 non-static and const.
10942                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10943                 New data member declaration.
10944                 (Target_arm::Scan::local, Target_arm::Scan::global,
10945                 Target_arm::Relocate::relocate,
10946                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10947                 Adjust call to Target_arm::get_real_reloc_type.
10948                 (Target_arm::get_real_reloc_type): Use command line options
10949                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10950                 * options.h (--target1-rel, --target1-abs, --target2): New
10951                 ARM-only options.
10952
10953 2009-11-25  Doug Kwan  <dougkwan@google.com>
10954
10955         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10956         class definition.  Add code to handle --target1-rel, --target1-abs
10957         and --target2= options.
10958         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10959         and const.
10960         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10961         member declaration.
10962         (Target_arm::Scan::local, Target_arm::Scan::global,
10963         Target_arm::Relocate::relocate,
10964         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10965         call to Target_arm::get_real_reloc_type.
10966         (Target_arm::get_real_reloc_type): Use command line options to
10967         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10968         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10969         options.
10970
10971 2009-11-25  Doug Kwan  <dougkwan@google.com>
10972
10973         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10974         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10975         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10976         formatting.
10977         (Arm_relocate_functions::thm_call): Replace body with a call to
10978         Arm_relocate_functions::thumb_branch_common.
10979         (Arm_relocate_functions::thm_jump24,
10980         Arm_relocate_functions::thm_xpc22): New method definitions.
10981         (Arm_relocate_functions::thumb_branch_common): New method definition.
10982         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10983         operator.
10984         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10985         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10986
10987 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10988
10989         * Makefile.am: Build incremental-dump
10990         * Makefile.in: Regenerate.
10991         * incremental-dump.cc: New.
10992         * incremental.cc (Incremental_inputs_header_data,
10993         Incremental_inputs_entry_data): Move to incremental.h
10994         * incremental.h: (Incremental_inputs_header_data,
10995         Incremental_inputs_entry_data): Move from incremental.cc
10996
10997 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10998
10999         * incremental.cc (Incremental_inputs_header,
11000         Incremental_inputs_header_write, Incremental_inputs_entry,
11001         Incremental_inputs_entry_write): Add a typedef with the data type.
11002
11003 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11004
11005         * incremental.cc (Incremental_inputs_header,
11006         Incremental_inputs_header_write, Incremental_inputs_entry,
11007         Incremental_inputs_entry_write): Update comment about which
11008         type has the filed descriptions.
11009
11010 2009-11-15  Doug Kwan  <dougkwan@google.com>
11011
11012         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11013         (Arm_relocate_functions::arm_branch_common): Change method defintion
11014         in class definition to a method declaration and update list of formal
11015         parameters.
11016         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11017         Arm_relocation_functions::jump24): Adjust call to
11018         Arm_relocate_functions::arm_branch_common.  Update list of formal
11019         parameters.
11020         (Arm_relocate_functions::xpc25): New method definition.
11021         (Arm_relocate_functions::arm_branch_common): Move method defintion
11022         out from class definition.  Use stubs for mode-switching and extending
11023         branch ranges.
11024         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11025         specially.  Change code to enable use of stubs in ARM branches.
11026
11027 2009-11-10  Doug Kwan  <dougkwan@google.com>
11028
11029         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11030         in method declaration.
11031         (Target_arm::relocate_stub): New method declaration.
11032         (Target_arm::default_target): Change to return a pointer instead of
11033         a const reference.
11034         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11035         Target_arm::default_target.
11036         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11037         method definition.
11038         (Target_arm::relocate_section): Adjust view.
11039         (Target_arm::relocate_stub): New method definition.
11040
11041 2009-11-10  Doug Kwan  <dougkwan@google.com>
11042
11043         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11044         a format warning.
11045         * incremental.cc (open_incremental_binary): Initialized local
11046         variables to avoid warnings.
11047         * object.cc (make_elf_object): Ditto.
11048         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11049         a format warning.
11050
11051 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11052
11053         PR gold/10930
11054         * testsuite/plugin_test.c: Include "config.h".
11055
11056 2009-11-09  Doug Kwan  <dougkwan@google.com>
11057
11058         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11059         (arm_symbol_value): Remove.
11060         (Arm_relocate_functions::arm_branch_common,
11061         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11062         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11063         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11064         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11065         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11066         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11067         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11068         Arm_relocate_functions::thm_mobw_abs_nc,
11069         Arm_relocate_functions::thm_mov_abs,
11070         Arm_relocate_functions::movw_prel_nc,
11071         Arm_relocate_functions::thm_movt_abs,
11072         Arm_relocate_functions::movt_prel,
11073         Arm_relocate_functions::thm_movw_prel_nc,
11074         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11075         (Target_arm::Relocate::relocate): Only decompose address into two
11076         parts if relocation type uses the thumb-bit and pass the actual
11077         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11078         calls to methods in Arm_relocate_functions for this change.
11079
11080 2009-11-08  Ian Lance Taylor  <iant@google.com>
11081
11082         PR 10925
11083         * reloc.cc: Instantiate
11084         Sized_relobj::initialize_input_to_output_maps and
11085         Sized_relobj:free_input_to_output_maps.
11086
11087 2009-11-06  Ian Lance Taylor  <iant@google.com>
11088
11089         PR 10876
11090         * defstd.cc (in_segment): Set only_if_ref true for "end".
11091
11092 2009-11-06  Doug Kwan  <dougkwan@google.com>
11093
11094         * arm.cc (class Reloc_stub): Correct a comment.
11095         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11096         (Target_arm::scan_section_for_stubs): New method declaration.
11097         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11098         Change methods from private to protected.
11099         (Target_arm::do_may_relax): New method definition.
11100         (Target_arm::do_relax, Target_arm::group_sections,
11101         Target_arm::scan_reloc_for_stub,
11102         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11103         (Target_arm::arm_input_section_map_): New data member declaration.
11104         (Target_arm::scan_reloc_for_stub,
11105         Target_arm::scan_reloc_section_for_stubs,
11106         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11107         Target_arm::do_relax): New method definitions.
11108
11109 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11110
11111         * configure.ac: Check for (struct stat)::st_mtim
11112         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11113         * config.in: Regenerate.
11114         * configure: Regenerate.
11115
11116 2009-11-05  Ian Lance Taylor  <iant@google.com>
11117
11118         PR 10910
11119         * output.cc (Output_segment::add_output_section): Add missing
11120         return statement.
11121
11122 2009-11-04  Ian Lance Taylor  <iant@google.com>
11123
11124         PR 10880
11125         * object.h (class Object): Add is_needed and set_is_needed
11126         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11127         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11128         defined in a dynamic object and referenced by a regular object,
11129         set is_needed for the dynamic object.
11130         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11131         if the file is marked with as_needed and it is not needed.
11132
11133 2009-11-04  Ian Lance Taylor  <iant@google.com>
11134
11135         PR 10887
11136         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11137         tags if data is discarded by linker script.
11138         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11139         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11140         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11141         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11142
11143 2009-11-04  Ian Lance Taylor  <iant@google.com>
11144
11145         * layout.cc (Layout::get_output_section): Add is_interp and
11146         is_dynamic_linker_section parameters.  Change all callers.
11147         (Layout::choose_output_section): Likewise.
11148         (Layout::make_output_section): Likewise.
11149         (Layout::add_output_section_data): Add is_dynamic_linker_section
11150         parameter.  Change all callers.
11151         * layout.h (class Layout): Update declarations.
11152         * output.h (class Output_section): Add is_interp, set_is_interp,
11153         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11154         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11155         generate_code_fills_at_write_ to a bitfield.
11156         * output.cc (Output_section::Output_sections): Initialize new
11157         fields.
11158         (Output_segment::add_output_section): Add do_sort parameter.
11159         Change all callers.
11160
11161 2009-11-03  Ian Lance Taylor  <iant@google.com>
11162
11163         PR 10860
11164         * options.h (class General_options): Add --warn-common.
11165         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11166         merging two common symbols.
11167         (Symbol_table::should_override): Handle --warn-common when merging
11168         a common symbol with a defined symbol.  Use report_resolve_problem
11169         for multiple definitions.
11170         (Symbol_table::report_resolve_problem): New function.
11171         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11172
11173 2009-11-03  Doug Kwan  <dougkwan@google.com>
11174
11175         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11176         stub_factory_.
11177         (Target_arm::stub_factory): New method definition.
11178         (Target_arm::new_arm_input_section,
11179         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11180         Target_arm::reloc_uses_thumb_bit): New method declarations.
11181         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11182         New type definitions.
11183         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11184         member declarations.
11185         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11186         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11187         New method definitions.
11188
11189 2009-11-03  Ian Lance Taylor  <iant@google.com>
11190
11191         * options.h (class General_options): Add --warn_constructors.
11192
11193 2009-11-03  Ian Lance Taylor  <iant@google.com>
11194
11195         PR 10893
11196         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11197         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11198
11199 2009-11-03  Ian Lance Taylor  <iant@google.com>
11200
11201         PR 10895
11202         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11203         --msgid-bugs-address.
11204         (install-pdf): New target.
11205         (install-data_yes): Look up one directory to find mkinstalldirs.
11206
11207 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11208
11209         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11210         tree.
11211
11212 2009-10-30  Doug Kwan  <dougkwan@google.com>
11213
11214         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11215
11216 2009-10-30  Doug Kwan  <dougkwan@google.com>
11217
11218         * arm.cc (Stub_addend_reader): New struct template definition
11219         and partial specializations.
11220         (Stub_addend_reader::operator()): New method definition for a
11221         partially specialized template.
11222
11223 2009-10-30  Doug Kwan  <dougkwan@google.com>
11224
11225         * arm.cc (Arm_relobj::processor_specific_flags): New method
11226         definition.
11227         (Arm_relobj::do_read_symbols): New method declaration.
11228         (Arm_relobj::processor_specific_flags_): New data member declaration.
11229         (Arm_dynobj): New class definition.
11230         (Target_arm::do_finalize_sections): Add input_objects parameter.
11231         (Target_arm::do_adjust_elf_header): New method declaration.
11232         (Target_arm::are_eabi_versions_compatible,
11233         (Target_arm::merge_processor_specific_flags): New method declaration.
11234         (Target_arm::do_make_elf_object): New overloaded method definitions
11235         and declaration.
11236         (Arm_relobj::do_read_symbols): New method definition.
11237         (Arm_dynobj::do_read_symbols): Ditto.
11238         (Target_arm::do_finalize_sections): Add input_objects parameters.
11239         Merge processor-specific flags from all input objects.
11240         (Target_arm::are_eabi_versions_compatible,
11241         Target_arm::merge_processor_specific_flags,
11242         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11243         New method definitions.
11244         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11245         Input_objects pointer type parameter.
11246         * layout.cc (Layout::finalize): Pass input objects to target's.
11247         finalize_sections function.
11248         * output.cc (Output_file_header::do_sized_write): Set ELF file
11249         header's processor-specific flags.
11250         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11251         Input_objects pointer type parameter.
11252         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11253         * target.h (Input_objects): New forward class declaration.
11254         (Target::processor_specific_flags,
11255         Target::are_processor_specific_flags_sect): New method definitions.
11256         (Target::finalize_sections): Add input_objects parameter.
11257         (Target::Target): Initialize processor_specific_flags_ and
11258         are_processor_specific_flags_set_.
11259         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11260         parameter.
11261         (Target::set_processor_specific_flags): New method definition.
11262         (Target::processor_specific_flags_,
11263         Target::are_processor_specific_flags_set_): New data member
11264         declarations.
11265         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11266         Input_objects pointer type parameter.
11267
11268 2009-10-30  Doug Kwan  <dougkwan@google.com>
11269
11270         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11271
11272 2009-10-28  Ian Lance Taylor  <iant@google.com>
11273
11274         * object.h (class Relobj): Drop options parameter from
11275         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11276         do_scan_relocs, do_relocate.  Change all callers.
11277         (class Sized_relobj): Drop options parameters from
11278         do_gc_process_relocs, do_scan_relocs, do_relocate,
11279         do_relocate_sections, relocate_sections, emit_relocs_scan,
11280         emit_relocs_scan_reltype.  Change all callers.
11281         (struct Relocate_info): Remove options field and all references to
11282         it.
11283         * reloc.h (class Read_relocs): Remove options constructor
11284         parameter and options_ field.  Change all callers.
11285         (class Gc_process_relocs, class Scan_relocs): Likewise.
11286         (class Relocate_task): Likewise.
11287         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11288         all callers.
11289         (scan_relocatable_relocs): Likewise.
11290         * target.h (class Sized_target): Remove options parameter from
11291         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11292         all callers.
11293         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11294         callers.
11295         * arm.cc: Update functions to remove options parameters.
11296         * i386.cc: Likewise.
11297         * powerpc.cc: Likewise.
11298         * sparc.cc: Likewise.
11299         * x86_64.cc: Likewise.
11300         * testsuite/testfile.cc: Likewise.
11301
11302 2009-10-28  Doug Kwan  <dougkwan@google.com>
11303
11304         * arm.cc (Arm_relobj): New class definition.
11305         (Arm_relobj::scan_sections_for_stubs,
11306         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11307         New method definitions.
11308
11309 2009-10-28  Cary Coutant  <ccoutant@google.com>
11310
11311         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11312         (Plugin::cleanup_done_): New member.
11313         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11314         (Plugin_manager::cleanup_done_): Remove.
11315         (Plugin_manager::add_input_file): Edit error message.
11316         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11317         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11318
11319 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11320
11321         * fileread.cc: (File_read::View::~View): Use the new
11322         data_ownership_ filed.
11323         (File_read::~File_read): Dispose the new whole_file_view_.
11324         (File_read::open): Mmap the whole file if needed.
11325         (File_read::open): Use whole_file_view_ instead of contents_.
11326         (File_read::find_view): Use whole_file_view_ if applicable.
11327         (File_read::do_read): Use whole_file_view_ instead of contents_.
11328         (File_read::make_view): Use whole_file_view_ instead of contents_,
11329         update File_read::View::View call.
11330         (File_read::find_or_make_view): Update File_read::View::View
11331         call.
11332         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11333         remove contents_
11334         (File_read::View::Data_ownership): New enum.
11335         (File_read::View::View): Replace bool mapped_ with Data_ownership
11336         argument.
11337         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11338         (File_read::View::data_ownership_): New field.
11339         (File_read::contents_): Remove (replaced by whole_file_view_).
11340         (File_read::whole_file_view_): New field.
11341         * options.h (class General_options): Add --keep-files-mapped.
11342
11343 2009-10-27  Cary Coutant  <ccoutant@google.com>
11344
11345         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11346         * testsuite/Makefile.am (plugin_test_5): New test case.
11347         * testsuite/Makefile.in: Regenerate.
11348
11349 2009-10-25  Doug Kwan  <dougkwan@google.com>
11350
11351         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11352         from private to protected to allow access by child class.
11353         (Sized_relobj::do_relocate_sections): New method declaration.
11354         (Sized_relobj::relocate_sections): Virtualize.
11355         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11356         Sized_relobj::relocate_sections.  Instantiate template explicitly
11357         for different target sizes and endianity.
11358
11359 2009-10-24  Doug Kwan  <dougkwan@google.com>
11360
11361         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11362         (Arm_input_section::as_arm_input_section): New method.
11363         (Arm_output_section): New class definition.
11364         (Arm_output_section::create_stub_group,
11365         Arm_output_section::group_sections): New method definitions.
11366
11367 2009-10-22  Doug Kwan  <dougkwan@google.com>
11368
11369         * arm.cc (Arm_input_section): New class definition.
11370         (Arm_input_section::init, Arm_input_section:do_write,
11371         Arm_input_section::set_final_data_size,
11372         Arm_input_section::do_reset_address_and_file_offset): New method
11373         definitions.
11374
11375 2009-10-21  Doug Kwan  <dougkwan@google.com>
11376
11377         * arm.cc (Stub_table, Arm_input_section): New forward class
11378         declarations.
11379         (Stub_table): New class defintion.
11380         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11381         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11382         New method definition.
11383
11384 2009-10-21  Doug Kwan  <dougkwan@google.com>
11385
11386         * arm.cc: Update copyright comments.
11387         (Target_arm): New forward class template declaration.
11388         (Arm_address): New type.
11389         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11390         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11391         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11392         constants.
11393         (Insn_template): Same.
11394         (DEF_STUBS): New macro.
11395         (Stub_type): New enum type.
11396         (Stub_template): New class definition.
11397         (Stub): Same.
11398         (Reloc_stub): Same.
11399         (Stub_factory): Same.
11400         (Target_arm::Target_arm): Initialize may_use_blx_ and
11401         should_force_pic_veneer_.
11402         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11403         Target_arm::should_force_pic_veneer,
11404         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11405         Target_arm::using_thumb_only, Target_arm:;default_target): New
11406         method defintions.
11407         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11408         New data member declarations.
11409         (Insn_template::size, Insn_template::alignment): New method defintions.
11410         (Stub_template::Stub_template): New method definition.
11411         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11412         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11413         (Stub_factory::Stub_factory): New method definition.
11414         * gold.h (string_hash): New template.
11415         * output.h (Input_section_specifier::hash_value): Use
11416         gold::string_hash.
11417         (Input_section_specifier::string_hash): Remove.
11418         * stringpool.cc (Stringpool_template::string_hash): Use
11419         gold::string_hash.
11420
11421 2009-10-20  Doug Kwan  <dougkwan@google.com>
11422
11423         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11424         symbols of relaxed input sections.
11425         * output.h (Output_section::find_relaxed_input_section): Make
11426         method public.
11427
11428 2009-10-16  Doug Kwan  <dougkwan@google.com>
11429
11430         * dynobj.cc (Versions::Versions): Initialize version_script_.
11431         Only insert base version symbol definition for a shared object
11432         if version script defines any version versions.
11433         (Versions::define_base_version): New method definition.
11434         (Versions::add_def): Check that base version is not needed.
11435         (Versions::add_need): Define base version lazily.
11436         * dynobj.h (Versions::define_base_version): New method declaration.
11437         (Versions::needs_base_version_): New data member declaration.
11438         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11439         (check_DATA): Add no_version_test.stdout.
11440         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11441         New make rules.
11442         * testsuite/Makefile.in: Regenerate.
11443         * testsuite/no_version_test.c: New file.
11444         * testsuite/no_version_test.sh: Ditto.
11445
11446 2009-10-16  Doug Kwan  <dougkwan@google.com>
11447
11448         * expression.cc (class Segment_start_expression): New class definition.
11449         (Segment_start_expression::value): New method definition.
11450         (script_exp_function_segment_start): Return a new
11451         Segment_start_expression.
11452         * gold/script-c.h (script_saw_segment_start_expression): New function
11453         prototype.
11454         * script-sections.cc (Script_sections::Script_sections): Initialize
11455         SAW_SEGMENT_START_EXPRESSION_ to false.
11456         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11457         and -Tbbs options to specify section addresses if given in
11458         command line and no SEGMENT_START expression is seen in a script.
11459         * script-sections.h (Script_sections::saw_segment_start_expression,
11460         Script_sections::set_saw_segment_start_expression): New method
11461         definition.
11462         (Script_sections::saw_segment_start_expression_): New data member
11463         declaration.
11464         * script.cc (script_saw_segment_start_expression): New function.
11465         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11466         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11467         script_test_7.sh and script_test_8.sh.
11468         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11469         script_test_8.stdout.
11470         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11471         (script_test_6, script_test_6.stdout, script_test_7,
11472         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11473         * Makefile.in: Regenerate.
11474         * testsuite/script_test_6.sh: New file.
11475         * testsuite/script_test_6.t: Same.
11476         * testsuite/script_test_7.sh: Same.
11477         * testsuite/script_test_7.t: Same.
11478         * testsuite/script_test_8.sh: Same.
11479
11480 2009-10-16  Doug Kwan  <dougkwan@google.com>
11481
11482         * output.cc (Output_segment::set_section_list_address): Cast
11483         expressions to unsigned long long type to avoid format warnings.
11484
11485 2009-10-15  Ian Lance Taylor  <iant@google.com>
11486
11487         * script.cc (Script_options::add_symbol_assignment): Always add a
11488         dot assignment to script_sections_.
11489         * script-sections.cc (Script_sections::add_dot_assignment):
11490         Initialize if necessary.
11491
11492         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11493         program headers with no load segment if there is a linker script.
11494
11495         * layout.cc (Layout::set_segment_offsets): Align the file offset
11496         to the segment aligment for -N or -n with no load segment.
11497         * output.cc (Output_segment::add_output_section): Don't crash if
11498         the first section is a TLS section.
11499         (Output_segment::set_section_list_addresses): Print an error
11500         message if the address moves backward in a linker script.
11501         * script-sections.cc
11502         (Output_section_element_input::set_section_addresses): Don't
11503         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11504         (Orphan_output_section::set_section_addresses): Likewise.
11505
11506 2009-10-15  Doug Kwan  <dougkwan@google.com>
11507
11508         * layout.cc (Layout::finish_dynamic_section): Generate tags
11509         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11510         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11511         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11512
11513 2009-10-14  Ian Lance Taylor  <iant@google.com>
11514
11515         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11516         fields.
11517         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11518         data_shdr fields of relinfo.
11519         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11520         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11521         R_386_TLS_LDO_32, adjust based on section flags.
11522         (Target_i386::Relocate::fix_up_ldo): Remove.
11523
11524 2009-10-13  Ian Lance Taylor  <iant@google.com>
11525
11526         Add support for -pie.
11527         * options.h (class General_options): Add -pie and
11528         --pic-executable.
11529         (General_options::output_is_position_independent): Test -pie.
11530         (General_options::output_is_executable): Return true if not shared
11531         and not relocatable.
11532         (General_options::output_is_pie): Remove.
11533         * options.cc (General_options::finalize): Reject incompatible uses
11534         of -pie.
11535         * gold.cc (queue_middle_tasks): A -pie link is not static.
11536         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11537         * symtab.cc (Symbol::final_value_is_known): Return false if
11538         output_is_position_independent.
11539         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11540         output_is_position_independent.
11541         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11542         output_is_position_independent.
11543         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11544         output_is_position_independent.
11545         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11546         two_file_pie_test.
11547         (basic_pie_test.o, basic_pie_test): New targets.
11548         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11549         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11550         (two_file_pie_test): New target.
11551         * testsuite/Makefile.in: Rebuild.
11552         * README: Remove note saying that -pie is not supported.
11553
11554 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11555
11556         * options.h (class General_options): Add -init and -fini.
11557         * layout.cc (Layout::finish_dynamic_section): Emit
11558         given init and fini functions.
11559
11560 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11561
11562         * gc.h (gc_process_relocs): Check if icf is enabled using new
11563         function.
11564         * gold.cc (queue_initial_tasks): Likewise.
11565         (queue_middle_tasks): Likewise.
11566         * object.cc (do_layout): Likewise.
11567         * symtab.cc (is_section_folded): Likewise.
11568         * main.cc (main): Likewise.
11569         * reloc.cc (Read_relocs::run): Likewise.
11570         (Sized_relobj::do_scan_relocs): Likewise.
11571         * icf.cc (is_function_ctor_or_dtor): New function.
11572         (Icf::find_identical_sections): Check if function is ctor or dtor when
11573         safe icf is chosen.
11574         * options.h (General_options::icf): Change option to be an enum.
11575         (Icf_status): New enum.
11576         (icf_enabled): New method.
11577         (icf_safe_folding): New method.
11578         (set_icf_status): New method.
11579         (icf_status_): New variable.
11580         * (options.cc) (General_options::finalize): Set icf_status_.
11581         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11582         icf_test and icf_keep_unique_test to use the --icf enum flag.
11583         * testsuite/icf_safe_test.sh: New file.
11584         * testsuite/icf_safe_test.cc: New file.
11585
11586 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11587
11588         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11589         includes to gc.h and icf.h.
11590         * arm.cc: Include gc.h.
11591         * gold.cc: Likewise.
11592         * i386.cc: Likewise.
11593         * powerpc.cc: Likewise.
11594         * sparc.cc: Likewise.
11595         * x86_64.cc: Likewise.
11596         * gc.h: Include icf.h.
11597
11598 2009-10-11  Ian Lance Taylor  <iant@google.com>
11599
11600         * plugin.cc: Include "gold.h" before other header files.
11601
11602 2009-10-10  Chris Demetriou  <cgd@google.com>
11603
11604         * options.h (Input_file_argument::Input_file_type): New enum.
11605         (Input_file_argument::is_lib_): Replace with...
11606         (Input_file_argument::type_): New member.
11607         (Input_file_argument::Input_file_argument): Take Input_file_type
11608         'type' rather than boolean 'is_lib' as second argument.
11609         (Input_file_argument::is_lib): Use type_.
11610         (Input_file_argument::is_searched_file): New function.
11611         (Input_file_argument::may_need_search): Handle is_searched_file.
11612         * options.cc (General_options::parse_library): Support -l:filename.
11613         (General_options::parse_just_symbols): Update for Input_file_argument
11614         changes.
11615         (Command_line::process): Likewise.
11616         * archive.cc (Archive::get_file_and_offset): Likewise.
11617         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11618         * script.cc (read_script_file, script_add_file): Likewise.
11619         * fileread.cc (Input_file::Input_file): Likewise.
11620         (Input_file::will_search_for): Handle is_searched_file.
11621         (Input_file::open): Likewise.
11622         * readsyms.cc (Read_symbols::get_name): Likewise.
11623         * testsuite/Makefile.am (searched_file_test): New test.
11624         * testsuite/Makefile.in: Regenerate.
11625         * testsuite/searched_file_test.cc: New file.
11626         * testsuite/searched_file_test_lib.cc: New file.
11627
11628 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11629             Ian Lance Taylor  <iant@google.com>
11630
11631         * descriptor.cc: Include <cstdio> and "binary-io.h".
11632         (Descriptors::open): Open the files in binary mode always.
11633         * script.cc (Lex::get_token): Treat \r as whitespace.
11634
11635 2009-10-09  Ian Lance Taylor  <iant@google.com>
11636
11637         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11638
11639 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11640             Ian Lance Taylor  <iant@google.com>
11641
11642         * configure.ac: Check for readv function also.
11643         * fileread.cc (readv): Define if not HAVE_READV.
11644         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11645         does not exist.
11646         * config.in: Regenerate.
11647         * configure: Regenerate.
11648
11649 2009-10-09  Doug Kwan  <dougkwan@google.com>
11650
11651         * layout.cc (Layout::make_output_section): Call target hook to make
11652         ordinary output section.
11653         (Layout::finalize): Adjust parameter list of call the
11654         Target::may_relax().
11655         * layout.h (class Layout::section_list): New method.
11656         * merge.h (Output_merge_base::entsize): Change visibility to public.
11657         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11658         New methods.
11659         (Output_merge_string::do_is_string): New method.
11660         * object.cc (Sized_relobj::do_setup): renamed from
11661         Sized_relobj::set_up.
11662         * object.h (Sized_relobj::adjust_shndx,
11663         Sized_relobj::initializ_input_to_output_maps,
11664         Sized_relobj::free_input_to_output_maps): Change visibilities to
11665         protected.
11666         (Sized_relobj::setup): Virtualize.
11667         (Sized_relobj::do_setup): New method declaration.
11668         (Sized_relobj::invalidate_section_offset,
11669         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11670         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11671         * options.cc (parse_int): New function.
11672         * options.h (parse_int): New declaration.
11673         (DEFINE_int): New macro.
11674         (stub_group_size): New option.
11675         * output.cc (Output_section::Output_section): Initialize memebers
11676         merge_section_map_, merge_section_by_properties_map_,
11677         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11678         (Output_section::add_input_section): Handled deferred code-fill
11679         generation and remove an old comment.
11680         (Output_section::add_relaxed_input_section): New method definition.
11681         (Output_section::add_merge_input_section): Use merge section by
11682         properties map to speed to search.  Update merge section maps
11683         as appropriate.
11684         (Output_section::build_relaxation_map): New method definition.
11685         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11686         Same.
11687         (Output_section::relax_input_section): Renamed to
11688         Output_section::convert_input_sections_to_relaxed_sections and change
11689         interface to take a vector of pointers to relaxed sections.
11690         (Output_section::find_merge_section,
11691         Output_section::find_relaxed_input_section): New method definitions.
11692         (Output_section::is_input_address_mapped,
11693         Output_section::output_offset, Output_section::output_address):
11694         Use output section data maps to speed up searching.
11695         (Output_section::find_starting_output_address): Add comments.
11696         (Output_section::do_write,
11697         Output_section::write_to_postprocessing_buffer): Do code-fill
11698         generation as appropriate.
11699         (Output_section::get_input_sections): Invalidate relaxed input section
11700         map.
11701         (Output_section::restore_states): Adjust type of checkpoint .
11702         Invalidate relaxed input section map.
11703         * output.h (Output_merge_base): New class declaration.
11704         (Input_section_specifier): New class defintion.
11705         (class Output_relaxed_input_section) Change base class to
11706         Output_section_data_build.
11707         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11708         base class initializer.
11709         (Output_section::add_relaxed_input_section): New method declaration.
11710         (Output_section::Input_section): Change visibility to protected.
11711         (Output_section::Input_section::relobj,
11712         Output_section::Input_section::shndx): Handle relaxed input sections.
11713         Output_section::input_sections) Change visibility to protected.  Also
11714         define overload to return a non-const pointer.
11715         (Output_section::Merge_section_properties): New class defintion.
11716         (Output_section::Merge_section_by_properties_map,
11717         Output_section::Output_section_data_by_input_section_map,
11718         Output_section::Relaxation_map): New types.
11719         (Output_section::relax_input_section): Rename method to
11720         Output_section::convert_input_sections_to_relaxed_sections and change
11721         interface to take a vector of relaxed section pointers.
11722         (Output_section::find_merge_section,
11723         Output_section::find_relaxed_input_section,
11724         Output_section::build_relaxation_map,
11725         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11726         New method declarations.
11727         (Output_section::merge_section_map_
11728         Output_section::merge_section_by_properties_map_,
11729         Output_section::relaxed_input_section_map_,
11730         Output_section::is_relaxed_input_section_map_valid_,
11731         Output_section::generate_code_fills_at_write_): New data members.
11732         * script-sections.cc
11733         (Output_section_element_input::set_section_addresses): Call
11734         current_data_size and addralign methods of relaxed input sections.
11735         (Orphan_output_section::set_section_addresses): Call current_data_size
11736         and addralign methods of relaxed input sections.
11737         * symtab.cc (Symbol_table::compute_final_value): Extract template
11738         from the body of Symbol_table::sized_finalize_symbol.
11739         (Symbol_table::sized_finalized_symbol): Call
11740         Symbol_table::compute_final_value.
11741         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11742         (Symbol_table::compute_final_value): New templated method declaration.
11743         * target.cc (Target::do_make_output_section): New method defintion.
11744         * target.h (Target::make_output_section): New method declaration.
11745         (Target::relax): Add more parameters for input objects, symbol table
11746         and layout.  Adjust call to do_relax.
11747         (Target::do_make_output_section): New method declaration.
11748         (Target::do_relax): Add parameters for input objects, symbol table
11749         and layout.
11750
11751 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11752
11753         * pread.c: Include stdio.h.
11754
11755 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11756
11757         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11758         defined.
11759
11760 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11761
11762         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11763         Change read_shndx type to unsigned int.
11764         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11765         int.
11766         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11767         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11768         Change read_shndx type to unsigned int.
11769         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11770         int.
11771         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11772         * layout.cc (Layout::create_symtab_sections): Cast the result of
11773         local_symcount * symsize to off_t in the gold_assert.
11774
11775 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11776
11777         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11778         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11779         R_ARM_BASE_ABS.
11780         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11781         (Arm_relocate_functions::thm_abs5): New function.
11782         (Arm_relocate_functions::abs12): New function.
11783         (Arm_relocate_functions::abs16): New function.
11784         (Arm_relocate_functions::base_abs): New function.
11785         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11786         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11787         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11788         R_ARM_BASE_ABS.
11789         (Scan::global): Likewise.
11790         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11791         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11792         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11793         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11794         R_ARM_BASE_ABS.
11795
11796 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11797
11798         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11799         (Arm_relocate_functions::movt_prel): New function.
11800         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11801         (Arm_relocate_functions::thm_movt_prel): New function.
11802         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11803         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11804         (Scan::global, Relocate::relocate): Likewise.
11805         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11806
11807 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11808
11809         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11810         Incremental_checker.
11811         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11812         unsigned int.
11813         (class Incremental_inputs_header): New class.
11814         (Incremental_inputs_header_writer): Edit comment.
11815         (Incremental_inputs_entry): New class.
11816         (Incremental_inputs_entry_writer): Edit comment.
11817         (Sized_incremental_binary::do_find_incremental_inputs_section):
11818         Add *strtab_shndx parameter, fill it.
11819         (Sized_incremental_binary::do_check_inputs): New method.
11820         (Incremental_checker::can_incrementally_link_output_file): Use
11821         Sized_incremental_binary::check_inputs.
11822         (Incremental_inputs::report_command_line): Save command line in
11823         command_line_.
11824         * incremental.h:
11825         (Incremental_binary::find_incremental_inputs_section): New
11826         method.
11827         (Incremental_binary::do_find_incremental_inputs_section): Add
11828         strtab_shndx parameter.
11829         (Incremental_binary::do_check_inputs): New pure virtual method.
11830         (Sized_incremental_binary::do_check_inputs): Declare.
11831         (Incremental_checker::Incremental_checker): Add incremental_inputs
11832         parameter, use it to initialize incremental_inputs_.
11833         (Incremental_checker::incremental_inputs_): New field.
11834         (Incremental_checker::command_line): New method.
11835         (Incremental_checker::inputs): New method.
11836         (Incremental_checker::command_line_): New field.
11837
11838 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11839
11840         * incremental.cc: Include <cstdarg> and "target-select.h".
11841         (vexplain_no_incremental): New function.
11842         (explain_no_incremental): New function.
11843         (Incremental_binary::error): New method.
11844         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11845         method.
11846         (make_sized_incremental_binary): New function.
11847         (open_incremental_binary): New function.
11848         (can_incrementally_link_file): Add checks if output is ELF and has
11849         inputs section.
11850         * incremental.h: Include "elfcpp_file.h" and "output.h".
11851         (Incremental_binary): New class.
11852         (Sized_incremental_binary): New class.
11853         (open_incremental_binary): Declare.
11854         * object.cc (is_elf_object): Use
11855         elfcpp::Elf_recognizer::is_elf_file.
11856         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11857         * output.h (Output_file::filesize): New method.
11858
11859 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11860
11861         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11862         New function.
11863         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11864         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11865         function.
11866         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11867         function.
11868         (Arm_relocate_functions::movw_abs_nc): New function.
11869         (Arm_relocate_functions::movt_abs): New function.
11870         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11871         (Arm_relocate_functions::thm_movt_abs): New function.
11872         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11873         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11874         (Scan::global): Likewise.
11875         (Relocate::relocate): Likewise.
11876         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11877
11878 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11879
11880         * arm.cc (Arm_relocate_functions::got_prel) New function.
11881         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11882         (Relocate::relocate): Likewise.
11883         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11884
11885 2009-10-06  Ian Lance Taylor  <iant@google.com>
11886
11887         * options.h (class General_options): Define
11888         split_stack_adjust_size parameter.
11889         * object.h (class Object): Add uses_split_stack_ and
11890         has_no_split_stack_ fields.  Add uses_split_stack and
11891         has_no_split_stack accessor functions.  Declare
11892         handle_split_stack_section.
11893         (class Reloc_symbol_changes): Define.
11894         (class Sized_relobj): Define Function_offsets.  Declare
11895         split_stack_adjust, split_stack_adjust_reltype, and
11896         find_functions.
11897         * object.cc (Object::handle_split_stack_section): New function.
11898         (Sized_relobj::do_layout): Call handle_split_stack_section.
11899         * dynobj.cc (Sized_dynobj::do_layout): Call
11900         handle_split_stack_section.
11901         * reloc.cc (Sized_relobj::relocate_sections): Call
11902         split_stack_adjust for executable sections in split_stack
11903         objects.  Pass reloc_map to relocate_section.
11904         (Sized_relobj::split_stack_adjust): New function.
11905         (Sized_relobj::split_stack_adjust_reltype): New function.
11906         (Sized_relobj::find_functions): New function.
11907         * target-reloc.h: Include "object.h".
11908         (relocate_section): Add reloc_symbol_changes parameter.  Change
11909         all callers.
11910         * target.h (class Target): Add calls_non_split method.  Declare
11911         do_calls_non_split virtual method.  Declare match_view and
11912         set_view_to_nop.
11913         * target.cc: Include "elfcpp.h".
11914         (Target::do_calls_non_split): New function.
11915         (Target::match_view): New function.
11916         (Target::set_view_to_nop): New function.
11917         * gold.cc (queue_middle_tasks): Give an error if mixing
11918         split-stack and non-split-stack objects with -r.
11919         * i386.cc (Target_i386::relocate_section): Add
11920         reloc_symbol_changes parameter.
11921         (Target_i386::do_calls_non_split): New function.
11922         * x86_64.cc (Target_x86_64::relocate_section): Add
11923         reloc_symbol_changes parameter.
11924         (Target_x86_64::do_calls_non_split): New function.
11925         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11926         parameter.
11927         * powerpc.cc (Target_powerpc::relocate_section): Add
11928         reloc_symbol_changes parameter.
11929         * sparc.cc (Target_sparc::relocate_section): Add
11930         reloc_symbol_changes parameter.
11931         * configure.ac: Call AM_CONDITIONAL for the default target.
11932         * configure: Rebuild.
11933         * testsuite/Makefile.am (TEST_AS): New variable.
11934         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11935         (check_DATA): Add split_i386 and split_x86_64 files.
11936         (SPLIT_DEFSYMS): Define.
11937         (split_i386_[1234n].o): New targets.
11938         (split_i386_[124]): New targets.
11939         (split_i386_[1234r].stdout): New targets.
11940         (split_x86_64_[1234n].o): New targets.
11941         (split_x86_64_[124]): New targets.
11942         (split_x86_64_[1234r].stdout): New targets.
11943         (MOSTLYCLEANFILES): Add new executables.
11944         * testsuite/split_i386.sh: New file.
11945         * testsuite/split_x86_64.sh: New file.
11946         * testsuite/split_i386_1.s: New file.
11947         * testsuite/split_i386_2.s: New file.
11948         * testsuite/split_i386_3.s: New file.
11949         * testsuite/split_i386_4.s: New file.
11950         * testsuite/split_i386_n.s: New file.
11951         * testsuite/split_x86_64_1.s: New file.
11952         * testsuite/split_x86_64_2.s: New file.
11953         * testsuite/split_x86_64_3.s: New file.
11954         * testsuite/split_x86_64_4.s: New file.
11955         * testsuite/split_x86_64_n.s: New file.
11956         * testsuite/testfile.cc (Target_test): Update relocation_section
11957         function.
11958         * testsuite/Makefile.in: Rebuild.
11959
11960 2009-10-06  Ian Lance Taylor  <iant@google.com>
11961
11962         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11963         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11964         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11965         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11966         the address on ldo_addrs_.
11967         (Target_i386::Relocate::fix_up_ldo): New function.
11968
11969 2009-10-06   Rafael Espindola  <espindola@google.com>
11970
11971         * plugin.cc (add_input_library): New.
11972         (Plugin::load): Add add_input_library to tv.
11973         (Plugin_manager::add_input_file): Add the is_lib argument.
11974         (add_input_file): Update call to Plugin_manager::add_input_file.
11975         (add_input_library): New.
11976         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11977
11978 2009-09-30  Doug Kwan  <dougkwan@google.com>
11979
11980         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11981         symbol and call Symbol::may_need_copy_reloc to determine if
11982         a copy reloc is needed.
11983         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11984         nocopyreloc is given in command line.
11985         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11986         given in command line.
11987         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11988         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11989         of the removed Target_i386::may_need_copy_reloc.
11990         * options.h (copyreloc): New option with default value false.
11991         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11992         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11993         instead of the removed Target_powerpc::may_need_copy_reloc.
11994         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11995         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11996         instead of the removed Target_sparc::may_need_copy_reloc.
11997         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11998         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11999         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12000         instead of the removed Target_x86_64::may_need_copy_reloc.
12001
12002 2009-09-30  Ian Lance Taylor  <iant@google.com>
12003
12004         * object.h (class Object): Remove target_ field, and target,
12005         sized_target, and set_target methods.
12006         (Object::sized_target): Remove.
12007         (class Sized_relobj): Update declarations.  Remove sized_target.
12008         * object.cc (Sized_relobj::setup): Remove target parameter.
12009         Change all callers.
12010         (Input_objects::add_object): Don't do anything with the target.
12011         (make_elf_sized_object): Add punconfigured parameter.  Change all
12012         callers.  Set or test parameter target.
12013         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12014         Change all callers.
12015         * parameters.cc (Parameters::set_target): Change parameter type to
12016         be non-const.
12017         (Parameters::default_target): Remove.
12018         (set_parameters_target): Change parameter type to be non-const.
12019         (parameters_force_valid_target): New function.
12020         (parameters_clear_target): New function.
12021         * parameters.h (class Parameters): Update declarations.  Remove
12022         default_target method.  Add sized_target and clear_target
12023         methods.  Change target_ to be non-const.
12024         (set_parameters_target): Update declaration.
12025         (parameters_force_valid_target): Declare.
12026         (parameters_clear_target): Declare.
12027         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12028         as NULL if we aren't searching.
12029         (Add_symbols::run): Don't check for compatible target.
12030         * fileread.cc (Input_file::open_binary): Call
12031         parameters_force_valid_target.
12032         * gold.cc (queue_middle_tasks): Likewise.
12033         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12034         set_target on object.
12035         * dynobj.h (class Sized_dynobj): Update declarations.
12036         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12037         make_elf_object returns NULL.
12038         (Archive::include_member): Don't check whether object target is
12039         compatible.
12040         * output.cc (Output_section::add_input_section): Get target from
12041         parameters.
12042         (Output_section::relax_input_section): Likewise.
12043         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12044         parameters.
12045         (Sized_relobj::do_scan_relocs): Likewise.
12046         (Sized_relobj::relocate_sections): Likewise.
12047         * resolve.cc (Symbol_table::resolve): Likewise.
12048         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12049         parameter.  Change all callers.
12050         (Symbol_table::add_from_object): Get target from parameters.
12051         (Symbol_table::add_from_relobj): Don't check object target.
12052         (Symbol_table::add_from_dynobj): Likewise.
12053         (Symbol_table::define_special_symbol): Get target from
12054         parameters.
12055         * symtab.h (class Symbol_table): Update declaration.
12056         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12057         parameter.  Change all callers.  Clear parameter target.
12058         (Binary_test): Test target here.
12059         * testsuite/object_unittest.cc (gold_testsuite): Remove
12060         target_test_pointer parameter.  Change all callers.
12061         (Object_test): Test target here.
12062
12063 2009-09-26  Ian Lance Taylor  <iant@google.com>
12064
12065         * testsuite/initpri1.c: Don't try to use constructor priorities if
12066         compiling with gcc before 4.3.
12067
12068 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12069
12070         * testsuite/retain_symbols_file_test.sh (check_present): Change
12071         output file name to retain_symbols_file_test.stdout.
12072         (check_absent): Likewise.
12073
12074 2009-09-18  Craig Silverstein  <csilvers@google.com>
12075
12076         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12077         * options.cc: Include <cerrno> and <fstream>.
12078         (General_options::finalize): Parse -retain-symbols-file tag.
12079         * options.h: New flag.
12080         (General_options): New method should_retain_symbol, new
12081         variable symbols_to_retain.
12082         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12083         should_retain_symbol map.
12084         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12085         * testsuite/Makefile.in: Regenerate.
12086         * testsuite/retain_symbols_file_test.sh: New file.
12087
12088 2009-09-18  Nick Clifton  <nickc@redhat.com>
12089
12090         * po/es.po: Updated Spanish translation.
12091
12092 2009-09-17  Doug Kwan  <dougkwan@google.com>
12093
12094         * debug.h (DEBUG_RELAXATION): New constant.
12095         (DEBUG_ALL): Add DEBUG_RELAXATION.
12096         (debug_string_to_enum): Add relaxation debug option.
12097         * layout.cc
12098         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12099         Layout::Relaxation_debug_check::read_sections,
12100         Layout::Relaxation_debug_check::read_sections): New method definitions.
12101         (Layout::Layout): Initialize data members
12102         record_output_section_data_from_scrips_,
12103         script_output_section_data_list_ and relaxation_debug_check_.
12104         (Layout::save_segments, Layout::restore_segments,
12105         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12106         Layout::relaxation_loop_body): New method definitions.
12107         (Layout::finalize): Support relaxation.  Move section layout code to
12108         Layout::relaxation_loop_body.
12109         (Layout::set_asection_address_from_script): Move code for orphan
12110         section placement out.
12111         (Layout::place_orphan_sections_in_script): New method definition.
12112         * layout.h (Output_segment_headers, Output_file_header):
12113         New forward class declarations.
12114         (Layout::~Layout): Define.
12115         (Layout::new_output_section_data_from_script): New method definition.
12116         (Layout::place_orphan_sections_in_script): New method declaration.
12117         (Layout::Segment_states): New type declaration.
12118         (Layout::save_segments, Layout::restore_segments,
12119         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12120         Layout::relaxation_loop_body): New method declarations.
12121         (Layout::Output_section_data_list): New type declaration.
12122         (Layout::Relaxation_debug_check): New class definition.
12123         (Layout::record_output_section_data_from_script_,
12124         Layout::script_output_section_data_list_, Layout::segment_states_,
12125         Layout::relaxation_debug_check_): New data members.
12126         * output.cc: (Output_section_headers::do_size): New method definition.
12127         (Output_section_headers::Output_section_headers): Move size
12128         computation to Output_section_headers::do_size.
12129         (Output_segment_headers::do_size): New method definition.
12130         (Output_file_header::Output_file_header): Move size computation to
12131         Output_file_header::do_size and call it.
12132         (Output_file_header::do_size): New method definition.
12133         (Output_data_group::Output_data_group): Adjust call to
12134         Output_section_data.
12135         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12136         (Output_symtab_xindex::do_write): Add array bound check.
12137         (Output_section::Input_section::print_to_mapfile): Handle
12138         RELAXED_INPUT_SECTION_CODE.
12139         (Output_section::Output_section): Initialize data member checkpoint_.
12140         (Output_section::~Output_section): Delete checkpoint object pointed
12141         by checkpoint_.
12142         (Output_section::add_input_section): Always add an Input_section if
12143         relaxing.
12144         (Output_section::add_merge_input_section): Add assert.
12145         (Output_section::relax_input_section): New method definition.
12146         (Output_section::set_final_data_size): Set load address to zero for
12147         an unallocated section.
12148         (Output_section::do_address_and_file_offset_have_reset_values):
12149         New method definition.
12150         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12151         Handle relaxed input section.
12152         (Output_section::sort_attached_input_sections): Checkpoint input
12153         section list lazily.
12154         (Output_section::get_input_sections): Change type of input_sections to
12155         list of Simple_input_section pointers.  Checkpoint input section list
12156         lazily.  Also handle relaxed input sections.
12157         (Output_section::add_input_section_for_script): Take a reference to
12158         a Simple_input_section object instead of Relobj pointer and section
12159         index as parameter.  Handle relaxed input sections.
12160         (Output_section::save_states, Output_section::restore_states): New
12161         method definitions.
12162         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12163         (Output_data::is_data_size_fixed): New method definition.
12164         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12165         if it is fixed.
12166         (Output_data::address_and_file_offset_have_reset_values): New method
12167         definition.
12168         (Output_data::do_address_and_file_offset_have_reset_values): New method
12169         definition.
12170         (Output_data::set_data_size): Check that data size is not fixed.
12171         (Output_data::fix_data_size): New method definition.
12172         (Output_data::is_data_size_fixed_): New data member.
12173         (Output_section_headers::set_final_data_size): New method definition.
12174         (Output_section_headers::do_size): New method declaration.
12175         (Output_segment_headers::set_final_data_size): New method definition.
12176         (Output_segment_headers::do_size): New method declaration.
12177         (Output_file_header::set_final_data_size)::New method definition.
12178         (Output_file_header::do_size)::New method declaration.
12179         (Output_section_data::Output_section_data): Add new parameter
12180         is_data_size_fixed and use it to fix data size.
12181         (Output_data_const::Output_data_const): Adjust call to base class
12182         constructor and fix data size.
12183         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12184         base class constructor and fix data size.
12185         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12186         base class constructor and fix data size.
12187         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12188         class constructor and fix data size.
12189         (Output_data_group::set_final_data_size): New method definition.
12190         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12191         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12192         class constructor and fix data size.
12193         (Output_relaxed_input_section): New class definition.
12194         (Output_section::Simple_input_section): New class definition.
12195         (Output_section::get_input_sections): Adjust parameter list.
12196         (Output_section::add_input_section_for_script): Same.
12197         (Output_section::save_states, Output_section::restore_states,
12198         Output_section::do_address_and_file_offset_have_reset_values,
12199         (Output_section::Input_section::Input_section): Handle
12200         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12201         Output_relaxed_input_section.
12202         (Output_section::Input_section::is_input_section,
12203         Output_section::Input_section::set_output_section): Handle relaxed
12204         input section.
12205         (Output_section::Input_section::is_relaxed_input_section,
12206         Output_section::Input_section::output_section_data,
12207         Output_section::Input_section::relaxed_input_section): New method
12208         definitions.
12209         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12210         value.
12211         (Output_section::Input_section::u1_): Update comments.
12212         (Output_section::Input_section::u2_): Add new union member poris.
12213         (Output_section::Checkpoint_output_section): New classs definition.
12214         (Output_section::relax_input_section): New method declaration.
12215         (Output_section::checkpoint_): New data member.
12216         (Output_segment): Update comments.
12217         (Output_segment::Output_segment): Un-privatize copy constructor.
12218         (Output_segment::operator=): Un-privatize.
12219         * script-sections.cc (Output_section_element::Input_section_list):
12220         Change element type to Output_section::Simple_input_section.
12221         (Output_section_element_dot_assignment::set_section_addresses):
12222         Register output section data for relaxation clean up.
12223         (Output_data_exression::Output_data_expression): Adjust call to base
12224         constructor to fix data size.
12225         (Output_section_element_data::set_section_addresses): Register
12226         Output_data_expression object for relaxation clean up.
12227         (struct Input_section_info): Replace Relobj pointer and section index
12228         pair with Output_section::Simple_input_section and Convert struct to a
12229         class.
12230         (Input_section_sorter::operator()): Adjust access to
12231         Input_section_info data member to use accessors.
12232         (Output_section_element_input::set_section_addresses): Use layout
12233         parameter.  Adjust code to use Output_section::Simple_input_section
12234         and Input_secction_info classes.  Register filler for relaxation
12235         clean up.
12236         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12237         and section index pair with Output_section::Simple_input_section
12238         class.  Adjust code accordingly.
12239         (Phdrs_element::release_segment): New method definition.
12240         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12241         segment list.
12242         (Script_sections::release_segments): New method definition.
12243         * gold/script-sections.h (Script_sections::release_segments): New
12244         method declaration.
12245         * gold/target.h (Target::may_relax, Target::relax,
12246         Target::do_may_relax, Target::do_relax): New method definitions.
12247
12248 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12249
12250         * arm.cc (has_signed_unsigned_overflow): New function.
12251         (Arm_relocate_functions::abs8): New function.
12252         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12253         (Target_arm::Scan::global): Likewise.
12254         (Target_arm::relocate::relocate): Likewise.
12255         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12256         Likewise.
12257
12258 2009-09-16  Cary Coutant  <ccoutant@google.com>
12259
12260         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12261         * testsuite/Makefile.in: Regenerate.
12262
12263 2009-09-11  Nick Clifton  <nickc@redhat.com>
12264
12265         * po/gold.pot: Updated by the Translation project.
12266
12267 2009-09-08  Cary Coutant  <ccoutant@google.com>
12268
12269         * output.cc (Output_file::open): Add execute permission to empty file.
12270         * testsuite/Makefile.am (permission_test): New test.
12271         * testsuite/Makefile.in: Regenerate.
12272
12273 2009-09-02  Ian Lance Taylor  <iant@google.com>
12274
12275         * output.cc (Output_file::resize): Call map_no_anonymous rather
12276         than map.
12277
12278 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12279
12280         * gold.cc: Include "incremental.h".
12281         (queue_initial_tasks): Call Incremental_checker methods.
12282         * incremental.cc: Include "output.h".
12283         (Incremental_checker::can_incrementally_link_output_file): New
12284         method.
12285         * incremental.h (Incremental_checker): New class.
12286
12287         * output.cc (Output_file::open_for_modification): New method.
12288         (Output_file::map_anonymous): Changed return type to bool.  Record
12289         map in base_ field.
12290         (Output_file::map_no_anonymous): New method, broken out of map.
12291         (Output_file::map): Use map_no_anonymous and map_anonymous.
12292         * output.h (class Output_file): Update declarations.
12293
12294 2009-08-24  Cary Coutant  <ccoutant@google.com>
12295
12296         * options.h (Command_line::Pre_options): New class.
12297         (Command_line::pre_options): New member.
12298         * options.cc (gold::options::ready_to_register): New variable.
12299         (One_option::register_option): Do nothing if not registering options.
12300         Assert if same short option registered twice.
12301         (General_options::General_options): Turn off option registration when
12302         done constructing.
12303         (Command_line::Pre_options::Pre_options): New constructor.
12304
12305 2009-08-24  Cary Coutant  <ccoutant@google.com>
12306
12307         * options.h (General_options::no_keep_memory): Remove incorrect
12308         short option.
12309
12310 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12311
12312         * Makefile.am (am__skiplex, am__skipyacc): New.
12313         * Makefile.in: Regenerate.
12314
12315 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12316
12317         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12318         (INCLUDES): ... this.
12319         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12320         (AM_CPPFLAGS): Renamed from ...
12321         (INCLUDE): ... this.
12322         * Makefile.in, testsuite/Makefile.in: Regenerate.
12323
12324         * Makefile.in: Regenerate.
12325         * aclocal.m4: Likewise.
12326         * config.in: Likewise.
12327         * configure: Likewise.
12328         * testsuite/Makefile.in: Likewise.
12329
12330         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12331         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12332         * Makefile.in: Regenerate.
12333         * testsuite/Makefile.in: Regenerate.
12334
12335 2009-08-19  Cary Coutant  <ccoutant@google.com>
12336
12337         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12338         symbols in shared libraries overridden by hidden or internal symbols
12339         in the main program.
12340
12341 2009-08-19  Chris Demetriou  <cgd@google.com>
12342
12343         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12344         checking source file names in error messages.
12345
12346 2009-08-18  Doug Kwan  <dougkwan@google.com>
12347
12348         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12349         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12350         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12351         an elfcpp::Ehdr as parameter.
12352         * object.cc (Object::set_target): Remove the version that looks up
12353         a target and sets it.
12354         (Sized_relobj::setup): Take a Target object instead of
12355         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12356         (make_elf_sized_object): Find target and ask target to
12357         make an ELF object.
12358         * object.h: (Object::set_target): Remove the version that looks up
12359         a target and sets it.
12360         (Sized_relobj::setup): Take a Target object instead of
12361         an elfcpp:Ehdr as parameter.
12362         * target.cc: Include dynobj.h.
12363         (Target::do_make_elf_object_implementation): New.
12364         (Target::do_make_elf_object): New.
12365         * target.h (Target::make_elf_object): New template declaration.
12366         (Target::do_make_elf_object): New method declarations.
12367         (Target::do_make_elf_object_implementation): New template declaration.
12368
12369 2009-08-14  Ian Lance Taylor  <iant@google.com>
12370
12371         * gold.h (FUNCTION_NAME): Define.
12372         (gold_unreachable): Use FUNCTION_NAME.
12373
12374 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12375
12376         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12377         symbol in the --keep-unique list is not found.
12378
12379 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12380
12381         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12382         been maked as --keep-unique.
12383         (Icf::unfold_section): New function.
12384         * icf.h (Icf::unfold_section): New function.
12385         * options.h (General_options::keep_unique): New option.
12386         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12387         * testsuite/Makefile.in: Regenerate.
12388         * testsuite/icf_keep_unique_test.sh: New file.
12389         * testsuite/icf_keep_unique_test.cc: New file.
12390
12391 2009-08-12  Cary Coutant  <ccoutant@google.com>
12392
12393         PR 10471
12394         * resolve.cc (Symbol_table::resolve): Check for references from
12395         dynamic objects to hidden and internal symbols.
12396         * testsuite/Makefile.am (hidden_test.sh): New test.
12397         * testsuite/Makefile.in: Regenerate.
12398         * testsuite/hidden_test.sh: New script.
12399         * testsuite/hidden_test_1.c: New test source.
12400         * testsuite/hidden_test_main.c: New test source.
12401
12402 2009-08-11  Doug Kwan  <dougkwan@google.com>
12403
12404         * arm.cc: Update comments.
12405         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12406         segment to locate the .ARM.exidx section if present.
12407
12408 2009-08-09  Doug Kwan  <dougkwan@google.com>
12409
12410         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12411         patch.
12412
12413 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12414         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12415         compiler warnings.
12416
12417 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12418
12419         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12420         valid tls_segment only for non-debug-section relocations.
12421         * testsuite/Makefile.am: Add gc_tls_test.
12422         * testsuite/Makefile.in: Regenerate.
12423         * testsuite/gc_tls_test.cc: New file.
12424         * testsuite/gc_tls_test.sh: New file.
12425
12426 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12427
12428         * icf.cc: New file.
12429         * icf.h: New file.
12430         * Makefile.am (CCFILES): Add icf.cc.
12431         (HFILES): Add icf.h
12432         * Makefile.in: Regenerate.
12433         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12434         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12435         section, symbol and addend information for the relocs.
12436         * gold.cc (queue_middle_tasks): Call identical code folding.
12437         * gold.h: Add defines for multimap.
12438         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12439         to the call of finalize_local_symbols.
12440         * main.cc (main): Create object of class Icf.
12441         * object.cc (Sized_relobj::do_layout): Allow this function to be
12442         called twice during icf.
12443         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12444         to sections marked as identical by icf.
12445         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12446         when available.
12447         (Sized_relobj::do_section_entsize): New function.
12448         * object.h (Object::section_entsize): New function.
12449         (Object::do_section_entsize): New pure virtual function.
12450         (Relobj::finalize_local_symbols): Add new parameter.
12451         (Relobj::do_section_entsize): New function.
12452         * options.h (General_options::icf): New option.
12453         (General_options::icf_iterations): New option.
12454         (General_options::print_icf_sections): New option.
12455         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12456         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12457         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12458         icf.
12459         * symtab.cc (Symbol_table::is_section_folded): New function.
12460         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12461         to sections marked as identical by icf.
12462         * symtab.h (Symbol_table::set_icf): New function.
12463         (Symbol_table::icf): New function.
12464         (Symbol_table::is_section_folded): New function.
12465         (Symbol_table::icf_): New data member.
12466         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12467         * testsuite/Makefile.am: Add commands to build icf_test.
12468         * testsuite/Makefile.in: Regenerate.
12469         * testsuite/icf_test.sh: New file.
12470         * testsuite/icf_test.cc: New file.
12471
12472 2009-07-24  Chris Demetriou  <cgd@google.com>
12473
12474         * layout.cc (is_compressible_debug_section): Fix incorrect
12475         comment about compressed section names.
12476
12477 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12478
12479         PR 10419
12480         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12481
12482 2009-07-16  Ian Lance Taylor  <iant@google.com>
12483
12484         PR 10400
12485         * layout.h: #include <map>.
12486         (class Kept_section): Change from struct to class.  Add accessors
12487         and setters.  Add section size to Comdat_group mapping.  Change
12488         Comdat_group to std::map.  Add is_comdat_ field.  Add
12489         linkonce_size field in union.
12490         (class Layout): Update declaration of find_or_add_kept_section.
12491         Don't declare find_kept_object.
12492         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12493         parameter.  Add object, shndx, is_comdat, and is_group_name
12494         parameters.  Change all callers.  Adjust for new Kept_section.
12495         (Layout::find_kept_object): Remove.
12496         * object.cc (Sized_relobj::include_section_group): Update use of
12497         Kept_section.  Rename secnum to shndx.  Only record
12498         Kept_comdat_section if sections are the same size.
12499         (Sized_relobj::include_linkonce_section): Update use of
12500         Kept_section.  Only record Kept_comdat_section if sections are the
12501         same size.  Set size of linkonce section.
12502         (Sized_relobj::map_to_kept_section): Update call to
12503         get_kept_comdat_section.
12504         * object.h (class Sized_relobj): Rename fields in
12505         Kept_comdat_section to drop trailing underscores; change object
12506         field to Relobj*.  Change Kept_comdat_section_table to store
12507         struct rather than pointer.
12508         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12509         Add kept_object and kept_shndx parameters.  Change all callers.
12510         (Sized_relobj::get_kept_comdat_section): Change return type to
12511         bool.  Add kept_object and kept_shndx parameters.  Change all
12512         callers.
12513         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12514         Layout::find_or_add_kept_section.
12515
12516 2009-07-09  Ian Lance Taylor  <iant@google.com>
12517
12518         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12519         Reserve space in the hash table.
12520
12521 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12522
12523         * fileread.cc (File_read::get_mtime): New method.
12524         * fileread.h (Timespec): New structure.
12525         (File_read::get_mtime): New method.
12526         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12527         Renamed from timestamp_nsec.
12528         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12529         Elf_Xword.
12530         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12531         timestamp_nsec.
12532         (Incremental_inputs::report_archive): Save mtime; style fix.
12533         (Incremental_inputs::report_obejct): Save mtime; style fix.
12534         (Incremental_inputs::report_script): Save mtime; style fix.
12535         (Incremental_inputs::finalize_inputs): Style fix.
12536         (Incremental_inputs::finalize): Style fix.
12537         (Incremental_inputs::create_input_section_data): Store inputs
12538         mtime.
12539         * incremental.h (Incremental_inputs::report_script): Add mtime
12540         argument.
12541         (Incremental_inputs::Input_info::Input_info): Intialize only one
12542         union member.
12543         (Incremental_inputs::Input_info::archive): Move to nameless
12544         union.
12545         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12546         (Incremental_inputs::Input_info::script): Move to nameless union.
12547         (Incremental_inputs::mtime): New field.
12548         * script.cc (read_input_script): Pass file mtime to
12549         Incremental_input.
12550         * script.h (Script_info::inputs): Style fix.
12551
12552 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12553
12554         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12555         instead of 32.
12556
12557 2009-06-24  Ian Lance Taylor  <iant@google.com>
12558
12559         PR 10156
12560         * layout.cc (Layout::choose_output_section): If we find an
12561         existing section, update the flags.
12562         (Layout::create_notes): New function, broken out of
12563         Layout::finalize.
12564         (Layout::finalize): Don't create note sections.
12565         (Layout::create_note): Don't crash if linker script discards
12566         section.
12567         (Layout::create_gold_note): Likewise.
12568         (Layout::create_build_id): Likewise.  Don't set
12569         after_input_sections on the section.
12570         (Layout::create_executable_stack_info): Remove target parameter.
12571         Change caller.
12572         * layout.h (class Layout): Declare create_notes.  Update
12573         declaration of create_executable_stack_info.
12574         * gold.cc (queue_middle_tasks): Call create_notes.
12575         * output.cc (Output_section::update_flags_for_input_section): Move
12576         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12577         invalid.
12578         * output.h (Output_data::mark_address_invalid): New function.
12579         (class Output_section): Only declare, not define,
12580         update_flags_for_input_section.  Remove set_flags.
12581
12582 2009-06-24  Ian Lance Taylor  <iant@google.com>
12583
12584         * script-sections.cc (Output_section_definition::
12585         set_section_addresses): Rename shadowing local load_address to
12586         laddr.
12587
12588 2009-06-24  Ian Lance Taylor  <iant@google.com>
12589
12590         PR 10244
12591         * reloc.cc (relocate_sections): Skip empty relocation sections.
12592
12593 2009-06-23  Ian Lance Taylor  <iant@google.com>
12594
12595         PR 10156
12596         * layout.cc (Layout::create_note): Use choose_output_section
12597         rather than make_output_section.
12598
12599 2009-06-23  Ian Lance Taylor  <iant@google.com>
12600
12601         PR 10237
12602         * options.cc (General_options::parse_V): Set printed_version_.
12603         (General_options::General_options): Initialize printed_version_.
12604         * options.h (class General_options): Add printed_version_ field.
12605         * gold.cc (queue_initial_tasks): If there are no input files,
12606         don't give a fatal error if we printed the version information.
12607         (queue_middle_tasks): If using -r with a shared object, give a
12608         fatal error rather than an ordinary error.
12609
12610 2009-06-23  Ian Lance Taylor  <iant@google.com>
12611
12612         PR 10219
12613         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12614         (Layout::make_output_section): Set have_stabstr_section_ if we see
12615         a .stab*str section.
12616         (Layout::finalize): Call link_stabs_sections.
12617         (Layout::link_stabs_sections): New file.
12618         * layout.h (class Layout): Add have_stabstr_section_ field.
12619         Declare link_stabs_sections.
12620
12621 2009-06-23  Doug Kwan  <dougkwan@google.com>
12622
12623         * Makefile.am (libgold_a_LIBADD): New.
12624         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12625         * Makefile.in: Regenerate.
12626         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12627         * configure: Regenerate.
12628         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12629         * fileread.cc: Include sys/state.h
12630         * gold.h: Declare memmem and strndup if found missing.
12631         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12632
12633 2009-06-23  Ian Lance Taylor  <iant@google.com>
12634
12635         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12636         * configure: Rebuild.
12637
12638 2009-06-23  Ian Lance Taylor  <iant@google.com>
12639
12640         PR 10147
12641         * object.cc (Object::section_contents): Don't try to get a view if
12642         the section has length zero.
12643         (Object::handle_gnu_warning_section): If the section is empty, use
12644         the name of the section as the warning.
12645
12646 2009-06-23  Ian Lance Taylor  <iant@google.com>
12647
12648         PR 10133
12649         * stringpool.h (class Stringpool_template): Add optimize_ field.
12650         (Stringpool_template::set_optimize): New function.
12651         * stringpool.cc (Stringpool_template::Stringpool_template):
12652         Initialize optimize_ field.
12653         (Stringpool_template::set_string_offsets): Test local optimize
12654         fild rather than parameter.
12655         * layout.cc (Layout::Layout): Call set_optimize on the section
12656         name stringpool.
12657
12658 2009-06-22  Ian Lance Taylor  <iant@google.com>
12659
12660         PR 10030
12661         * yyscript.y: Parse TARGET.
12662         * script.cc (script_set_target): New function.
12663         * script-c.h (script_set_target): Declare.
12664         * options.cc (General_options::string_to_object_format): Rename
12665         from string_to_object_format in anonymous namespace.  Change
12666         callers.
12667         * options.h (class General_options): Declare
12668         string_to_object_format.
12669
12670 2009-06-22  Ian Lance Taylor  <iant@google.com>
12671
12672         * script-sections.cc (Script_sections::create_segments): Don't put
12673         program headers in a PT_LOAD segment if -n or -N.
12674
12675 2009-06-22  Ian Lance Taylor  <iant@google.com>
12676
12677         PR 10141
12678         * options.h (class General_options): Add -z lazy and -z now.  Sort
12679         -z options into alphabetical order.
12680         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12681
12682 2009-06-21  Ian Lance Taylor  <iant@google.com>
12683
12684         * layout.cc (Layout::make_output_section): Call
12685         Target::new_output_section.
12686         (Layout::attach_allocated_section_to_segment): Put large section
12687         sections in a separate load segment with the large segment flag
12688         set.
12689         (Layout::segment_precedes): Sort large data segments after other
12690         load segments.
12691         (align_file_offset): New static function.
12692         (Layout::set_segment_offsets): Use align_file_offset.
12693         * output.h (class Output_section): Add is_small_section_ and
12694         is_large_section_ fields.
12695         (Output_section::is_small_section): New function.
12696         (Output_section::set_is_small_section):  New function.
12697         (Output_section::is_large_section): New function.
12698         (Output_section::set_is_large_section): New function.
12699         (Output_section::is_large_data_section): New function.
12700         (class Output_segment): Add is_large_data_segment_ field.
12701         (Output_segment::is_large_data_segment): New function.
12702         (Output_segment::set_is_large_data_segment): New function.
12703         * output.cc (Output_section::Output_section): Initialize new
12704         fields.
12705         (Output_segment::Output_segment): Likewise.
12706         (Output_segment::add_output_section): Add assertion that large
12707         data sections always go in large data segments.  Force small data
12708         sections to the end of the list of data sections.  Force small BSS
12709         sections to the start of the list of BSS sections.  For large BSS
12710         sections to the end of the list of BSS sections.
12711         * symtab.h (class Symbol): Declare is_common_shndx.
12712         (Symbol::is_defined): Check Symbol::is_common_shndx.
12713         (Symbol::is_common): Likewise.
12714         (class Symbol_table): Define enum Commons_section_type.  Update
12715         declarations.  Add small_commons_ and large_commons_ fields.
12716         * symtab.cc (Symbol::is_common_shndx): New function.
12717         (Symbol_table::Symbol_table): Initialize new fields.
12718         (Symbol_table::add_from_object): Put small and large common
12719         symbols in the right list.
12720         (Symbol_table::sized_finalized_symbol): Check
12721         Symbol::is_common_shndx.
12722         (Symbol_table::sized_write_globals): Likewise.
12723         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12724         common symbol lists.  Don't call do_allocate_commons_list if the
12725         list is empty.
12726         (Symbol_table::do_allocate_commons_list): Remove is_tls
12727         parameter.  Add comons_section_type parameter.  Change all
12728         callers.  Handle small and large common symbols.
12729         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12730         Symbol::is_common_shndx.
12731         * resolve.cc (symbol_to_bits): Likewise.
12732         * target.h (Target::small_common_shndx): New function.
12733         (Target::small_common_section_flags): New function.
12734         (Target::large_common_shndx): New function.
12735         (Target::large_common_section_flags): New function.
12736         (Target::new_output_section): New function.
12737         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12738         small_common_section_flags, and large_common_section_flags
12739         fields.
12740         (Target::do_new_output_section): New virtual function.
12741         * arm.cc (Target_arm::arm_info): Initialize new fields.
12742         * i386.cc (Target_i386::i386_info): Likewise.
12743         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12744         Likewise.
12745         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12746         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12747         (Target_x86_64::do_new_output_section): New function.
12748         * configure.ac: Define conditional MCMODEL_MEDIUM.
12749         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12750         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12751         (large_LDFLAGS): Define.
12752         * testsuite/large.c: New file.
12753         * testsuite/testfile.cc (Target_test::test_target_info):
12754         Initialize new fields.
12755         * configure, testsuite/Makefile.in: Rebuild.
12756
12757 2009-06-05  Doug Kwan  <dougkwan@google.com>
12758
12759         * Makefile.am (CCFILES): Add target.cc.
12760         * Makefile.in: Regenerate.
12761         * i386.cc (class Target_i386): Define new virtual method to
12762         override do_is_local_label_name in parent.
12763         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12764         local symbols if --discard-locals or -X is given.
12765         * options.h (class General_options): Declare new options
12766         '--discard-locals' and '-X' for discarding locals.
12767         * target.h (class Target): Define new methods is_local_label_name.
12768         Declare new virtual method do_is_local_label_name.
12769         * target.cc: New file.
12770         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12771         (check_SCRIPTS): Add discard_locals_test.sh.
12772         (check_DATA): Add discard_local_tests.syms.
12773         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12774         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12775         * testsuite/Makefile.in: Regenerate.
12776         * testsuite/discard_locals_test.c: New file.
12777         * testsuite/discard_locals_test.sh: Same.
12778
12779 2009-06-05  Doug Kwan  <dougkwan@google.com>
12780
12781         * object.cc (Sized_relobj::Sized_relobj): Initialize
12782         discarded_eh_frame_shndx_ to -1U.
12783         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12784         section.
12785         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12786         a discarded .eh_frame section.
12787         (Sized_relobj::do_finalize_local_symbols): Ditto.
12788         * object.h (class Sized_relobj): Declare new member
12789         discarded_eh_frame_shndx_.
12790         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12791         (local_labels_test.o, local_labels_test): New rules.
12792         * testsuite/Makefile.in: Regenerate.
12793
12794 2009-06-04  Doug Kwan  <dougkwan@google.com>
12795
12796         * layout.cc (Layout::section_name_mapping): Add mapping for
12797         special ARM sections.
12798
12799 2009-06-03  Doug Kwan  <dougkwan@google.com>
12800
12801         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12802         (utils::has_overflow): Same.
12803
12804 2009-06-03  Ian Lance Taylor  <iant@google.com>
12805
12806         * layout.cc (Layout::section_name_mapping): New array, replacing
12807         Layout::linkonce_mapping.
12808         (Layout::section_name_mapping_count): New variable, replacing
12809         Layout::linkonce_mapping_count.
12810         (Layout::linkonce_output_name): Remove.
12811         (Layout::output_section_name): Rewrite.
12812         * layout.h (class Layout): Rename Linkonce_mapping to
12813         Section_name_mapping, linkonce_mapping to section_name_mapping,
12814         linkonce_mapping_count to section_name_mapping_count.  Don't
12815         declare linkonce_output_name.
12816
12817 2009-06-03  Doug Kwan  <dougkwan@google.com>
12818
12819         * gold/arm.cc (namespace utils): New.
12820         (Target_arm::reloc_is_non_pic): Define new method.
12821         (class Arm_relocate_functions): New.
12822         (Target_arm::Relocate::relocate): Handle relocation types used by
12823         Android.
12824
12825 2009-06-03  Ian Lance Taylor  <iant@google.com>
12826
12827         * arm.cc (Target_arm::scan::global): Use || instead of |.
12828
12829 2009-06-02  Doug Kwan  <dougkwan@google.com>
12830
12831         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12832         issued_non_pic_error_.
12833         (class Target_arm::Scan): Declare new method check_non_pic.
12834         Define new method symbol_needs_plt_entry.
12835         Declare new data member issued_non_pic_error_.
12836         (class Target_arm::Relocate): Declare new method
12837         should_apply_static_reloc.
12838         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12839         (Target_arm::Scan::check_non_pic): Define new method.
12840         (Target_arm::Scan::local): Handle a small subset of reloc types used
12841         by Android.
12842         (Target_arm::Scan::local): Same.
12843         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12844
12845 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12846
12847         * incremental.cc (Incremental_inputs::report_command_line): Filter
12848         out --incremental-* options.
12849
12850 2009-05-29  Doug Kwan  <dougkwan@google.com>
12851
12852         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12853         template class.
12854         (class Target_arm): Update comment.
12855         (Target_arm::Target_arm): Initialize new data members GOT_,
12856         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12857         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12858         and Target_arm::rel_dyn_section.
12859         Declare new_enum Target_arm::Got_type.
12860         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12861         and DYNBSS_.
12862         Update commments for member do_dynsym_value.
12863         (Target_arm::got_size, Target_arm::plt_section,
12864         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12865         new methods inside class defintion.
12866         (Target_arm::got_section): Define new method.
12867         (Target_arm::rel_dyn_section): Same.
12868         (Output_data_plt_arm): New template class.
12869         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12870         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12871         (Output_data_plt_arm::add_entry): Same.
12872         (Output_data_plt_arm::first_plt_entry): Define new
12873         static data member for PLT instruction template.
12874         (Output_data_plt_arm::plt_entry): Same.
12875         (Output_data_plt_arm::do_write): Define new method.
12876         (Target_arm::make_plt_entry): Same.
12877         (Target_arm::do_finalize_sections): Same.
12878         (Target_arm::do_dynsym_value): Same.
12879
12880 2009-05-28  Doug Kwan  <dougkwan@google.com>
12881
12882         * Makefile.am (TARGETSOURCES): Add arm.cc.
12883         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12884         * Makefile.in: Regenerate.
12885         * arm.cc: New file.
12886         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12887
12888 2009-05-26  Doug Kwan  <dougkwan@google.com>
12889
12890         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12891         (General_options::check_excluded_libs): Strip off directories in
12892         archive name before matching like GNU ld does.
12893         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12894         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12895         (exclude_libs_test_LDFLAGS): Add linker option
12896         -Wl,--exclude-libs,libexclude_libs_test_3
12897         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12898         an explicit archive without using -l.
12899         (alt/libexclude_libs_test_3.a): New make rule.
12900         * testsuite/Makefile.in: Regenerate.
12901         * testsuite/exclude_libs_test.c : Declare lib3_default().
12902         (main): Call it.
12903         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12904         * exclude_libs_test_3.c: New file.
12905
12906 2009-05-26  Nick Clifton  <nickc@redhat.com>
12907
12908         * po/id.po: New Indonesian translation.
12909         * po/gold.pot: Updated template file.
12910
12911 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12912
12913         * testsuite/Makefile.am: Add -ffunction-sections to compile
12914         gc_comdat_test files.  Add -Wl,--gc-sections to build
12915         gc_comdat_test.
12916         * testsuite/Makefile.in: Regenerate.
12917         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12918
12919 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12920
12921         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12922         kept comdat section was garbage collected.
12923         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12924         * testsuite/Makefile.in: Regenerate.
12925         * testsuite/gc_comdat_test.sh: New file.
12926         * testsuite/gc_comdat_test_1.cc: New file.
12927         * testsuite/gc_comdat_test_2.cc: New file.
12928
12929 2009-05-19  Doug Kwan  <dougkwan@google.com>
12930
12931         * archive.cc (Archive::Archive): Move constructor from archive.h
12932         to here.  Initialize no_export_.
12933         (Archive::get_elf_object_for_member): Set no_export flag of object.
12934         * archive.h (Archive::Archive): Move constructor body to
12935         archive.cc.
12936         (Archive::no_export): New method.
12937         (Archive::no_export_): New field.
12938         * object.h (Object::Object): Initialize no_export_ to false.
12939         (Object::no_export, Object::set_no_export): New methods.
12940         (Object::no_export_): New field.
12941         * options.cc (General_options::parse_exclude_libs): New method.
12942         (General_options::check_excluded_libs) Same.
12943         * options.h (exclude_libs): New option.
12944         (General_options::check_excluded_libs): New method declaration.
12945         (General_options::excluded_libs_): New field.
12946         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12947         default or protected visibility if an object has no-export flag set.
12948         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12949         (check_SCRIPTS): Add exclude_libs_test.sh.
12950         (check_DATA): Add exclude_libs_test.syms.
12951         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12952         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12953         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12954         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12955         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12956         libexclude_libs_test_2.a): New rules.
12957         * testsuite/Makefile.in: Regenerate.
12958         * testsuite/exclude_libs_test.c: New file.
12959         * testsuite/exclude_libs_test.sh: Ditto.
12960         * testsuite/exclude_libs_test_1.c: Ditto.
12961         * testsuite/exclude_libs_test_2.c: Ditto.
12962
12963 2009-05-15  Ian Lance Taylor  <iant@google.com>
12964
12965         * configure.ac: Check for declarations for cases where libiberty.h
12966         checks HAVE_DECL_xxx.
12967         * configure, config.in: Rebuild.
12968
12969 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12970
12971         * gold.h (Incremental_argument_list): Remove (invalid) forward
12972         declaration.
12973         * incremental.cc (Incremental_inputs::report_achive): New method.
12974         (Incremental_inputs::report_object): New method.
12975         (Incremental_inputs::report_script): New method.
12976         (Incremental_inputs::finalize_inputs): New method.
12977         (Incremental_inputs::finalize): Call finalize_inputs().
12978         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12979         Create inputs entries.
12980         * incremental.h (Incremental_input_type): New enum.
12981         (Incremental_inputs::Incremental_input): Initialize new fields.
12982         (Incremental_inputs::report_inputs): New method.
12983         (Incremental_inputs::report_achive): New method.
12984         (Incremental_inputs::report_object): New method.
12985         (Incremental_inputs::report_script): New method.
12986         (Incremental_inputs::finalize_inputs): New method.
12987         (Incremental_inputs::Input_info): New struct.
12988         (Incremental_inputs::Input_info_map): New typedef.
12989         (Incremental_inputs::lock_): New field.
12990         (Incremental_inputs::Inputs_): New field.
12991         (Incremental_inputs::Inputs_map): New field.
12992         * main.cc (main): Call Incremental_input::report_inputs.
12993         * options.h (Input_argument_list): Typedef moved from
12994         Input_arguments.
12995         (Input_file_group::Files): Remove, use ::Input_argument_list.
12996         (Input_file_group::Input_argument_list): Remove, use
12997         ::Input_argument_list.
12998         * plugin.cc (Plugin_manager::add_input_file): Add error in
12999         incremental build.
13000         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13001         functions.
13002         * script.cc (read_input_script): Call
13003         Incremental_input::report_script.
13004         * script.h (Script_info): New class.
13005
13006 2009-04-27  Ian Lance Taylor  <iant@google.com>
13007
13008         * x86_64.cc (do_adjust_output_section): Set entsize to
13009         plt_entry_size.
13010
13011 2009-04-23  Elliott Hughes  <enh@google.com>
13012
13013         * output.cc (Output_file::close): After short writes, continue
13014         writing from the correct offset in the buffer being written.
13015
13016 2009-04-23  Chris Demetriou  <cgd@google.com>
13017
13018         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13019         * configure: Regenerate.
13020         * config.in: Regenerate.
13021         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13022         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13023
13024 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13025
13026         * incremental.cc (Incremental_inputs_header_data): Renamed from
13027         Incremental_input_header_data.
13028         (Incremental_inputs_header_data::data_size): New field.
13029         (Incremental_inputs_header_data::put_input_file_count): Renamed
13030         from input_file_count.
13031         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13032         from command_line_offset.
13033         (Incremental_inputs_header_data::put_reserved): Renamed from
13034         put_reserved.
13035         (Incremental_inputs_entry_data): Renamed from
13036         Incremental_input_entry_data.
13037         (Incremental_inputs_entry_data::data_size): New field.
13038         (Incremental_inputs::report_command_line): New method.
13039         (Incremental_inputs::finalize): New method.
13040         (Incremental_inputs::create_incremental_inputs_data): New method.
13041         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13042         * incremental.h: New file.
13043         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13044         (Layout::finalize): Create incremental inputs section in
13045         incremental builds.
13046         (Layout::create_incremental_info_sections): New method.
13047         * layout.h (Layout::incremental_inputs): New method.
13048         (Layout::create_incremental_info_sections): New method.
13049         (Layout::incremental_inputs_): New field.
13050         * main.cc (main): Notify Incremental_input of the command line.
13051
13052 2009-04-01  Ian Lance Taylor  <iant@google.com>
13053             Mikolaj Zalewski  <mikolajz@google.com>
13054
13055         * gold.h (reserve_unordered_map): Define, three versions, one for
13056         each version of Unordered_map.
13057         * layout.cc (Layout::Layout): Remove options parameter.  Add
13058         number_of_input_files parameter.  Don't initialize options_.
13059         Initialize number_of_input_files_ and resized_signatures_.  Move
13060         sections_are_attached_.
13061         (Layout::layout_group): Reserve space for group_signatures_.
13062         (Layout::find_or_add_kept_section): Change name parameter to be a
13063         reference.  Resize signatures_ map when it gets large enough.
13064         (Layout::layout_eh_frame): Use parameters->options() instead of
13065         this->options_.
13066         (Layout::make_output_section): Likewise.
13067         (Layout::attach_allocated_section_to_segment): Likewise.
13068         (Layout::finalize, Layout::create_executable_stack): Likewise.
13069         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13070         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13071         * layout.h (class Layout): Update declarations.  Remove options_
13072         field.  Add number_of_input_files_ and resized_signatures_
13073         fields.  Move sections_are_attached_ field.
13074         * main.cc (main): Pass number of input files to Layout
13075         constructor.  Don't pass options.
13076
13077 2009-03-30  Ian Lance Taylor  <iant@google.com>
13078
13079         * ffsll.c (ffsll): Correct implementation.
13080
13081 2009-03-27  Ian Lance Taylor  <iant@google.com>
13082
13083         * ffsll.c: New file.
13084         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13085         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13086         * ftruncate.c (ftruncate): Declare before definition.
13087         * mremap.c (mremap): Likewise.
13088         * pread.c (pread): Likewise.
13089         * configure, Makefile.in, config.in: Rebuild.
13090
13091         * mremap.c: New file.
13092         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13093         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13094         (mremap): Declare if HAVE_MREMAP is not defined.
13095         * configure, Makefile.in, config.in: Rebuild.
13096
13097 2009-03-27  Cary Coutant  <ccoutant@google.com>
13098
13099         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13100         position independent.
13101         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13102         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13103
13104 2009-03-24  Cary Coutant  <ccoutant@google.com>
13105
13106         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13107         an executable.
13108         (needs_dynamic_reloc): Likewise.
13109
13110 2009-03-24  Ian Lance Taylor  <iant@google.com>
13111
13112         * yyscript.y (file_cmd): Recognize EXTERN.
13113         (extern_name_list, extern_name_list_body): New nonterminals.
13114         * script.cc (script_add_extern): Define.
13115         * script-c.h (script_add_extern): Declare.
13116
13117 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13118
13119         * object.cc (is_elf_object): Define.
13120         * object.h (is_elf_object): Declare.
13121         * archive.cc (Archive::get_elf_object_for_member): Call
13122         is_elf_object.
13123         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13124
13125 2009-03-24  Elliott Hughes  <enh@google.com>
13126
13127         * output.cc (Output_file::map_anonymous): Define.
13128         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13129         try an anonymous one.  Report the size if the mmap fails.
13130         * output.h (class Output_file): Declare map_anonymous.
13131
13132 2009-03-24  Ian Lance Taylor  <iant@google.com>
13133
13134         * target-select.cc (instantiate_target): Don't acquire the lock if
13135         the instantiated_target_ field has already been set.
13136
13137 2009-03-23  Ian Lance Taylor  <iant@google.com>
13138
13139         * gold-threads.h (class Initialize_lock): Define.
13140         * gold-threads.cc (class Initialize_lock_once): Define.
13141         (initialize_lock_control): New static variable.
13142         (initialize_lock_pointer): New static variable.
13143         (initialize_lock_once): New static function.
13144         (Initialize_lock::Initialize_lock): Define.
13145         (Initialize_lock::initialize): Define.
13146         * target-select.h: Include "gold-threads.h".
13147         (class Target_selector): Add lock_ and initialize_lock_ fields.
13148         Don't define instantiate_target, just declare it.
13149         * target-select.cc (Target_selector::Target_selector): Initialize
13150         new fields.
13151         (Target_selector::instantiate_target): Define.
13152         * descriptors.h: Include "gold-threads.h".
13153         (class Descriptors): Add initialize_lock_ field.
13154         * descriptors.cc (Descriptors::Descriptors): Initialize new
13155         field.
13156         (Descriptors::open): Use initialize_lock_ field
13157         * errors.h (class Errors): Add initialize_lock_ field.
13158         * errors.cc (Errors::Errors): Initialize new field.
13159         (Errors::initialize_lock): Use initialize_lock_ field.
13160         * powerpc.cc (class Target_selector_powerpc): Remove
13161         instantiated_target_ field.  In do_recognize call
13162         instantiate_target rather than do_instantiate_target.  In
13163         do_instantiate_target just allocate a new target.
13164         * sparc.cc (class Target_selector_sparc): Likewise.
13165
13166         * freebsd.h: New file.
13167         * i386.cc: Include "freebsd.h".
13168         (Target_i386): Derive from Target_freebsd rather than
13169         Sized_target.
13170         (Target_selector_i386): Derive from Target_selector_freebsd rather
13171         than Target_selector.
13172         * x86_64.cc: Include "freebsd.h".
13173         (Target_x86_64): Derive from Target_freebsd rather than
13174         Sized_target.
13175         (Target_selector_x86_64): Derive from Target_selector_freebsd
13176         rather than Target_selector.
13177         * target.h (class Target): Add adjust_elf_header and
13178         do_adjust_elf_header.
13179         * output.cc (Output_file_header:: do_sized_write): Call target
13180         adjust_elf_header routine.
13181         * configure.tgt: Set targ_osabi.
13182         * configure.ac: Define GOLD_DEFAULT_OSABI.
13183         * parameters.cc (Parameters::default_target): Pass
13184         GOLD_DEFAULT_OSABI to select_target.
13185         * target-select.h (class Target_selector): Make instantiate_target
13186         protected rather than private.
13187         * Makefile.am (HFILES): Add freebsd.h.
13188         * configure, Makefile.in, config.in: Rebuild.
13189
13190         * merge.cc (do_add_input_section): Correct pend value.  Change
13191         message about last entry not being null terminated from error to
13192         warning.
13193
13194 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13195
13196         * incremental.cc: New file.
13197         * Makefile.am (CCFILES): Add incremental.cc.
13198         * Makefile.in: Rebuild.
13199
13200 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13201
13202         * layout.cc (Layout::output_section_name): Preserve names
13203         of '.note.' sections.
13204
13205 2009-03-19  Ian Lance Taylor  <iant@google.com>
13206
13207         * descriptors.cc (Descriptors::open): Check that the options are
13208         valid before using them.
13209
13210 2009-03-18  Ian Lance Taylor  <iant@google.com>
13211
13212         * script-sections.h: Include <list>.
13213         (class Script_sections): Change Sections_elements from std::vector
13214         to std::list.  Typedef public Elements_iterator.  Add
13215         orphan_section_placement_, data_segment_align_start_, and
13216         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13217         field.
13218         * script-sections.cc (class Orphan_section_placement): New class.
13219         (class Sections_element): Add virtual functions is_relro and
13220         orphan_section_init.  Remove virtual function place_orphan_here.
13221         (class Output_section_definition): Add is_relro and
13222         orphan_section_init.  Remove place_orphan_here.
13223         (class Orphan_output_section): Likewise.
13224         (Script_sections::Script_sections): Update for field changes.
13225         (Script_sections::data_segment_align): Set saw_data_segment_align_
13226         and data_segment_align_start_, not data_segment_align_index.
13227         (Script_sections::data_segment_relro_end): Check
13228         saw_data_segment_align_.  Use data_segment_align_start_ rather
13229         than data_segment_align_index_.
13230         (Script_sections::place_orphan): Rewrite to use
13231         Orphan_section_placement.
13232
13233 2009-03-17  Ian Lance Taylor  <iant@google.com>
13234
13235         * archive.cc (Archive::add_symbols): Check for a version attached
13236         to the symbol name in the archive map.
13237         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13238         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13239         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13240         (ver_test_11.a): New target.
13241         * testsuite/Makefile.in: Rebuild.
13242
13243         * configure.ac: Check for chsize and posix_fallocate.  Replace
13244         ftruncate.
13245         * ftruncate.c: New file, from gnulib.
13246         * output.cc (posix_fallocate): Define dummy version if not
13247         HAVE_POSIX_FALLOCATE.
13248         (Output_file::map): Call posix_fallocate rather than lseek and
13249         write.
13250         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13251         * configure, Makefile.in, config.in: Rebuild.
13252
13253 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13254
13255         * layout.h (Layout::create_note): Add section_name parameter.
13256         * layout.cc (Layout::create_note): Likewise.
13257         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13258
13259 2009-03-17  Ian Lance Taylor  <iant@google.com>
13260
13261         * descriptors.cc: Include "options.h".
13262         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13263         (Descriptors::open): Always use O_CLOEXEC when opening a new
13264         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13265         then set FD_CLOEXEC.
13266
13267         * sparc.cc (class Target_sparc): Add has_got_section.
13268         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13269         make sure we have a GOT section.
13270
13271         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13272         (Target_sparc::Scan::local): Likewise.
13273         (Target_sparc::Scan::global): Likewise.
13274         (Target_sparc::Relocate::relocate): Likewise.
13275         (Target_sparc::Relocate::relocate_tls): Likewise.
13276
13277         * symtab.cc (Symbol_table::define_default_version): New function,
13278         broken out of add_from_object.
13279         (Symbol_table::add_from_object): Call define_default_version.
13280         (Symbol_table::define_special_symbol): Add resolve_oldsym
13281         parameter.  Change all callers.  If the version for a symbol comes
13282         from a version script, resolve it with the symbol with the same
13283         name with no version.  Also add the symbol without a version if
13284         appropriate.
13285         (do_define_in_output_data): If resolving with oldsym, don't delete
13286         sym.
13287         (do_define_in_output_segment): Likewise.
13288         (do_define_as_constant): Likewise.
13289         * symtab.h (class Symbol_table): Update declarations.
13290
13291 2009-03-13  Ian Lance Taylor  <iant@google.com>
13292
13293         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13294         (Read_symbols::requeue): New function.
13295         (Read_symbols::do_read_symbols): If make_elf_object fails because
13296         the target type is not configured, and the file was searched for,
13297         issue a warning and retry with the next directory.
13298         (Add_symbols::run): If the file has an incompatible format, and
13299         it was searched for, requeue the Read_symbols task.  On error,
13300         release the object.
13301         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13302         dirindex parameter to constructor.  Change all callers.  Declare
13303         incompatible_warning and requeue.
13304         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13305         input_argument_ and input_group_ fields.  Add them to
13306         constructor.  Change all callers.
13307         (class Read_script): Add dirindex_ field.  Add it to constructor.
13308         Change all callers.
13309         * archive.cc (Archive::setup): Remove input_objects parameter.
13310         Change all callers.
13311         (Archive::get_file_and_offset): Likewise.
13312         (Archive::read_all_symbols): Likewise.
13313         (Archive::read_symbols): Likewise.
13314         (Archive::get_elf_object_for_member): Remove input_objects
13315         parameter.  Add punconfigured parameter.  Change all callers.
13316         (Archive::add_symbols): Change return type to bool.  Check return
13317         value of include_member.
13318         (Archive::include_all_members): Likewise.
13319         (Archive::include_member): Change return type to bool.  Return
13320         false if first included object has incompatible target.  Set
13321         included_member_ field.
13322         (Add_archive_symbols::run): If add_symbols returns false, requeue
13323         Read_symbols task.
13324         * archive.h (class Archive): Add included_member_ field.
13325         Initialize it in constructor.  Add input_file and searched_for
13326         methods.  Update declarations.
13327         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13328         input_argument_ fields.  Add them to constructor.  Change all
13329         callers.
13330         * script.cc: Include "target-select.h".
13331         (class Parser_closure): Add skip_on_incompatible_target_ and
13332         found_incompatible_target_ fields.  Add
13333         skip_on_incompatible_target parameter to constructor.  Change all
13334         callers.  Add methods skip_on_incompatible_target,
13335         clear_skip_on_incompatible_target, found_incompatible_target, and
13336         set_found_incompatible_target.
13337         (read_input_script): Add dirindex parameter.  Change all callers.
13338         If parser finds an incompatible target, requeue Read_symbols
13339         task.
13340         (script_set_symbol): Clear skip_on_incompatible_target in
13341         closure.
13342         (script_add_assertion, script_parse_option): Likewise.
13343         (script_start_sections, script_add_phdr): Likewise.
13344         (script_check_output_format): New function.
13345         * script.h (read_input_script): Update declaration.
13346         * script-c.h (script_check_output_format): Declare.
13347         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13348         (ignore_cmd): Remove OUTPUT_FORMAT.
13349         * fileread.cc (Input_file::Input_file): Add explicit this.
13350         (Input_file::will_search_for): New function.
13351         (Input_file::open): Add pindex parameter.  Change all callers.
13352         * fileread.h (class Input_file): Add input_file_argument method.
13353         Declare will_search_for.  Update declarations.
13354         * object.cc (make_elf_object): Add punconfigured parameter.
13355         Change all callers.
13356         * object.h (class Object): Make input_file public.  Add
13357         searched_for method.
13358         (make_elf_object): Update declaration.
13359         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13360         restart search.
13361         * dirsearch.h (class Dirsearch): Update declaration.
13362         * options.h (class General_options): Add --warn-search-mismatch.
13363         * parameters.cc (Parameters::is_compatible_target): New function.
13364         * parameters.h (class Parameters): Declare is_compatible_target.
13365         * workqueue.cc (Workqueue::add_blocker): New function.
13366         * workqueue.h (class Workqueue): Declare add_blocker.
13367
13368         * fileread.cc (Input_file::open): Remove options parameter.
13369         Change all callers.
13370         (Input_file::open_binary): Likewise.
13371         * script.cc (read_input_script): Likewise.
13372         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13373         options parameter from constructor.  Change all callers.
13374         (class Read_script): Likewise.
13375         * fileread.h (class Input_file): Update declarations.
13376         * script.h (read_input_script): Update declaration.
13377
13378 2009-03-10  Nick Clifton  <nickc@redhat.com>
13379
13380         * po/es.po: New Spanish translation.
13381
13382 2009-03-06  Cary Coutant  <ccoutant@google.com>
13383
13384         * options.cc (parse_short_option): Keep dash_z from registering itself.
13385
13386 2009-03-03  Ian Lance Taylor  <iant@google.com>
13387
13388         PR 9918
13389         * target-reloc.h (relocate_section): Pass output_section to
13390         relocate.
13391         * i386.cc (Target_i386::should_apply_static_reloc): Add
13392         output_section parameter.  Change all callers.
13393         (Target_i386::Relocate::relocate): Add output_section parameter.
13394         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13395         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13396         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13397         * testsuite/two_file_shared.sh: New script.
13398         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13399         (check_DATA): Add two_file_shared.dbg.
13400         (two_file_shared.dbg): New target.
13401         * testsuite/Makefile.in: Rebuild.
13402
13403 2009-03-01  Ian Lance Taylor  <iant@google.com>
13404
13405         * configure.ac: Check for byteswap.h.
13406         * configure: Rebuild.
13407         * config.in: Rebuild.
13408
13409 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13410
13411         * layout.cc (Layout::find_or_add_kept_section): New function.
13412         (Layout::add_comdat): Removed.
13413         * layout.h (struct Kept_section): Move out of class Layout.
13414         Remove trailing underscores from field names.  Add group_sections
13415         field.  Rename group_ field to is_group.  Change all uses.
13416         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13417         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13418         comdat_groups_ field.
13419         (Sized_relobj::include_section_group): Use
13420         find_or_add_kept_section and Kept_section::group_sections.
13421         (Sized_relobj::include_linkonce_section): Likewise.
13422         * object.cc (class Sized_relobj): Don't define Comdat_group or
13423         Comdat_group_table.  Remove find_comdat_group and
13424         add_comdat_group.  Remove comdat_groups_ field.
13425         * plugin.cc (include_comdat_group): Use
13426         Layout::find_or_add_kept_section.
13427
13428 2009-02-28  Ian Lance Taylor  <iant@google.com>
13429
13430         * README: --gc-sections and map files are now supported.  Document
13431         some build requirements.
13432
13433         PR 6992
13434         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13435         relocatable link set the value of the section symbol to zero.
13436         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13437         relocatable link don't include the section address in the local
13438         symbol value.
13439
13440 2009-02-27  Ian Lance Taylor  <iant@google.com>
13441
13442         PR 6811
13443         * options.h (class Search_directory): Add is_system_directory.
13444         (class General_options): Declare is_in_system_directory.
13445         * options.cc (get_relative_sysroot): Make static.
13446         (get_default_sysroot): Make static.
13447         (General_optoins::is_in_system_directory): New function.
13448         * fileread.cc (Input_file::is_in_system_directory): New function.
13449         * fileread.h (class Input_file): Declare is_in_system_directory.
13450         * object.h (class Object): Add is_in_system_directory.
13451         (class Input_objects): Remove system_library_directory_ field.
13452         * object.cc (Input_objects::add_object): Don't set
13453         system_library_directory_.
13454         (input_objects::found_in_system_library_directory): Remove.
13455         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13456         parameter.  Change all callers.
13457         (Symbol_table::sized_write_globals): Likewise.
13458         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13459         Call Object::is_in_system_directory.
13460         * symtab.h (class Symbol_table): Update declarations.
13461
13462         PR 5990
13463         * descriptors.h (Open_descriptor): Add is_on_stack field.
13464         * descriptors.cc (Descriptors::open): If the descriptor is on the
13465         top of the stack, remove it.  Initialize is_on_stack field.
13466         (Descriptors::release): Only add pod to stack if it is not on the
13467         stack already.
13468         (Descriptors::close_some_descriptor): Clear stack_next and
13469         is_on_stack fields.
13470
13471         PR 7091
13472         * output.cc (Output_section::find_starting_output_address): Rename
13473         from starting_output_address; add PADDR parameter; change return
13474         type.
13475         * output.h (class Output_section): Declare
13476         find_starting_output_address instead of starting_output_address.
13477         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13478         section symbol for which we can't find a merge section.
13479
13480         PR 9836
13481         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13482         hidden or internal, force the symbol to be local.
13483         * resolve.cc (Symbol::override_visibility): Define.
13484         (Symbol::override_base): Use override_visibility.
13485         (Symbol_table::resolve): Likewise.
13486         (Symbol::override_base_with_special): Likewise.
13487         (Symbol_table::override_with_special): If the visibility is hidden
13488         or internal, force the symbol to be local.
13489         * symtab.h (class Symbol): Add set_visibility and
13490         override_visibility.
13491         * testsuite/ver_test_1.sh: New file.
13492         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13493         (check_DATA): Add ver_test_1.syms.
13494         (ver_test_1.syms): New target.
13495         * testsuite/Makefile.in: Rebuild.
13496
13497 2009-02-25  Cary Coutant  <ccoutant@google.com>
13498
13499         * layout.cc (Layout::choose_output_section): Don't rename sections
13500         when using a linker script that has a SECTIONS clause.
13501         * Makefile.in: Regenerate.
13502
13503         * testsuite/Makefile.am (script_test_5.sh): New test case.
13504         * testsuite/Makefile.in: Regenerate.
13505         * testsuite/script_test_5.cc: New file.
13506         * testsuite/script_test_5.sh: New file.
13507         * testsuite/script_test_5.t: New file.
13508
13509 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13510
13511         * archive.cc (Archive::include_member): Update calls to add_symbols.
13512         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13513         the Layout argument.
13514         * dynobj.h (do_add_symbols): Add the Layout argument.
13515         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13516         Layout argument.
13517         * object.h (Object::add_symbols): Add the Layout argument.
13518         (Object::do_add_symbols): Add the Layout argument.
13519         (Sized_relobj::do_add_symbols): Add the Layout argument.
13520         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13521         Unify the two versions.
13522         (Add_plugin_symbols): Remove.
13523         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13524         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13525         (Add_plugin_symbols): Remove.
13526         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13527         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13528         (Add_symbols::run): Make it work with Pulginobj.
13529
13530 2009-02-06  Ian Lance Taylor  <iant@google.com>
13531
13532         * object.cc (Sized_relobj::do_layout): Make info message start
13533         with lower case letter.
13534
13535 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13536
13537         * binary.cc: Fix file comment.
13538
13539         * options.h (enum Incremental_disposition): Define.
13540         (class General_options): Add new options: --incremental,
13541         --incremental_changed, --incremental_unchanged,
13542         --incremental_unknown.  Add incremental_disposition_ and
13543         implicit_incremental_ fields.
13544         (General_options::incremental_disposition): New function.
13545         (class Position_dependent_options): Add incremental_disposition
13546         option.
13547         (Position_dependent_options::copy_from_options): Set incremental
13548         dispositions.
13549         * options.cc (General_options::parse_incremental_changed): New
13550         function.
13551         (General_options::parse_incremental_unchanged): New function.
13552         (General_options::parse_incremental_unknown): New function.
13553         (General_options::General_options): Initialize new fields
13554         incremental_disposition_ and implicit_incremental_.
13555         (General_options::finalize): Check for uasge of --incremental-*
13556         without --incremental.
13557
13558 2009-02-06  Chris Demetriou  <cgd@google.com>
13559
13560         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13561         pointer and to report location as the file name associated with
13562         the symbol.
13563         (gold_undefined_symbol_at_location): New function to replace the
13564         old gold_undefined_symbol functionality.
13565         * target-reloc.h (relocate_section): Update to use
13566         gold_undefined_symbol_at_location.
13567         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13568         Call gold_undefined_symbol function rather than gold_error.
13569         * errors.h (Errors::undefined_symbol): Take location as a
13570         string, rather than calculating it from a relocation.
13571         * errors.cc (Errors::fatal): Print "fatal error:" before the
13572         formatted message.
13573         (Errors::error, Errors::error_at_location): Print "error: "
13574         before the formatted message.
13575         (Errors::undefined_symbol): Take location as a string, rather
13576         than calculating it from a relocation.
13577         (gold_undefined_symbol_at_location): New function akin to
13578         old gold_undefined_symbol, calculates location from relocation.
13579         (gold_undefined_symbol): Change to take only a Symbol pointer
13580         and to report location as the file name associated with the symbol.
13581         * testsuite/debug_msg.sh: Update for changed error messages.
13582         * testsuite/undef_symbol.sh: Likewise.
13583
13584 2009-02-04  Duncan Sands  <baldrick@free.fr>
13585
13586         PR 9812
13587         * reduced_debug_output.h
13588         (Output_reduced_debug_abbrev_section::failed): Use format for
13589         gold_warning.
13590         (Output_reduced_debug_info_section::faild): Likewise.
13591
13592 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13593
13594         * script.cc (Lazy_demangler): New class.
13595         (Version_script_info::get_symbol_version_helper): Demangle a
13596         symbol only once.
13597
13598 2009-01-29  Cary Coutant  <ccoutant@google.com>
13599
13600         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13601         to __tls_get_addr.
13602         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13603
13604 2009-01-28  Ian Lance Taylor  <iant@google.com>
13605
13606         * version.cc (version_string): Bump to 1.9.
13607
13608         * gold.h: Include <cstring> and <stdint.h>.
13609         * version.cc: Include <cstdio>.
13610         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13611         warning.
13612         * reduced_debug_output.cc (insert_into_vector): Rename from
13613         Insert_into_vector; change all callers.  Use Swap_unaligned to
13614         avoid aliasing issue; remove union since it is unnecessary.
13615
13616 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13617
13618         * Makefile.am (CCFILES): Add gc.cc.
13619         (HFILES): Add gc.h.
13620         * Makefile.in: Regenerate.
13621         * gold.cc (Gc_runner): New class.
13622         (queue_initial_tasks): Call garbage collection related tasks
13623         when corresponding options are invoked.
13624         (queue_middle_gc_tasks): New function.
13625         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13626         processed early before laying out sections during garbage collection.
13627         * gold.h (queue_middle_gc_tasks): New function.
13628         (is_prefix_of): Move from "layout.cc".
13629         * i386.cc (Target_i386::gc_process_relocs): New function.
13630         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13631         * main.cc (main): Create object of class "Garbage_collection".
13632         * object.cc (Relobj::copy_symbols_data): New function.
13633         (Relobj::is_section_name_included): New function.
13634         (Sized_relobj::do_layout): Allow this function to be called twice
13635         during garbage collection and defer layout of section during the
13636         first call.
13637         * object.h (Relobj::get_symbols_data): New function.
13638         (Relobj::is_section_name_included): New function.
13639         (Relobj::copy_symbols_data): New function.
13640         (Relobj::set_symbols_data): New function.
13641         (Relobj::get_relocs_data): New function.
13642         (Relobj::set_relocs_data): New function.
13643         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13644         (Relobj::gc_process_relocs): New function.
13645         (Relobj::do_gc_process_relocs): New pure virtual function.
13646         (Relobj::sd_): New data member.
13647         (Sized_relobj::is_output_section_offset_invalid): New function.
13648         (Sized_relobj::do_gc_process_relocs): New function.
13649         * options.h (General_options::gc_sections): Modify to not be a no-op.
13650         (General_options::print_gc_sections): New option.
13651         * plugin.cc (Plugin_finish::run): Remove function call to
13652         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13653         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13654         * reloc.cc (Read_relocs::run): Add task to process relocs and
13655         determine unreferenced sections when doing garbage collection.
13656         (Gc_process_relocs): New class.
13657         (Sized_relobj::do_gc_process_relocs): New function.
13658         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13659         sections that are garbage collected.
13660         * reloc.h (Gc_process_relocs): New class.
13661         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13662         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13663         symbols whose corresponding sections are garbage collected.
13664         (Symbol_table::Symbol_table): Add new parameter for the garbage
13665         collection object.
13666         (Symbol_table::gc_mark_undef_symbols): New function.
13667         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13668         (Symbol_table::gc_mark_dyn_syms): New function.
13669         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13670         as garbage.
13671         (Symbol_table::add_from_object): Likewise.
13672         (Symbol_table::add_from_relobj): When building shared objects, do not
13673         treat externally visible symbols as garbage.
13674         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13675         table information for static and relocatable links.
13676         * symtab.h (Symbol_table::set_gc): New function.
13677         (Symbol_table::gc): New function.
13678         (Symbol_table::gc_mark_undef_symbols): New function.
13679         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13680         (Symbol_table::gc_mark_dyn_syms): New function.
13681         (Symbol_table::gc_): New data member.
13682         * target.h (Sized_target::gc_process_relocs): New pure virtual
13683         function.
13684         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13685         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13686
13687 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13688
13689         * options.h (General_options::gc_sections): Define as a no-op for now.
13690         (General_options::no_keep_memory): Ditto.
13691         (General_options::Bshareable): Define.
13692         * options.cc (General_options::finalize): Honor -Bshareable.
13693
13694 2009-01-20  Andreas Schwab  <schwab@suse.de>
13695
13696         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13697         read the value in the contents, since we don't use it.  Use the
13698         template endianness when writing.
13699         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13700
13701 2009-01-19  Andreas Schwab  <schwab@suse.de>
13702
13703         * configure.tgt (powerpc64-*): Fix targ_obj.
13704
13705 2009-01-15  Ian Lance Taylor  <iant@google.com>
13706
13707         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13708         local symbols when stripping all symbols.
13709
13710 2009-01-14  Cary Coutant  <ccoutant@google.com>
13711
13712         * output.cc (Output_reloc): Add explicit instantiations.
13713
13714 2009-01-14  Cary Coutant  <ccoutant@google.com>
13715
13716         * archive.cc (Archive::get_elf_object_for_member): Remove call
13717         to File_read::claim_for_plugin.
13718         * descriptors.cc (Descriptors::open): Remove reference to
13719         is_claimed.
13720         (Descriptors::claim_for_plugin): Remove.
13721         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13722         (Descriptors::is_claimed): Remove.
13723         (claim_descriptor_for_plugin): Remove.
13724         * fileread.cc (File_read::claim_for_plugin): Remove.
13725         * fileread.h (File_read::claim_for_plugin): Remove.
13726         (File_read::descriptor): Reopen descriptor if necessary.
13727         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13728         (Plugin_manager::all_symbols_read): Add task parameter. Change
13729         all callers.
13730         (Plugin_manager::get_input_file): New function.
13731         (Plugin_manager::release_input_file): New function.
13732         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13733         corresponding data member.
13734         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13735         and pass to base constructor. Change all callers.
13736         (get_input_file, release_input_file): New functions.
13737         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13738         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13739         (Plugin_manager::all_symbols_read): Add task parameter.
13740         (Plugin_manager::get_input_file): New function.
13741         (Plugin_manager::release_input_file): New function.
13742         (Plugin_manager::task_): New data member.
13743         (Pluginobj::Pluginobj): Add filesize parameter.
13744         (Pluginobj::filename): New function.
13745         (Pluginobj::descriptor): New function.
13746         (Pluginobj::filesize): New function.
13747         (Pluginobj::filesize_): New data member.
13748         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13749         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13750         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13751
13752         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13753         with archive libraries.
13754         * testsuite/Makefile.in: Regenerate.
13755         * testsuite/plugin_test.c (struct sym_info): New type.
13756         (get_input_file, release_input_file): New static variables.
13757         (onload): Capture new transfer vector entries.
13758         (claim_file_hook): Stop reading at end of file according to filesize.
13759         Factor out parsing of readelf output into separate function.
13760         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13761         APIs and get the source file name from the symbol table.  Convert
13762         source file name to corresponding object file name.  Print info
13763         message when adding new input files.
13764         (parse_readelf_line): New function.
13765         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13766         * testsuite/plugin_test_2.sh: Likewise.
13767         * testsuite/plugin_test_3.sh: Likewise.
13768         * testsuite/plugin_test_4.sh: New test case.
13769
13770 2009-01-07  Ian Lance Taylor  <iant@google.com>
13771
13772         * version.cc (version_string): Bump to 1.8.
13773
13774 2008-12-23  Cary Coutant  <ccoutant@google.com>
13775
13776         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13777         * plugin.cc (Plugin_manager::finish): Rename as
13778         layout_deferred_objects.  Move cleanup to separate function.
13779         (Plugin_manager::cleanup): New function.
13780         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13781         separately.
13782         * plugin.h (Plugin_manager::finish): Rename as
13783         layout_deferred_objects.
13784         (Plugin_manager::cleanup): New function.
13785         (Plugin_manager::cleanup_done): New field.
13786
13787 2008-12-23  Cary Coutant  <ccoutant@google.com>
13788
13789         * plugin.cc (is_visible_from_outside): New function.
13790         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13791         so we don't return "IR only" status for exported symbols or -r links.
13792
13793         * testsuite/Makefile.am (plugin_test_3): New test case.
13794         * testsuite/Makefile.in: Regenerate.
13795         * testsuite/plugin_test_3.sh: New file.
13796
13797 2008-12-22  Cary Coutant  <ccoutant@google.com>
13798
13799         * object.cc (Sized_relobj::layout_section): New function.
13800         (Sized_relobj::do_layout): Defer layout of input sections until after
13801         plugin has provided replacement files.
13802         (Sized_relobj::do_layout_deferred_sections): New function.
13803         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13804         (Relobj::layout_deferred_sections): New function.
13805         (Relobj::do_layout_deferred_sections): New function.
13806         (Sized_relobj::do_layout_deferred_sections): New function.
13807         (Sized_relobj::layout_section): New function.
13808         (Sized_relobj::Deferred_layout): New structure.
13809         (Sized_relobj::deferred_layout_): New field.
13810         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13811         Change all callers.  Layout deferred sections.
13812         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13813         references.
13814         (Plugin_hook::run): Move code from do_plugin_hook inline.
13815         (Plugin_hook::do_plugin_hook): Remove.
13816         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13817         (Plugin_manager::finish): Renamed, was cleanup.
13818         (Plugin_manager::should_defer_layout): New function.
13819         (Plugin_manager::add_deferred_layout_object): New function.
13820         (Plugin_manager::Deferred_layout_list): New type.
13821         (Plugin_manager::deferred_layout_objects_): New field.
13822         (Plugin_hook::do_plugin_hook): Remove.
13823
13824 2008-12-17  Ian Lance Taylor  <iant@google.com>
13825
13826         * options.h (class General_options): Add --no case for
13827         --export-dynamic.
13828
13829 2008-12-16  Cary Coutant  <ccoutant@google.com>
13830
13831         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13832         vector.
13833         (Plugin_manager::claim_file): Create plugin object even if
13834         plugin did not call the add_symbols callback.
13835         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13836         asking for more symbols than were added.
13837         * testsuite/Makefile.am (plugin_test_1): Add test case with
13838         no global symbols.
13839         (empty.syms): New target.
13840         * testsuite/Makefile.in: Regenerate.
13841         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13842         message. Don't call add_symbols if no globals.
13843         (all_symbols_read_hook): Don't provide replacement for empty
13844         claimed file.
13845
13846 2008-12-12  Ian Lance Taylor  <iant@google.com>
13847
13848         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13849         r_type == 0 for a local symbol with r_sym == 0.
13850         (scan_relocatable_relocs): Pass r_sym to
13851         local_non_section_strategy.
13852         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13853         r_sym parameter.
13854
13855         * configure.ac: Update test for TLS descriptors: they are
13856         supported as of glibc 2.9.
13857         * configure: Rebuild.
13858
13859 2008-12-11  Ian Lance Taylor  <iant@google.com>
13860
13861         PR 7091
13862         * target-reloc.h (Default_scan_relocatable_relocs): For each
13863         function, map r_type == 0 to RELOC_DISCARD.
13864
13865 2008-12-10  Cary Coutant  <ccoutant@google.com>
13866
13867         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13868         object to override a kept COMDAT group from a plugin object.
13869
13870 2008-12-09  Ian Lance Taylor  <iant@google.com>
13871
13872         PR 7088
13873         * yyscript.y (file_cmd): Handle INPUT.
13874
13875         * testsuite/initpri1.c: Change all declarations to be full
13876         prototypes by adding void, to avoid compiler warnings.
13877
13878 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13879
13880         * options.cc (General_options::parse_plugin_opt): New.
13881         (General_options::add_plugin): The argument now is just the filename.
13882         (General_options::add_plugin_option): New.
13883         * options.h (plugin_opt): New.
13884         (add_plugin): Change argument name.
13885         (add_plugin_option): New.
13886         * plugin.cc (Plugin::load): Don't parse the plugin option.
13887         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13888         (Plugin::add_option): New.
13889         (Plugin::args_): Change type.
13890         (Plugin::filename_): New.
13891         (Plugin_manager::add_plugin_option): New.
13892         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13893         * testsuite/Makefile.in: Regenerate.
13894
13895 2008-12-05  Cary Coutant  <ccoutant@google.com>
13896
13897         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13898         Handle --strip-lto-sections option.
13899         * options.h (strip_lto_sections): New option.
13900
13901 2008-12-01  Cary Coutant  <ccoutant@google.com>
13902
13903         * plugin.cc (ld_plugin_message): Change format parameter to const.
13904         Fix mismatch between new[] and delete.
13905
13906 2008-11-14  Cary Coutant  <ccoutant@google.com>
13907
13908         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13909         instead of -1U.
13910
13911 2008-11-05  Craig Silverstein  <csilvers@google.com>
13912
13913         * options.cc (General_options::parse_dynamic_list): New function.
13914         * options.h (General_options): New flags dynamic_list,
13915         dynamic_list_data, dynamic_list_cpp_new, and
13916         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13917         (General_options::in_dynamic_list): New function.
13918         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13919         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13920         (Lex::can_continue_name): Likewise.
13921         (yylex): Likewise.
13922         (read_script_file): New parameter script_options.
13923         (read_dynamic_list): New function.
13924         (Script_options::define_dynamic_list): New function.
13925         (dynamic_list_keyword_parsecodes): New variable.
13926         (dynamic_list_keywords): New variable.
13927         * script.h (Script_options::define_dynamic_list): New function
13928         prototype.
13929         (read_dynamic_list): New function prototype.
13930         * symtab.cc (strprefix): New macro.
13931         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13932         dynamic_list_data, dynamic_list_cpp_new, and
13933         dynamic_list_cpp_typeinfo.
13934         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13935         (dynamic_list_expr): New rule.
13936         (dynamic_list_nodes): Likewise.
13937         (dynamic_list_node): Likewise.
13938         * testsuite/Makefile.am (dynamic_list): New test.
13939         * testsuite/Makefile.in: Regenerated.
13940         * testsuite/dynamic_list.t: New file.
13941         * testsuite/dynamic_list.sh: New file.
13942
13943 2008-11-05  Craig Silverstein  <csilvers@google.com>
13944
13945         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13946         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13947         (t11_last): Likewise.
13948         * testsuite/ver_test_6.c (main): Likewise.
13949
13950 2008-10-07  Cary Coutant  <ccoutant@google.com>
13951
13952         * options.c (General_options::finalize): Add check for -static and
13953         -shared.
13954         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13955         is not empty.
13956
13957 2008-10-02  Cary Coutant  <ccoutant@google.com>
13958
13959         * plugin.cc (make_sized_plugin_object): Fix conditional
13960         compilation to work when not all targets are enabled.
13961
13962 2008-09-29  Cary Coutant  <ccoutant@google.com>
13963
13964         * archive.cc (Archive::get_file_and_offset): Use filename instead
13965         of name to get library path.
13966         (Archive::include_member): Unlock external member of a thin archive.
13967
13968         * testsuite/Makefile.am (TEST_AR): New variable.
13969         (thin_archive_test_1): New test.
13970         (thin_archive_test_2): New test.
13971         * testsuite/Makefile.in: Regenerate.
13972         * testsuite/thin_archive_main.cc: New file.
13973         * testsuite/thin_archive_test_1.cc: New file.
13974         * testsuite/thin_archive_test_2.cc: New file.
13975         * testsuite/thin_archive_test_3.cc: New file.
13976         * testsuite/thin_archive_test_4.cc: New file.
13977
13978 2008-09-29  Cary Coutant  <ccoutant@google.com>
13979
13980         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13981         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13982         instead of -1U.
13983         (Sized_relobj::do_finalize_local_symbols): Likewise.
13984         (Sized_relobj::map_to_kept_section): Likewise.
13985         * object.h (Sized_relobj::invalid_address): New constant.
13986         (Sized_relobj::do_output_section_offset): Check for invalid_address
13987         and return -1ULL.
13988         * output.cc (Output_reloc::local_section_offset): Use constant
13989         invalid_address instead of -1U.
13990         (Output_reloc::get_address): Likewise.
13991         (Output_section::output_address): Change -1U to -1ULL.
13992         * output.h (Output_reloc::invalid_address): New constant.
13993         * reloc.cc (Sized_relobj::write_sections): Use constant
13994         invalid_address instead of -1U.
13995         (Sized_relobj::relocate_sections): Likewise.
13996         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13997         values for merge sections.
13998         * target-reloc.h (relocate_for_relocatable): Use constant
13999         invalid_address instead of -1U.
14000
14001 2008-09-19  Cary Coutant  <ccoutant@google.com>
14002
14003         Add plugin functionality for link-time optimization (LTO).
14004         * configure.ac (plugins): Add --enable-plugins option.
14005         * configure: Regenerate.
14006         * config.in: Regenerate.
14007         * Makefile.am (LIBDL): New variable.
14008         (CCFILES): Add plugin.cc.
14009         (HFILES): Add plugin.h.
14010         (ldadd_var): Add LIBDL.
14011         * Makefile.in: Regenerate.
14012
14013         * archive.cc: Include "plugin.h".
14014         (Archive::setup): Don't preread archive symbols when using a plugin.
14015         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14016         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14017         files.
14018         (Archive::include_member): Add symbols from plugin objects.
14019         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14020         * descriptors.cc (Descriptors::open): Check for file descriptors
14021         abandoned by plugins.
14022         (Descriptors::claim_for_plugin): New function.
14023         * descriptors.h (Descriptors::claim_for_plugin): New function.
14024         (Open_descriptor::is_claimed): New field.
14025         (claim_descriptor_for_plugin): New function.
14026         * fileread.cc (File_read::claim_for_plugin): New function.
14027         * fileread.h (File_read::claim_for_plugin): New function.
14028         (File_read::descriptor): New function.
14029         * gold.cc: Include "plugin.h".
14030         (queue_initial_tasks): Add task to call plugin hooks for generating
14031         new object files.
14032         * main.cc: Include "plugin.h".
14033         (main): Load plugin libraries.
14034         * object.h (Pluginobj): Declare.
14035         (Object::pluginobj): New function.
14036         (Object::do_pluginobj): New function.
14037         (Object::set_target): New function.
14038         * options.cc: Include "plugin.h".
14039         (General_options::parse_plugin): New function.
14040         (General_options::General_options): Initialize plugins_ field.
14041         (General_options::add_plugin): New function.
14042         * options.h (Plugin_manager): Declare.
14043         (General_options): Add --plugin option.
14044         (General_options::has_plugins): New function.
14045         (General_options::plugins): New function.
14046         (General_options::add_plugin): New function.
14047         (General_options::plugins_): New field.
14048         * plugin.cc: New file.
14049         * plugin.h: New file.
14050         * readsyms.cc: Include "plugin.h".
14051         (Read_symbols::do_read_symbols): Check for archive before checking
14052         for ELF file.  Call plugin hooks to claim files.
14053         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14054         from a real object file; force override when processing replacement
14055         files.
14056         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14057         (Symbol::init_base_object): Likewise.
14058         (Symbol::init_base_output_data): Likewise.
14059         (Symbol::init_base_output_segment): Likewise.
14060         (Symbol::init_base_constant): Likewise.
14061         (Symbol::init_base_undefined): Likewise.
14062         (Symbol::output_section): Assert that object is not a plugin.
14063         (Symbol_table::add_from_pluginobj): New function.
14064         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14065         undefined.
14066         (Symbol_table::sized_write_globals): Likewise.
14067         (Symbol_table::add_from_pluginobj): Instantiate template.
14068         * symtab.h (Sized_pluginobj): Declare.
14069         (Symbol::in_real_elf): New function.
14070         (Symbol::set_in_real_elf): New function.
14071         (Symbol::in_real_elf_): New field.
14072         (Symbol_table::add_from_pluginobj): New function.
14073
14074         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14075         (LIBDL): New variable.
14076         (LDADD): Add LIBDL.
14077         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14078         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14079         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14080         (MOSTLYCLEANFILES): Likewise.
14081         * testsuite/Makefile.in: Regenerate.
14082         * testsuite/plugin_test.c: New file.
14083         * testsuite/plugin_test_1.sh: New file.
14084         * testsuite/plugin_test_2.sh: New file.
14085
14086 2008-09-16  Ian Lance Taylor  <iant@google.com>
14087
14088         * target-reloc.h (relocate_section): Check whether a symbol is
14089         defined by the ABI before reporting an undefined symbol error.
14090         * target.h (Target::is_defined_by_abi): Make parameter const.
14091         (Target::do_is_defined_by_abi): Likewise.
14092         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14093         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14094         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14095         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14096         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14097         * testsuite/Makefile.in: Rebuild.
14098
14099         * fileread.cc (make_view): Add casts to avoid warning.
14100
14101 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14102
14103         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14104         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14105
14106 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14107
14108         * options.h (General_options::output_is_executable): New.
14109         (General_options::output_is_pie): New.
14110         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14111         for shared libraries.
14112         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14113
14114 2008-09-11  Chris Demetriou  <cgd@google.com>
14115
14116         * options.h (origin): New -z option.
14117         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14118         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14119         in DT_FLAGS_1.
14120
14121 2008-09-05  Cary Coutant  <ccoutant@google.com>
14122
14123         * fileread.cc (File_read::make_view): Add check for attempt to map
14124         beyond end of file.
14125
14126 2008-09-05  Cary Coutant  <ccoutant@google.com>
14127
14128         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14129         explicit instantiations.
14130
14131 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14132
14133         PR gold/6858
14134         * options.cc (General_options::finalize): Allow undefined symbols
14135         in shlibs if linking -shared.
14136
14137         PR gold/6859
14138         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14139         symbols as not needing a dynsym entry.
14140
14141 2008-08-20  Craig Silverstein  <csilvers@google.com>
14142
14143         * fileread.cc (File_read::open): Do not lock the file unless it
14144         was successfully opened.
14145
14146 2008-08-14  Cary Coutant  <ccoutant@google.com>
14147
14148         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14149         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14150         * testsuite/tls_test.cc (struct int128): 128-bit struct
14151         for testing TLS relocs with non-zero addend.
14152         (v12): New TLS variable.
14153         (t12): New test.
14154         (t_last): Add check for v12.
14155         * testsuite/tls_test.h (t12): New function.
14156         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14157
14158 2008-08-13  Ian Lance Taylor  <iant@google.com>
14159
14160         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14161         set tls_segment_ or relro_segment_.
14162         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14163         when appropriate.
14164         * output.h (Output_section::clear_is_relro): New function.
14165         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14166         sections specially even when output_data_ is empty.
14167         (Output_segment::maximum_alignment): When first section is relro,
14168         only force alignment for PT_LOAD segments.
14169         * script.cc (script_data_segment_align): New function.
14170         (script_data_segment_relro_end): New function.
14171         * script-c.h (script_data_segment_align): Declare.
14172         (script_data_segment_relro_end): Declare.
14173         * script-sections.h (class Script_sections): Declare
14174         data_segment_align and data_segment_relro_end.  Add fields
14175         segment_align_index_ and saw_relro_end_.
14176         * script-sections.cc (class Sections_element): Add set_is_relro
14177         virtual function.  Add new bool* parameter to place_orphan_here.
14178         Add get_output_section virtual function.
14179         (class Output_section_definition): Add set_is_relro.  Add new
14180         bool* parameter to place_orphan_here.  Add get_output_section.
14181         Add is_relro_ field.
14182         (Output_section_definition::Output_section_definition): Initialize
14183         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14184         and is_relro_ fields.
14185         (Output_section_definition::place_orphan_here): Add is_relro
14186         parameter.
14187         (Output_section_definition::set_section_addresses): Set relro for
14188         output section.
14189         (Output_section_definition::alternate_constraint): Likewise.
14190         (class Orphan_output_section): Add new bool* parameter to
14191         place_orphan_here.  Add get_output_section.
14192         (Orphan_output_section::place_orphan_here): Add is_relro
14193         parameter.
14194         (Script_sections::Script_sections): Initialize
14195         data_segment_align_index_ and saw_relro_end_.
14196         (Script_sections::data_segment_align): New function.
14197         (Script_sections::data_segment_relro_end): New function.
14198         (Script_sections::place_orphan): Set or clear is_relro.
14199         (Script_sections::set_section_addresses): Force alignment of first
14200         TLS section.
14201         * yyscript.y (exp): Call script_data_segment_align and
14202         script_data_segment_relro_end.
14203         * testsuite/relro_script_test.t: New file.
14204         * testsuite/relro_test.cc (using_script): Declare.
14205         (t1, t2): Test using_script.
14206         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14207         (relro_script_test_SOURCES): Define.
14208         (relro_script_test_DEPENDENCIES): Define.
14209         (relro_script_test_LDFLAGS): Define.
14210         (relro_script_test_LDADD): Define.
14211         (relro_script_test.so): New target.
14212         * testsuite/Makefile.in: Rebuild.
14213
14214 2008-08-06  Cary Coutant <ccoutant@google.com>
14215
14216         * archive.cc (Archive::total_archives, Archive::total_members)
14217         (Archive::total_members_loaded): New variables.
14218         (Archive::setup): Add parameter.  Add option to preread
14219         archive symbols.
14220         (Archive::read_armap): Add counter.
14221         (Archive::get_file_and_offset): New function.
14222         (Archive::get_elf_object_for_member): New function.
14223         (Archive::read_all_symbols): New function.
14224         (Archive::read_symbols): New function.
14225         (Archive::add_symbols): Add counters.
14226         (Archive::include_all_members): Use armap to find members if it's
14227         already built.
14228         (Archive::include_member): Skip reading symbols if already read.
14229         Factored code into Archive::get_file_and_offset and
14230         Archive::get_elf_object_for_member.  Changed call to
14231         Mapfile::report_include_archive_member.
14232         (Archive::print_stats): New function.
14233         * archive.h: Declare Object and Read_symbols_data classes.
14234         (Archive::Archive): Add initializers for new members.
14235         (Archive::setup): Add parameter.
14236         (Archive::print_stats): New function.
14237         (Archive::total_archives, Archive::total_members)
14238         (Archive::total_members_loaded): New variables.
14239         (Archive::get_file_and_offset): New function.
14240         (Archive::get_elf_object_for_member): New function.
14241         (Archive::read_all_symbols): New function.
14242         (Archive::read_symbols): New function.
14243         (Archive::Archive_member): New class.
14244         (Archive::members_): New member.
14245         (Archive::num_members_): New member.
14246         * main.cc: Include archive.h.
14247         (main): Call Archive::print_stats.
14248         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14249         archive parameter; member_name is now the fully-decorated name.
14250         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14251         * options.h: (General_options): Add --preread-archive-symbols option.
14252         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14253         Archive::setup.
14254
14255 2008-08-04  Ian Lance Taylor  <iant@google.com>
14256
14257         * symtab.h (Symbol::use_plt_offset): New function.
14258         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14259         * powerpc.cc (Relocate::relocate): Likewise.
14260         * sparc.cc (Relocate::relocate): Likewise.
14261         * x86_64.cc (Relocate::relocate): Likewise.
14262         * testsuite/weak_plt.sh: New test.
14263         * testsuite/weak_plt_main.cc: New test.
14264         * testsuite/weak_plt_shared.cc: New test.
14265         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14266         (check_PROGRAMS): Add weak_plt.
14267         (check_DATA): Add weak_plt_shared.so.
14268         (weak_plt_main_pic.o, weak_plt): New targets.
14269         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14270         * testsuite/Makefile.in: Rebuild.
14271
14272         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14273         gcctestdir/ld.
14274         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14275         * testsuite/Makefile.in: Rebuild.
14276
14277 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14278
14279         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14280         * Makefile.in: Regenerate.
14281         * po/POTFILES.in: Regenerate.
14282
14283 2008-07-29  Ian Lance Taylor  <iant@google.com>
14284
14285         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14286         symbols before other symbols.
14287         * testsuite/script_test_2.cc (test_addr): Declare.
14288         (test_addr_alias): Declare.
14289         (main): Check that test_addr and test_addr_alias have the right
14290         values.
14291         * testsuite/script_test_2.t: Define test_addr_alias and
14292         test_addr.
14293
14294 2008-07-24  Ian Lance Taylor  <iant@google.com>
14295
14296         PR 5990
14297         * descriptors.cc: New file.
14298         * descriptors.h: New file.
14299         * gold-threads.h (class Hold_optional_lock): New class.
14300         * fileread.cc: Include "descriptors.h".
14301         (File_read::~File_read): Release descriptor rather than closing
14302         it.
14303         (File_read::open) [file]: Call open_descriptor rather than open.
14304         Set is_descriptor_opened_.
14305         (File_read::open) [memory]: Assert that descriptor is not open.
14306         (File_read::reopen_descriptor): New function.
14307         (File_read::release): Release descriptor.
14308         (File_read::do_read): Make non-const.  Reopen descriptor.
14309         (File_read::read): Make non-const.
14310         (File_read::make_view): Reopen descriptor.
14311         (File_read::do_readv): Likewise.
14312         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14313         Update declarations.
14314         * layout.cc: Include "descriptors.h".
14315         (Layout::create_build_id): Use open_descriptor rather than open.
14316         * output.cc: Include "descriptors.h".
14317         (Output_file::open): Use open_descriptor rather than open.
14318         * archive.cc (Archive::const_iterator): Change Archive to be
14319         non-const.
14320         (Archive::begin, Archive::end): Make non-const.
14321         (Archive::count_members): Likewise.
14322         * archive.h (class Archive): Update declarations.
14323         * object.h (Object::read): Make non-const.
14324         * Makefile.am (CCFILES): Add descriptors.cc.
14325         (HFILES): Add descriptors.h.
14326         * Makefile.in: Rebuild.
14327
14328         PR 6716
14329         * gold.h: Always include <clocale>.  Add Solaris workarounds
14330         following code in binutils/sysdep.h.
14331
14332         PR 6048
14333         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14334         this->eh_frame_hdr_ is NULL before using it.
14335
14336         * dynobj.cc (Versions::Versions): Update comment.
14337
14338         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14339         the base version name.
14340
14341         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14342         array size plus one.
14343         (Stringpool_template::set_string_offsets): Subtract one from key
14344         before using it as an array index.
14345         (Stringpool_template::get_offset_with_length): Likewise.
14346         (Stringpool_template::write_to_buffer): Likewise.
14347         * stringpool.h (Stringpool_template::get_offset_from_key):
14348         Likewise.
14349
14350 2008-07-23  Ian Lance Taylor  <iant@google.com>
14351
14352         PR 6658
14353         * object.h (Merged_symbol_value::value): Do our best to handle a
14354         negative addend.
14355
14356         PR 6647
14357         * script.cc (Version_script_info::get_versions): Don't add empty
14358         version tag to return value.
14359         (Version_script_info::get_symbol_version_helper): Change return
14360         type to bool.  Add pversion parameter.  Change all callers.
14361         (script_register_vers_node): Don't require a non-NULL tag.
14362         * script.h (class Version_script_info): Update declarations.
14363         (Version_script_info::get_symbol_version): Change return type to
14364         bool.  Add version parameter.  Change all callers.
14365         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14366         handling.  Handle an empty version from a version script.
14367         (Symbol_table::define_special_symbol): Likewise.
14368         * testsuite/ver_test_10.script: New file.
14369         * testsuite/ver_test_10.sh: New file.
14370         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14371         (check_DATA): Add ver_test_10.syms.
14372         (ver_test_10.syms, ver_test_10.so): New target.
14373         * testsuite/Makefile.in: Rebuild.
14374
14375 2008-07-23  Simon Baldwin  <simonb@google.com>
14376
14377         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14378         to zero for undefined symbols from dynamic libraries.
14379
14380 2008-07-23  Ian Lance Taylor  <iant@google.com>
14381
14382         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14383         Change all callers.
14384         * symtab.h (class Symbol_table): Update declaration.
14385         * testsuite/ver_test_9.cc: New file.
14386         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14387         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14388         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14389         (ver_test_9.so, ver_test_9.o): New targets.
14390         * testsuite/Makefile.in: Rebuild.
14391
14392 2008-07-22  Ian Lance Taylor  <iant@google.com>
14393
14394         * options.h (class General_options): Define --check-sections.
14395         * layout.cc (Layout::set_segment_offsets): Handle
14396         --check-sections.
14397
14398         * options.h (class General_options): Define -n/--nmagic and
14399         -N/--omagic.
14400         * options.cc (General_options::finalize): For -n/--nmagic or
14401         -N/--omagic, set -static.
14402         * layout.cc (Layout::attach_allocated_section_to_segment): If
14403         -N/--omagic, don't put read-only and read-write sections in
14404         different segments.
14405         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14406         finding a read-only segment.
14407         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14408         don't set the minimum segment alignment to the common page size,
14409         and don't set the file offset to the address modulo the page size.
14410         * script-sections.cc (Script_sections::create_segments): If
14411         -n/--omagic, don't put read-only and read-write sections in
14412         different segments.
14413
14414         * cref.cc: New file.
14415         * cref.h: New file.
14416         * options.h (class General_options): Add --print-symbol-counts.
14417         * main.cc (main): Issue defined symbol report if requested.
14418         * archive.cc (Archive::interpret_header): Make into a const member
14419         function.
14420         (Archive::add_symbols): Call Input_objects::archive_start and
14421         archive_stop.
14422         (Archive::const_iterator): Define new class.
14423         (Archive::begin, Archive::end): New functions.
14424         (Archive::include_all_members): Rewrite to use iterator.
14425         (Archive::count_members): New function.
14426         * archive.h (class Archive): Update declarations.
14427         (Archive::filename): New function.
14428         * object.cc: Include "cref.h".
14429         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14430         (Sized_relobj::do_get_global_symbol_counts): New function.
14431         (Input_objects::add_object): Add object to cross-referencer.
14432         (Input_objects::archive_start): New function.
14433         (Input_objects::archive_stop): New function.
14434         (Input_objects::print_symbol_counts): New function.
14435         * object.h: Declare Cref and Archive.
14436         (Object::get_global_symbol_counts): New function.
14437         (Object::do_get_global_symbol_counts): New pure virtual function.
14438         (class Sized_relobj): Add defined_count_ field.  Update
14439         declarations.
14440         (class Input_objects): Add cref_ field.  Update constructor.
14441         Update declarations.
14442         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14443         defined_count_.
14444         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14445         symbol counts.
14446         (Sized_dynobj::do_get_global_symbol_counts): New function.
14447         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14448         defined_count_.  Update declarations.  Define Symbols typedef.
14449         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14450         parameter.  Change all callers.
14451         (Symbol_table::add_from_dynobj): Add sympointers and defined
14452         parameters.  Change all callers.
14453         * symtab.h (class Symbol_table): Update declarations.
14454         * Makefile.am (CCFILES): Add cref.cc.
14455         (HFILES): Add cref.h.
14456         * Makefile.in: Rebuild.
14457
14458 2008-07-22  Simon Baldwin  <simonb@google.com>
14459
14460         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14461         to zero when writing undefined symbols.
14462
14463 2008-07-22  Ian Lance Taylor  <iant@google.com>
14464
14465         * output.cc (Output_section::add_input_section): Don't try to
14466         merge empty merge sections.
14467
14468 2008-07-21  Craig Silverstein  <csilvers@google.com>
14469
14470         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14471         Include symbol version in error message.
14472
14473 2008-07-20  Chris Demetriou  <cgd@google.com>
14474
14475         * configure.ac (gold_cv_c_random_seed): New configured variable.
14476         (RANDOM_SEED_CFLAGS): New substituted variable.
14477         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14478         * configure: Rebuild.
14479         * Makefile.in: Likewise.
14480         * testsuite/Makefile.in: Likewise.
14481
14482 2008-07-18  Ian Lance Taylor  <iant@google.com>
14483
14484         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14485         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14486         * testsuite/ver_test_main.cc (main): Call t4.
14487         (t4, t4_2a): Define.
14488         * testsuite/ver_test_2.cc (t4_2): Define.
14489         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14490         * testsuite/ver_test_4.cc (t4_2a): Define.
14491         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14492         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14493
14494 2008-07-17  Ian Lance Taylor  <iant@google.com>
14495
14496         * dynobj.cc (Versions::add_def): If we give an error about a
14497         missing version, go ahead and create the version anyhow.
14498
14499 2008-07-10  Ian Lance Taylor  <iant@google.com>
14500
14501         Handle output sections with more than 0x7fffffff bytes.
14502         * object.h (class Relobj): Change map_to_output_ to
14503         output_sections_, and just keep a section pointer.  Change all
14504         uses.  Move comdat group support to Sized_relobj.
14505         (Relobj::is_section_specially_mapped): Remove.
14506         (Relobj::output_section): Remove poff parameter.  Change all
14507         callers.
14508         (Relobj::output_section_offset): New function.
14509         (Relobj::set_section_offset): Rewrite.
14510         (Relobj::map_to_output): Remove.
14511         (Relobj::output_sections): New function.
14512         (Relobj::do_output_section_offset): New pure virtual function.
14513         (Relobj::do_set_section_offset): Likewise.
14514         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14515         group support from Relobj.  Update declarations.
14516         (Sized_relobj::get_output_section_offset): New function.
14517         (Sized_relobj::do_output_section_offset): New function.
14518         (Sized_relobj::do_set_section_offset): New function.
14519         * object.cc (Relobj::output_section_address): Remove.
14520         (Sized_relobj::Sized_relobj): Initialize new fields.
14521         (Sized_relobj::include_section_group): Cast find_kept_object to
14522         Sized_relobj.
14523         (Sized_relobj::include_linkonce_section): Likewise.
14524         (Sized_relobj::do_layout): Use separate arrays for output section
14525         and output offset.
14526         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14527         output_sections.
14528         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14529         output_sections and section_offsets.
14530         (Sized_relobj::write_local_symbols): Likewise.
14531         (map_to_kept_section): Compute output address directly.
14532         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14533         output_sections and section_offsets.
14534         (Sized_relobj::write_sections): Likewise.
14535         (Sized_relobj::relocate_sections): Likewise.
14536         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14537         * output.h (class Output_reloc): Update declarations.  Change
14538         u2_.relobj to Sized_relobj*.
14539         (class Output_data_reloc): Change add functions to use
14540         Sized_relobj*.
14541         * output.cc (Output_reloc::Output_reloc): Change relobj to
14542         Sized_relobj*.
14543         (Output_reloc::local_section_offset): Change return type to
14544         Elf_Addr.  Use get_output_section_offset.
14545         (Output_reloc::get_address): Likewise.
14546         (Output_section::is_input_address_mapped): Don't call
14547         is_section_specially_mapped.
14548         (Output_section::output_offset): Likewise.
14549         (Output_section::output_address): Likewise.
14550         (Output_section::starting_output_address): Likewise.
14551         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14552         parameter to Sized_relobj*.
14553         (Copy_relocs::need_copy_reloc): Likewise.
14554         (Copy_relocs::save): Likewise.
14555         * copy-relocs.h (class Copy_relocs): Update declarations.
14556         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14557         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14558         * target-reloc.h (relocate_for_relocatable): Change
14559         offset_in_output_section type to Elf_Addr.  Change code that uses
14560         it as well.
14561         * layout.cc (Layout::layout): Always set *off.
14562         * mapfile.cc (Mapfile::print_input_section): Use
14563         output_section_offset.
14564         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14565         Sized_relobj*.
14566         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14567         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14568         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14569
14570 2008-07-03  Ian Lance Taylor  <iant@google.com>
14571
14572         * layout.cc (Layout::include_section): Do not discard unrecognized
14573         SHT_STRTAB sections.
14574
14575 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14576
14577         * script.cc (Lex::can_continue_name): Make '?' allowable in
14578         version-script names.
14579         * testsuite/version_script.map: Change glob pattern to use '?'
14580
14581 2008-06-30  Manish Singh  <yosh@gimp.org>
14582
14583         PR 6585
14584         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14585         Correct typo.
14586
14587 2008-06-30  Ian Lance Taylor  <iant@google.com>
14588
14589         PR 6660
14590         PR 6682
14591         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14592         versions]: Don't try to read the value in the contents, since we
14593         don't use it.  Use the template endianness when writing.
14594
14595 2008-06-25  Cary Coutant  <ccoutant@google.com>
14596
14597         * fileread.cc (File_read::make_view): Assert on zero-length view.
14598         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14599         symbol table when there are no symbols to read.
14600
14601 2008-06-23  Craig Silverstein  <csilvers@google.com>
14602
14603         * version.cc (version_string): Bump to 1.7
14604
14605 2008-06-18  Craig Silverstein  <csilvers@google.com>
14606
14607         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14608         constant 0xFFFF to type Valtype.
14609         (Powerpc_relocate_functions::rel16_ha): Likewise.
14610
14611 2008-06-17  Ian Lance Taylor  <iant@google.com>
14612
14613         * output.h (Output_section::Input_section): Initialize p2align_ to
14614         zero for Output_section_data constructors.
14615         (Output_section::Input_section::addralign): If not an input
14616         section, return the alignment of the Output_section_data.
14617         * testsuite/copy_test.cc: New file.
14618         * testsuite/copy_test_1.cc: New file.
14619         * testsuite/copy_test_2.cc: New file.
14620         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14621         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14622         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14623         (copy_test_1_pic.o, copy_test_1.so): New targets.
14624         (copy_test_2_pic.o, copy_test_2.so): New targets.
14625         * testsuite/Makefile.in: Rebuild.
14626
14627         * script-sections.cc (Script_sections::place_orphan): Initialize
14628         local variable exact.
14629
14630 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14631
14632         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14633
14634 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14635             David S. Miller  <davem@davemloft.net>
14636
14637         * powerpc.cc: New file.
14638         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14639         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14640         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14641         * Makefile.in: Rebuild.
14642
14643 2008-06-09  Ian Lance Taylor  <iant@google.com>
14644
14645         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14646         <exception>.
14647         (throwing, orig_terminate): New static variables.
14648         (terminate_handler): New static function.
14649         (t2): Set terminate handler.
14650
14651 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14652
14653         PR 6584
14654         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14655         alignment.
14656
14657 2008-05-30  Cary Coutant  <ccoutant@google.com>
14658
14659         * archive.cc (Archive::include_all_members) Correct to step
14660         over symbol table and extended name table in thin archives.
14661
14662 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14663
14664         PR 6407
14665         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14666         calculation.
14667
14668 2008-05-28  Caleb Howe  <cshowe@google.com>
14669
14670         * reduced_debug_output.cc: New file.
14671         * reduced_debug_output.h: New file.
14672         * options.h (class General_options): Add --strip-debug-non-line.
14673         * options.cc (General_options::finalize): Add strip_debug_non_line
14674         to the strip heirarchy.
14675         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14676         fields.
14677         * layout.cc: Include "reduced_debug_output.h".
14678         (Layout::Layout): Initialize new fields.
14679         (line_only_debug_sections): New static array.
14680         (is_lines_only_debug_sections): New static inline function.
14681         (Layout::include_section): Handle --strip-debug-non-line.
14682         (Layout::make_output_section): If --strip-debug-non-line, build
14683         new output sections for .debug_abbrev and .debug_info.
14684         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14685         gold.  Warn about possible overflow.
14686         (read_signed_LEB_128): Likewise.
14687         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14688         (read_signed_LEB_128): Declare.
14689         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14690         (HFILES): Add reduced_debug_output.h.
14691         * Makefile.in: Rebuild.
14692
14693 2008-05-21  Ian Lance Taylor  <iant@google.com>
14694
14695         * mapfile.cc: New file.
14696         * mapfile.h: New file.
14697         * options.h (class General_options): Add -M/--print-map and -Map.
14698         * options.cc (General_options::finalize): Make -M equivalent to
14699         -Map -.
14700         * main.cc: Include <cstdio> and "mapfile.h".
14701         (main): Open mapfile if requested.
14702         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14703         constructor.  Change caller.
14704         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14705         (queue_middle_tasks): Likewise.
14706         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14707         declarations.
14708         * archive.cc: Include "mapfile.h".
14709         (Archive::add_symbols): Add mapfile parameter.  Change all
14710         callers.  Pass mapfile, symbol, and reason to include_member.
14711         (Archive::include_all_members): Add mapfile parameter.  Change all
14712         callers.
14713         (Archive::include_member): Add mapfile, sym, and why parameters.
14714         Change all callers.  Report inclusion to map file.
14715         * archive.h: Include "fileread.h".
14716         (class Archive): Update declarations.
14717         (Archive::file): New const method.
14718         (class Add_archive_symbols): Add mapfile_ field.  Update
14719         constructor.  Change all callers.
14720         * readsyms.h (class Read_symbols): Likewise.
14721         (class Finish_group): Likewise.
14722         (class Read_script): Likewise.
14723         * common.cc: Include "mapfile.h".
14724         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14725         all callers.
14726         (Symbol_table::do_allocate_commons): Likewise.
14727         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14728         symbol allocation to mapfile.
14729         * common.h (class Allocate_commons_task): Add mapfile_ field.
14730         Update constructor.  Change all callers.
14731         * symtab.h (class Symbol_table): Update declarations.
14732         * layout.cc: Include "mapfile.h".
14733         (Layout_task_runner::run): Print information to mapfile.
14734         (Layout::create_gold_note): Change Output_data_fixed_space to
14735         Output_data_zero_fill.
14736         (Layout::create_build_id): Likewise.
14737         (Layout::print_to_mapfile): New function.
14738         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14739         constructor.  Change caller.
14740         (class Layout): Declare print_to_mapfile.
14741         * output.cc (Output_section::Input_section::print_to_mapfile): New
14742         function.
14743         (Output_section::add_input_section): If producing a map, always
14744         add to input_sections_ list.
14745         (Output_section::do_print_to_mapfile): New function.
14746         (Output_segment::print_sections_to_mapfile): New function.
14747         (Output_segment::print_section_list_to_mapfile): New function.
14748         * output.h: Include "mapfile.h".
14749         (Output_data::print_to_mapfile): New function.
14750         (Output_data::do_print_to_mapfile): New virtual function.
14751         (Output_segment_headers::do_print_to_mapfile): New function.
14752         (Output_file_header::do_print_to_mapfile): New function.
14753         (Output_data_const::do_print_to_mapfile): New function.
14754         (class Output_data_const_buffer): Add map_name_ field.  Update
14755         constructor.  Change all callers.  Add do_print_to_mapfile
14756         function.
14757         (class Output_data_fixed_space): Likewise.
14758         (class Output_data_space): Likewise.
14759         (class Output_data_zero_fill): New class.
14760         (Output_data_strtab::do_print_to_mapfile): New function.
14761         (Output_data_reloc_base::do_print_to_mapfile): New function.
14762         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14763         (Output_data_group::do_print_to_mapfile): New function.
14764         (Output_data_got::do_print_to_mapfile): New function.
14765         (Output_data_dynamic::do_print_to_mapfile): New function.
14766         (Output_symtab_xindex::do_print_to_mapfile): New function.
14767         (class Output_section): Declare do_print_to_mapflie.  Declare
14768         print_to_mapfile in Input_section.
14769         (class Output_segment): Declare new functions.
14770         * object.h (Sized_relobj::symbol_count): New function.
14771         * script-sections.cc
14772         (Output_section_element_dot_assignment::set_section_addresses):
14773         Change Output_data_fixed_space to Output_data_zero_fill.
14774         (Output_data_expression::do_print_to_mapfile): New function.
14775         * script.cc (read_input_script): Add mapfile parameter.  Change
14776         all callers.
14777         * script.h (read_input_script): Update declaration.
14778         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14779         (Eh_frame::do_print_to_mapfile): New function.
14780         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14781         (Output_merge_string::do_print_to_mapfile): New function.
14782         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14783         function.
14784         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14785         function.
14786         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14787         function.
14788         * Makefile.am (CCFILES): Add mapfile.cc.
14789         (HFILES): Add mapfile.h.
14790         * Makefile.in: Rebuild.
14791
14792 2008-05-19  Ian Lance Taylor  <iant@google.com>
14793
14794         * options.h (class General_options): Add -z relro.
14795         * layout.cc (Layout::Layout): Initialize relro_segment_.
14796         (Layout::add_output_section_data): Return the output section.
14797         (Layout::make_output_section): Rcognize relro sections and mark
14798         them appropriately.
14799         (Layout::attach_allocated_section_to_segment): Put relro sections
14800         in a PT_GNU_RELRO segment.
14801         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14802         section as relro.
14803         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14804         PT_TLS segments.
14805         (Layout::linkonce_mapping): Map d.rel.ro.local to
14806         .data.rel.ro.local.
14807         (Layout::output_section_name): Us .data.rel.ro.local for any
14808         section which begins with that.
14809         * layout.h (class Layout): Update add_output_section_data
14810         declaration.  Add relro_segment_ field.
14811         * output.cc (Output_section::Output_section): Initialize is_relro_
14812         and is_relro_local_ fields.
14813         (Output_segment::add_output_section): Group relro sections.
14814         (Output_segment::is_first_section_relro): New function.
14815         (Output_segment::maximum_alignment): If there is a relro section,
14816         align the segment to the common page size.
14817         (Output_segment::set_section_addresses): Track whether we are
14818         looking at relro sections.  If the last section is a relro
14819         section, align to the common page size.
14820         (Output_segment::set_section_list_addresses): Add in_relro
14821         parameter.  Change all callers.  Align to the page size when
14822         moving from relro to non-relro section.
14823         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14824         segment.
14825         * output.h (class Output_section): Add is_relro_ and
14826         is_relro_local_ fields.
14827         (Output_section::is_relro): New function.
14828         (Output_section::set_is_relro): New function.
14829         (Output_section::is_relro_local): New function.
14830         (Output_section::set_is_relro_local): New function.
14831         (class Output_segment): Update declarations.
14832         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14833         * sparc.cc (Target_sparc::got_section): Likewise.
14834         * x86_64.cc (Target_x86_64::got_section): Likewise.
14835         * testsuite/relro_test_main.cc: New file.
14836         * testsuite/relro_test.cc: New file.
14837         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14838         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14839         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14840         (relro_test.so, relro_test_pic.o): New targets.
14841         * testsuite/Makefile.in: Rebuild.
14842
14843 2008-05-16  Ian Lance Taylor  <iant@google.com>
14844
14845         * output.cc (Output_segment::add_output_section): Remove front
14846         parameter.
14847         * output.h (class Output_segment): Remove
14848         add_initial_output_section and overloaded add_output_section.
14849         Update declaration of remaining add_output_section.
14850         * layout.cc (Layout::create_interp): Call add_output_section
14851         rather than add_initial_output_section.
14852         (Layout::finish_dynamic_section): Likewise.
14853
14854         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14855         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14856         know the dynamic type.
14857         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14858         field.  Initialize it in constructor.
14859         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14860         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14861         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14862         reloc.
14863
14864         * output.cc (Output_reloc::get_address): Change return type to
14865         Elf_Addr.
14866         * output.h (class Output_reloc): Update get_address declaration.
14867         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14868         for section addresses.
14869
14870 2008-05-09  Ian Lance Taylor  <iant@google.com>
14871
14872         PR 6493
14873         * gold.cc (gold_nomem): Use return value of write.
14874
14875 2008-05-08  Ian Lance Taylor  <iant@google.com>
14876
14877         * symtab.c (Symbol::init_base_output_data): Add version
14878         parameter.  Change all callers.
14879         (Symbol::init_base_output_segment): Likewise.
14880         (Symbol::init_base_constant): Likewise.
14881         (Symbol::init_base_undefined): Likewise.
14882         (Sized_symbol::init_output_data): Likewise.
14883         (Sized_symbol::init_output_segment): Likewise.
14884         (Sized_symbol::init_constant): Likewise.
14885         (Sized_symbol::init_undefined): Likewise.
14886         (Symbol_table::do_define_in_output_data): If the new symbol has a
14887         version, mark it as the default.
14888         (Symbol_table::do_define_in_output_segment): Likewise.
14889         (Symbol_table::do_define_as_constant): Likewise.
14890         * symtab.h (class Symbol): Update declarations.
14891         (class Sized_symbol): Likewise.
14892         * resolve.cc (Symbol::override_version): New function.
14893         (Symbol::override_base): Call override_version.
14894         (Symbol::override_base_with_special): Likewise.
14895         * testsuite/ver_script_8.script: New file.
14896         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14897         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14898         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14899         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14900
14901 2008-05-06  Ian Lance Taylor  <iant@google.com>
14902
14903         PR 6049
14904         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14905         functions.
14906         (class General_options): Remove existing --undefined, and add
14907         --no-undefined instead.  Add new --undefined as synonym for -u.
14908         * archive.cc (Archive::add_symbols): Check whether symbol was
14909         named with -u.
14910         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14911         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14912         all uses.  Add IS_UNDEFINED.  Update declarations to split
14913         different versions of init_base.  Declare init_base_undefined.
14914         (Symbol::is_defined): Handle IS_UNDEFINED.
14915         (Symbol::is_undefined): Likewise.
14916         (Symbol::is_weak_undefined): Call is_undefined.
14917         (Symbol::is_absolute): Handle IS_CONSTANT.
14918         (class Sized_symbol): Update declarations to split different
14919         versions of init.  Declare init_undefined.
14920         (class Symbol_table): Declare new functions.
14921         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14922         Change all callers.
14923         (Symbol::init_base_output_data): Likewise.
14924         (Symbol::init_base_output_segment): Likewise.
14925         (Symbol::init_base_constant): Likewise.
14926         (Symbol::init_base_undefined): New function.
14927         (Sized_symbol::init_object): Rename from init.  Change all
14928         callers.
14929         (Sized_symbol::init_output_data): Likewise.
14930         (Sized_symbol::init_output_segment): Likewise.
14931         (Sized_symbol::init_constant): Likewise.
14932         (Sized_symbol::init_undefined): New function.
14933         (Symbol_table::add_undefined_symbols_from_command_line): New
14934         function.
14935         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14936         function.
14937         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14938         (Symbol::output_section): Likewise.
14939         (Symbol::set_output_section): Likewise.
14940         (Symbol_table::sized_finalize_symbol): Likewise.
14941         (Symbol_table::sized_write_globals): Likewise.
14942         * resolve.cc (Symbol_table::should_override): Likewise.
14943         (Symbol::override_base_with_special): Likewise.
14944
14945         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14946         symbol, change it to have default visibility.
14947         * testsuite/protected_1.cc: New file.
14948         * testsuite/protected_2.cc: New file.
14949         * testsuite/protected_3.cc: New file.
14950         * testsuite/protected_main_1.cc: New file.
14951         * testsuite/protected_main_2.cc: New file.
14952         * testsuite/protected_main_3.cc: New file.
14953         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14954         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14955         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14956         (protected_1.so): New target.
14957         (protected_1_pic.o, protected_2_pic.o): New targets.
14958         (protected_3_pic.o): New target.
14959         (check_PROGRAMS): Add protected_2.
14960         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14961         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14962         * testsuite/Makefile.in: Rebuild.
14963
14964         * options.h (DEFINE_var): Add set_user_set_##varname__.
14965         (DEFINE_bool_alias): New macro.
14966         (class General_options): Define -Bstatic using DEFINE_bool_alias
14967         rather than DEFINE_special.  Add --undefined as an alias for -z
14968         defs.
14969         * options.cc (General_options::parse_Bstatic): Remove.
14970
14971         * options.h (class General_options): Add --fatal-warnings.
14972         * main.cc (main): Implement --fatal-warnings.
14973         * errors.h (Errors::warning_count): New function.
14974
14975         * options.h (class General_options): Add -Bsymbolic-functions.
14976         * symtab.h (Symbol::is_preemptible): Check for
14977         -Bsymbolic-functions.
14978
14979 2008-05-05  Ian Lance Taylor  <iant@google.com>
14980
14981         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14982         as noVARNAME rather than no-VARNAME.
14983         (class General_options): Add option -z combreloc.
14984         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14985         get_address.
14986         (Output_reloc::sort_before) [SHT_REL]: New function.
14987         (Output_reloc::sort_before) [SHT_RELA]: New function.
14988         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14989         Sort_relocs_comparison.
14990         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14991         parameter.  Change all callers.
14992         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14993         sort_relocs parameter.  Change all callers.
14994         * output.cc (Output_reloc::get_address): New function, broken out
14995         of write_rel.
14996         (Output_reloc::write_rel): Call it.
14997         (Output_reloc::compare): New function.
14998         (Output_data_reloc_base::do_write): Optionally sort relocs.
14999
15000         * configure.ac: If targ_extra_obj is set, link it in.
15001         * configure.tgt: Initialize all variables.
15002         (x86_64*): Set targ_extra_obj and targ_extra_size.
15003         * configure: Rebuild.
15004
15005         * object.cc (Sized_relobj::include_section_group): Adjust section
15006         indexes read from group data.  Build vector to pass to
15007         layout_group.
15008         * layout.cc (Layout::layout_group): Add flags and shndxes
15009         parameters.  Remove contents parameter.  Change caller.  Update
15010         explicit instantiations.
15011         * layout.h (class Layout): Update layout_group declaration.
15012         * output.cc (Output_data_group::Output_data_group): Add flags and
15013         input_shndxes parameters.  Remove contents parameter.  Change
15014         caller.
15015         (Output_data_group::do_write): Change input_sections_ to
15016         input_shndxes_.
15017         * output.h (class Output_data_group): Update constructor
15018         declaration.  Rename input_sections_ to input_shndxes_.
15019         * testsuite/many_sections_test.cc: Add template.
15020
15021 2008-04-30  Cary Coutant  <ccoutant@google.com>
15022
15023         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15024
15025         * layout.cc (Layout::include_section): Refactored check for debug
15026         info section.
15027         (Layout::add_comdat): Add new parameters.  Change type
15028         of signature parameter.  Add object and shndx to signatures table.
15029         (Layout::find_kept_object): New function.
15030         * layout.h: Include <cstring>.
15031         (Layout::is_debug_info_section): New function.
15032         (Layout::add_comdat): Add new parameters.
15033         (Layout::find_kept_object): New function.
15034         (Layout::Kept_section): New struct.
15035         (Layout::Signatures): Change type of map range.
15036         * object.cc (Relobj::output_section_address): New function.
15037         (Sized_relobj::include_section_group): Add new parameters.  Change
15038         calls to Layout::add_comdat.  Change to build table of kept comdat
15039         groups and table mapping discarded sections to kept sections.
15040         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15041         (Sized_relobj::do_layout): Change calls to include_section_group and
15042         include_linkonce_section.
15043         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15044         value to zero when section is discarded.
15045         (Sized_relobj::map_to_kept_section): New function.
15046         * object.h (Relobj::output_section_address): New function.
15047         (Relobj::Comdat_group): New type.
15048         (Relobj::find_comdat_group): New function.
15049         (Relobj::Comdat_group_table): New type.
15050         (Relobj::Kept_comdat_section): New type.
15051         (Relobj::Kept_comdat_section_table): New type.
15052         (Relobj::add_comdat_group): New function.
15053         (Relobj::set_kept_comdat_section): New function.
15054         (Relobj::get_kept_comdat_section): New function.
15055         (Relobj::comdat_groups_): New field.
15056         (Relobj::kept_comdat_sections_): New field.
15057         (Symbol_value::input_value): Update comment.
15058         (Sized_relobj::map_to_kept_section) New function.
15059         (Sized_relobj::include_linkonce_section): Add new parameter.
15060         * target-reloc.h (Comdat_behavior): New type.
15061         (get_comdat_behavior): New function.
15062         (relocate_section): Add code to map a discarded section to the
15063         corresponding kept section when applying a relocation.
15064
15065 2008-04-30  Craig Silverstein  <csilvers@google.com>
15066
15067         * dwarf_reader.cc (next_generation_count): New static var.
15068         (Addr2line_cache_entry): New struct.
15069         (addr2line_cache): New static var.
15070         (Dwarf_line_info::one_addr2line): Added caching.
15071         (Dwarf_line_info::clear_addr2line_cache): New function.
15072         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15073         cache-size parameter.
15074         (Dwarf_line_info::one_addr2line_cache): New function.
15075         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15076         new cache-size argument to one_addr2line(), and clear cache.
15077
15078 2008-04-28  Cary Coutant  <ccoutant@google.com>
15079
15080         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15081         R_386_PC8 relocations.
15082
15083 2008-04-23  Ian Lance Taylor  <iant@google.com>
15084
15085         * object.cc (Sized_relobj::include_section_group): Check for
15086         invalid section group.
15087
15088         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15089         header size.
15090
15091         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15092         than read for file header.
15093         * archive.cc (Archive::include_member): Likewise.
15094
15095 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15096
15097         * aclocal.m4: Regenerate.
15098         * configure: Regenerate.
15099
15100 2008-04-19  Ian Lance Taylor  <iant@google.com>
15101
15102         * version.cc (version_string): Bump to 1.6.
15103
15104         * testsuite/Makefile.am (many_sections_r_test): New target.
15105         (many_sections_r_test_SOURCES): Remove.
15106         (many_sections_r_test_DEPENDENCIES): Remove.
15107         (many_sections_r_test_LDFLAGS): Remove.
15108         (many_sections_r_test_LDADD): Remove.
15109
15110         * object.cc (Sized_relobj::do_add_symbols): Always pass
15111         local_symbol_count_ to add_from_relobj.
15112
15113         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15114         every thousand variables.
15115         * testsuite/Makefile.in: Rebuild.
15116
15117         * object.cc (Xindex::initialize_symtab_xindex): New function.
15118         (Xindex::read_symtab_xindex): New function.
15119         (Xindex::sym_xindex_to_shndx): New function.
15120         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15121         available.
15122         (Sized_relobj::do_initialize_xindex): New function.
15123         (Sized_relobj::do_read_symbols): Adjust section links.
15124         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15125         parameter.  Change all callers.
15126         (Sized_relobj::include_section_group): Adjust section links and
15127         symbol section indexes.
15128         (Sized_relobj::do_layout): Adjust section links.
15129         (Sized_relobj::do_count_local_symbols): Adjust section links and
15130         symbol section indexes.
15131         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15132         ordinary and special symbols.
15133         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15134         dynsym_xindex parameters.  Change all callers.  Adjust section
15135         links.  Use SHN_XINDEX when needed.
15136         (Sized_relobj::get_symbol_location_info): Adjust section links.
15137         Don't get fooled by special symbols.
15138         * object.h (class Xindex): Define.
15139         (class Object): Add xindex_ parameter.  Declare virtual functoin
15140         do_initialize_xindex.
15141         (Object::adjust_sym_shndx): New function.
15142         (Object::set_xindex): New protected function.
15143         (class Symbol_value): Add is_ordinary_shndx_ field.
15144         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15145         (Symbol_value::value): Assert ordinary section.
15146         (Symbol_value::initialize_input_to_output_map): Likewise.
15147         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15148         Change all callers.
15149         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15150         all callers.
15151         (class Sized_relobj): Update declarations.
15152         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15153         parameter.  Change all callers.
15154         (Sized_relobj::adjust_shndx): New function.
15155         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15156         field.
15157         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15158         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15159         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15160         (Sized_dynobj::read_dynsym_section): Adjust section links.
15161         (Sized_dynobj::read_dynamic): Likewise.
15162         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15163         section links.
15164         (Sized_dynobj::do_initialize_xindex): New function.
15165         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15166         do_initialize_xindex.
15167         (Sized_dynobj::adjust_shndx): New function.
15168         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15169         dynsym_xindex_ fields.
15170         (Layout::finalize): Add a call to set_section_indexes before
15171         creating the symtab sections.
15172         (Layout::set_section_indexes): Don't do anything if the section
15173         already has a section index.
15174         (Layout::create_symtab_sections): Add shnum parameter.  Change
15175         caller.  Create .symtab_shndx section if needed.
15176         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15177         caller.
15178         (Layout::allocated_output_section_count): New function.
15179         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15180         needed.
15181         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15182         fields.  Update declarations.
15183         (Layout::symtab_xindex): New function.
15184         (Layout::dynsym_xindex): New function.
15185         (class Write_symbols_task): Add layout_ field.
15186         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15187         Change caller.
15188         * output.cc (Output_section_headers::Output_section_headers): Add
15189         shstrtab_section parameter.  Change all callers.
15190         (Output_section_headers::do_sized_write): Store overflow values
15191         for section count and section string table section index in
15192         section header zero.
15193         (Output_file_header::do_sized_write): Check for overflow of
15194         section count and section string table section index.
15195         (Output_symtab_xindex::do_write): New function.
15196         (Output_symtab_xindex::endian_do_write): New function.
15197         * output.h (class Output_section_headers): Add shstrtab_section_.
15198         Update declarations.
15199         (class Output_symtab_xindex): Define.
15200         (Output_section::has_out_shndx): New function.
15201         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15202         field.
15203         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15204         Change all callers.
15205         (Sized_symbol::init): Likewise.
15206         (Symbol::output_section): Check for ordinary symbol.
15207         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15208         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15209         callers.
15210         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15211         Change all callers.  Simplify handling of symbols from sections
15212         not included in the link.
15213         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15214         distinction.
15215         (Weak_alias_sorter::operator()): Assert that symbols are
15216         ordinary.
15217         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15218         distinction.
15219         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15220         parameters.  Change all callers.
15221         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15222         symbol distinction.  Use SHN_XINDEX when needed.
15223         (Symbol_table::write_section_symbol): Add symtab_xindex
15224         parameter.  Change all callers.
15225         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15226         SHN_XINDEX when needed.
15227         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15228         declarations.
15229         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15230         (Symbol::is_defined): Check is_ordinary.
15231         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15232         (Symbol::is_absolute, Symbol::is_common): Likewise.
15233         (class Sized_symbol): Update declarations.
15234         (class Symbol_table): Update declarations.
15235         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15236         parameters.  Change all callers.
15237         (Sized_symbol::override): Likewise.
15238         (Symbol_table::override): Likewise.
15239         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15240         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15241         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15242         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15243         to be in an ordinary section.
15244         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15245         object and is_ordinary parameters.  Change all callers.
15246         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15247         Change all callers.  Don't add undefined or non-ordinary symbols
15248         to reloc_map_.
15249         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15250         Change all callers.
15251         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15252         declarations.
15253         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15254         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15255         (Sized_relobj::relocate_sections): Likewise.
15256         * target-reloc.h (scan_relocs): Adjust section symbol index.
15257         (scan_relocatable_relocs): Likewise.
15258         * i386.cc (Scan::local): Check for ordinary symbols.
15259         * sparc.cc (Scan::local): Likewise.
15260         * x86_64.cc (Scan::local): Likewise.
15261         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15262         to symbol_section_and_value.
15263         * testsuite/many_sections_test.cc: New file.
15264         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15265         (check_PROGRAMS): Add many_sections_test.
15266         (many_sections_test_SOURCES): Define.
15267         (many_sections_test_DEPENDENCIES): Define.
15268         (many_sections_test_LDFLAGS): Define.
15269         (BUILT_SOURCES): Add many_sections_define.h.
15270         (many_sections_define.h): New target.
15271         (BUILT_SOURCES): Add many_sections_check.h.
15272         (many_sections_check.h): New target.
15273         (check_PROGRAMS): Add many_sections_r_test.
15274         (many_sections_r_test_SOURCES): Define.
15275         (many_sections_r_test_DEPENDENCIES): Define.
15276         (many_sections_r_test_LDFLAGS): Define.
15277         (many_sections_r_test_LDADD): Define.
15278         (many_sections_r_test.o): New target.
15279         * testsuite/Makefile.in: Rebuild.
15280
15281 2008-04-17  Cary Coutant  <ccoutant@google.com>
15282
15283         * errors.cc (Errors::info): New function.
15284         (gold_info): New function.
15285         * errors.h (Errors::info): New function.
15286         * gold.h (gold_info): New function.
15287         * object.cc (Input_objects::add_object): Print trace output.
15288         * options.cc (options::parse_set): New function.
15289         (General_options::parse_wrap): Deleted.
15290         (General_options::General_options): Deleted initializer.
15291         * options.h (options::String_set): New typedef.
15292         (options::parse_set): New function.
15293         (DEFINE_set): New macro.
15294         (General_options::wrap): Changed to use DEFINE_set. Changed
15295         callers of any_wrap_symbols and is_wrap_symbol.
15296         (General_options::trace, General_options::trace_symbol):
15297         New options.
15298         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15299         (General_options::wrap_symbols_): Deleted.
15300         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15301
15302 2008-04-17  David S. Miller  <davem@davemloft.net>
15303
15304         * options.cc (General_options::parse_V): New function.
15305         * options.h: Add entries for -V and -Qy.
15306
15307 2008-04-17  Ian Lance Taylor  <iant@google.com>
15308
15309         * common.cc (Symbol_table::allocate_commons): Remove options
15310         parameter.  Change caller.
15311         (Symbol_table::do_allocate_commons): Remove options parameter.
15312         Change caller.  Just call do_allocate_commons_list twice.
15313         (Symbol_table::do_allocate_commons_list): New function, broken out
15314         of do_allocate_commons.
15315         * common.h (class Allocate_commons_task): Remove options_ field.
15316         Update constructor.
15317         * symtab.cc (Symbol_table::Symbol_table): Initialize
15318         tls_commons_.
15319         (Symbol_table::add_from_object): Put TLS common symbols on
15320         tls_commons_ list.
15321         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15322         which are IN_OUTPUT_DATA.
15323         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15324         allocate_commons and do_allocate_commons declarations.  Declare
15325         do_allocate_commons_list.
15326         * gold.cc (queue_middle_tasks): Update creation of
15327         Allocate_commons_task to not pass options.
15328         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15329         (TLS_TEST_C_FLAGS): New variable.
15330         (tls_test_c_pic.o): New target.
15331         (tls_test_shared.so): Link in tls_test_c_pic.o.
15332         (tls_test_c_pic_ie.o): New target.
15333         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15334         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15335         (tls_test_c.o): New target.
15336         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15337         (tls_pic_test_LDADD): Likewise.
15338         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15339         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15340         (tls_test_c_gnu2.o): New target.
15341         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15342         tls_test_c_gnu2.o.
15343         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15344         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15345         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15346         * testsuite/tls_test.cc: Include "config.h".
15347         (t_last): Call t11_last.
15348         * testsuite/tls_test.h (t11, t11_last): Declare.
15349         * testsuite/tls_test_c.c: New file.
15350         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15351         * configure.ac: Check for OpenMP support.
15352         * configure, config.in, Makefile.in: Rebuild.
15353         * testsuite/Makefile.in: Rebuild.
15354
15355 2008-04-16  Cary Coutant  <ccoutant@google.com>
15356
15357         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15358         (Target_i386::tls_base_symbol_defined_): New field.
15359         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15360         (Target_i386::Scan::global): Likewise.
15361         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15362         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15363         (Target_x86_64::tls_base_symbol_defined_): New field.
15364         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15365         (Target_x86_64::Scan::global): Likewise.
15366
15367 2008-04-16  Cary Coutant  <ccoutant@google.com>
15368
15369         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15370         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15371         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15372         building shared libraries.
15373         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15374         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15375         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15376         * testsuite/Makefile.in: Rebuild.
15377         * testsuite/weak_undef.h: New file.
15378         * testsuite/weak_undef_file1.cc: Add extra test cases.
15379         * testsuite/weak_undef_file2.cc: Likewise.
15380         * testsuite/weak_undef_test.cc: Likewise.
15381
15382 2008-04-16  David S. Miller  <davem@davemloft.net>
15383
15384         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15385         Add issued_non_pic_error_ field.  Declare check_non_pic.
15386         (Target_sparc::Scan::check_non_pic): New function.
15387         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15388         (Target_sparc::Scan::global): Likewise.
15389
15390         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15391         * configure: Rebuild.
15392
15393         * options.h (DEFINE_enable): New macro.
15394         (new_dtags): New enable option.
15395         (initfirst, interpose, loadfltr, nodefaultlib,
15396         nodelete, nodlopen, nodump): New -z options.
15397         * layout.cc (Layout:finish_dynamic_section): If new
15398         dtags enabled, emit DT_RUNPATH.  Also, emit a
15399         DT_FLAGS_1 containing any specified -z flags.
15400
15401 2008-04-16  Ian Lance Taylor  <iant@google.com>
15402
15403         * copy-relocs.cc: New file.
15404         * copy-relocs.h: New file.
15405         * reloc.cc: Remove Copy_relocs code.
15406         * reloc.h: Likewise.
15407         * reloc-types.h (struct Reloc_types) [both versions]: Add
15408         get_reloc_addend_noerror.
15409         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15410         variants of add_global which take an addend which must be zero.
15411         * i386.cc: Include "copy-relocs.h".
15412         (class Target_i386): Change type of copy_relocs_ to variable,
15413         update initializer.
15414         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15415         Change all callers.
15416         (Target_i386::do_finalize_sections): Change handling of
15417         copy_relocs_.
15418         * sparc.cc: Include "copy-relocs.h".
15419         (class Target_sparc): Change type of copy_relocs_ to variable,
15420         update initializer.
15421         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15422         Change all callers.
15423         (Target_sparc::do_finalize_sections): Change handling of
15424         copy_relocs_.
15425         * x86_64.cc: Include "copy-relocs.h".
15426         (class Target_x86_64): Change type of copy_relocs_ to variable,
15427         update initializer.
15428         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15429         class.  Change all callers.
15430         (Target_x86_64::do_finalize_sections): Change handling of
15431         copy_relocs_.
15432         * Makefile.am (CCFILES): Add copy-relocs.cc.
15433         (HFILES): Add copy-relocs.h.
15434
15435         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15436
15437         * testsuite/script_test_4.sh: Permit leading zeroes.
15438
15439 2008-04-15  Ian Lance Taylor  <iant@google.com>
15440
15441         * script-sections.cc (Script_sections::create_segments): Use
15442         header_size_adjustment even when there is enough room for the
15443         headers.
15444         * testsuite/script_test_4.sh: New file.
15445         * testsuite/script_test_4.t: New file.
15446         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15447         (check_DATA): Add script_test_4.stdout.
15448         (MOSTLYCLEANFILES): Likewise.
15449         (script_test_4): New target.
15450         (script_test_4.stdout): New target.
15451         * testsuite/Makefile.in: Rebuild.
15452
15453         * sparc.cc: Add definitions for Output_data_plt_sparc class
15454         constants.
15455
15456 2008-04-14  David S. Miller  <davem@davemloft.net>
15457
15458         * sparc.cc: New file.
15459         * Makefile.am (TARGETSOURCES): Add sparc.cc
15460         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15461         * configure.tgt: Document targ_extra_size and
15462         targ_extra_big_endian.  Add entries for sparc-* and
15463         sparc64-*.
15464         * configure.ac: Handle targ_extra_size and
15465         targ_extra_big_endian.
15466         * Makefile.in: Rebuild.
15467         * configure: Likewise.
15468         * po/POTFILES.in: Likewise.
15469         * po/gold.pot: Likewise.
15470
15471 2008-04-14  Ian Lance Taylor  <iant@google.com>
15472
15473         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15474         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15475         in the name/type/flags to section mapping.  Don't call
15476         allocate_output_section.
15477         (Layout::choose_output_section): Change parameter from adjust_name
15478         to is_input_section.  Don't permit input sections after sections
15479         are attached to segments.  Don't call allocate_output_section.
15480         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15481         not write_enable_output_section.
15482         (Layout::make_output_section): Don't push to
15483         unattached_section_list_ nor call attach_to_segment.  Call
15484         attach_section_to_segment if sections are attached.
15485         (Layout::attach_sections_to_segments): New function.
15486         (Layout::attach_section_to_segment): New function.
15487         (Layout::attach_allocated_section_to_segment): Rename from
15488         attach_to_segment.  Remove flags parameter.
15489         (Layout::allocate_output_section): Remove function.
15490         (Layout::write_enable_output_section): Remove function.
15491         * layout.h (class Layout): Update for above changes.  Add new
15492         field sections_are_attached_.
15493         * output.h (Output_section::update_flags_for_input_section): New
15494         function.
15495         * output.cc (Output_section::add_input_section): Call
15496         update_flags_for_input_section.
15497         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15498
15499 2008-04-11  Cary Coutant  <ccoutant@google.com>
15500
15501         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15502         thought unnecessary.
15503         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15504
15505 2008-04-11  Ian Lance Taylor  <iant@google.com>
15506
15507         * output.h (class Output_section_data): Remove inline definition
15508         of set_addralign.
15509         * output.cc (Output_section_data::set_addralign): New function.
15510
15511 2008-04-11  Cary Coutant  <ccoutant@google.com>
15512
15513         Add support for TLS descriptors for i386 and x86_64.
15514         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15515         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15516         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15517         GOT_TYPE_TLS_DESC.
15518         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15519         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15520         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15521         relocations.
15522         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15523         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15524         Fix problem with initial-exec relocations.
15525         (Target_i386::Relocate::relocate_tls): Likewise.
15526         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15527         relaxation.
15528         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15529         support for section-plus-offset dynamic table entries.
15530         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15531         (Output_data_dynamic::Dynamic_entry): Add support for
15532         section-plus-offset dynamic table entries.
15533         (Output_data_dynamic::Classification): Likewise.
15534         (Output_data_dynamic::classification_): Renamed offset_.
15535         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15536         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15537         (Target_x86_64::make_plt_section): New function.
15538         (Target_x86_64::reserve_tlsdesc_entries): New function.
15539         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15540         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15541         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15542         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15543         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15544         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15545         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15546         add extra PLT entry for TLS descriptors.
15547         (Output_data_plt_x86_64::got_): New field.
15548         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15549         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15550         fields.
15551         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15552         descriptors.
15553         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15554         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15555         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15556         R_386_TLS_DESC_CALL relocations.
15557         (Target_x86_64::Scan::global): Likewise.
15558         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15559         for TLS descriptors.
15560         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15561         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15562         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15563         GD-to-IE relaxation.
15564         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15565         and TLS_DESCRIPTORS.
15566         * Makefile.in: Rebuild.
15567         * configure: Rebuild.
15568         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15569         (tls_test_shared2.so): New target.
15570         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15571         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15572         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15573         (tls_shared_gd_to_ie_test_LDADD): New variable.
15574         (tls_shared_gnu2_gd_to_ie_test): New target.
15575         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15576         New targets.
15577         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15578         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15579         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15580         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15581         (tls_shared_gnu2_test): New target.
15582         (tls_test_gnu2_shared.so): New target.
15583         (tls_shared_gnu2_test_SOURCES): New variable.
15584         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15585         (tls_shared_gnu2_test_LDFLAGS): New variable.
15586         (tls_shared_gnu2_test_LDADD): New variable.
15587         * testsuite/Makefile.in: Rebuild.
15588         * testsuite/Makefile.
15589
15590 2008-04-11  Ian Lance Taylor  <iant@google.com>
15591
15592         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15593         justsyms.t.
15594         * testsuite/Makefile.in: Rebuild.
15595
15596         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15597         long.
15598         * testsuite/script_test_2.cc (main): Adjust test.
15599
15600 2008-04-11  David S. Miller  <davem@davemloft.net>
15601             Ian Lance Taylor  <iant@google.com>
15602
15603         * options.h (General_options): Add entries for '-Y' and
15604         '-relax'.
15605         * options.cc (General_options:finalize): If -Y was used, add those
15606         entries to the library path instead of the default "/lib" and
15607         "/usr/lib".
15608
15609 2008-04-11  David S. Miller  <davem@davemloft.net>
15610
15611         * testsuite/justsyms.t: Start at 0x100.
15612         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15613         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15614         long.
15615         * testsuite/script_test_2.cc: Adjust string and section length
15616         checks.
15617
15618 2008-04-09  Ian Lance Taylor  <iant@google.com>
15619
15620         PR gold/5996
15621         * script-sections.cc (Sections_element::allocate_to_segment): Add
15622         orphan parameter.
15623         (Output_section_definition::allocate_to_segment): Likewise.
15624         (Orphan_output_section::allocate_to_segment): Likewise.
15625         (Script_sections::attach_sections_using_phdrs_clause): Don't
15626         propagate non-PT_LOAD segments to orphan sections.
15627         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15628         readelf rather than objdump.
15629         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15630         .interp section and PT_INTERP segment are the same size.
15631         * testsuite/Makefile.in: Rebuild.
15632
15633         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15634         aliases for symbols defined in the same object.
15635         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15636         (weak_alias_test_SOURCES): New variable.
15637         (weak_alias_test_DEPENDENCIES): New variable.
15638         (weak_alias_test_LDFLAGS): New variable.
15639         (weak_alias_test_LDADD): New variable.
15640         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15641         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15642         (weak_alias_test_3.o): New target.
15643         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15644         * testsuite/weak_alias_test_main.cc: New file.
15645         * testsuite/weak_alias_test_1.cc: New file.
15646         * testsuite/weak_alias_test_2.cc: New file.
15647         * testsuite/weak_alias_test_3.cc: New file.
15648
15649 2008-04-08  Ian Lance Taylor  <iant@google.com>
15650
15651         * options.h (class General_options): Add --noinhibit-exec option.
15652         * main.cc (main): Check --noinhibit-exec.
15653
15654         * options.h (class General_options): Define --wrap as a special
15655         option.  Add wrap_symbols_ field.
15656         (General_options::any_wrap_symbols): New function.
15657         (General_options::is_wrap_symbol): New function.
15658         * options.cc (General_options::parse_wrap): New function.
15659         (General_options::General_options): Initialize wrap_symbols_.
15660         * symtab.cc (Symbol_table::wrap_symbol): New function.
15661         (Symbol_table::add_from_object): Handle --wrap.
15662         * symtab.h (class Symbol_table): Declare wrap_symbol.
15663         * target.h (Target::wrap_char): New function.
15664         (Target::Target_info): Add wrap_char field.
15665         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15666         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15667         * testsuite/testfile.cc (Target_test::test_target_info):
15668         Likewise.
15669
15670         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15671         there is one.
15672
15673         * layout.h (class Layout): Add added_eh_frame_data_ field.
15674         * layout.cc (Layout::Layout): Initialize new field.
15675         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15676         output section until we find a section we merged successfully.
15677         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15678         that the size be non-zero.
15679
15680         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15681         qualifier.
15682
15683 2008-04-08  Craig Silverstein  <csilvers@google.com>
15684
15685         * configure.ac: Export new conditional variable HAVE_ZLIB.
15686         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15687         on HAVE_ZLIB.
15688         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15689         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15690
15691 2008-04-07  Ian Lance Taylor  <iant@google.com>
15692
15693         * version.cc (version_string): Set to "1.5".
15694
15695         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15696         Add issued_non_pic_error_ field.  Declare check_non_pic.
15697         (Target_x86_64::Scan::check_non_pic): New function.
15698         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15699         (Target_x86_64::Scan::global): Likewise.
15700
15701         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15702         addend parameter.  Change caller.  Handle merge sections.
15703         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15704         Address to Addend.  Don't add in the result of
15705         local_section_offset, pass down the addend and use the returned
15706         value.
15707         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15708         Update declarations of local_section_offset and symbol_value.
15709         * testsuite/two_file_test_1.cc (t18): New function.
15710         * testsuite/two_file_test_2.cc (f18): New function.
15711         * testsuite/two_file_test_main.cc (main): Call t18.
15712         * testsuite/two_file_test.h (t18, f18): Declare.
15713
15714         * configure.ac: Don't test for objdump, c++filt, or readelf.
15715         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15716         conditionals.
15717         (TEST_READELF): New variable.
15718         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15719         (check_PROGRAMS): Add two_file_strip_test.
15720         (two_file_strip_test): New target.
15721         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15722         (two_file_same_shared_strip_test_SOURCES): New variable.
15723         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15724         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15725         (two_file_same_shared_strip_test_LDADD): New variable.
15726         (two_file_shared_strip.so): New target.
15727         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15728         (ver_test_5.syms, ver_test_7.syms): Likewise.
15729         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15730         (strip_test_3.stdout): Use TEST_OBJDUMP.
15731         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15732
15733 2008-04-04  Cary Coutant  <ccoutant@google.com>
15734
15735         * symtab.h (Symbol::is_weak_undefined): New function.
15736         (Symbol::is_strong_undefined): New function.
15737         (Symbol::is_absolute): New function.
15738         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15739         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15740         absolute symbols.
15741         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15742         (weak_undef_test): New target.
15743         * testsuite/Makefile.in: Rebuild.
15744         * testsuite/weak_undef_file1.cc: New file.
15745         * testsuite/weak_undef_file2.cc: New file.
15746         * testsuite/weak_undef_test.cc: New file.
15747
15748 2008-04-03  Craig Silverstein  <csilvers@google.com>
15749
15750         * compressed_output.h (class Output_compressed_section): Use
15751         unsigned buffer.
15752         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15753         add zlib header.
15754         (zlib_compressed_suffix): Removed.
15755         (Output_compressed_section::set_final_data_size): Use unsigned
15756         buffers.
15757         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15758         Fix linker invocation.
15759         (flagstest_o_specialfile_and_compress_debug_sections):
15760         Likewise.
15761         * testsuite/Makefile.in: Regenerated.
15762
15763 2008-04-02  David S. Miller  <davem@davemloft.net>
15764
15765         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15766         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15767
15768 2008-04-02  Craig Silverstein  <csilvers@google.com>
15769
15770         * TODO: New file.
15771
15772 2008-04-02  Ian Lance Taylor  <iant@google.com>
15773
15774         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15775         parameters.  Update for new key type to views_.  Change all
15776         callers.
15777         (File_read::read): Adjust for byteshift in returned view.
15778         (File_read::add_view): New function, broken out of
15779         find_and_make_view.
15780         (File_read::make_view): New function, broken out of
15781         find_and_make_view.
15782         (File_read::find_or_make_view): Add offset and aligned
15783         parameters.  Rewrite accordingly.  Change all callers.
15784         (File_read::get_view): Add offset and aligned parameters.  Adjust
15785         for byteshift in return value.
15786         (File_read::get_lasting_view): Likewise.
15787         * fileread.h (class File_read): Update declarations.
15788         (class File_read::View): Add byteshift_ field.  Add byteshift to
15789         constructor.  Add byteshift method.
15790         * archive.h (Archive::clear_uncached_views): New function.
15791         (Archive::get_view): Add aligned parameter.  Change all callers.
15792         * object.h (Object::get_view): Add aligned parameter.  Change all
15793         callers.
15794         (Object::get_lasting_view): Likewise.
15795
15796         * fileread.cc (File_read::release): Don't call clear_views if
15797         there are multiple objects.
15798         * fileread.h (File_read::clear_uncached_views): New function.
15799         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15800         on the archive.
15801
15802 2008-03-31  Cary Coutant  <ccoutant@google.com>
15803
15804         Add thin archive support.
15805         * archive.cc (Archive::armagt): New const.
15806         (Archive::setup): Remove task parameter and calls to unlock.
15807         (Archive::unlock_nested_archives): New function.
15808         (Archive::read_header): Add nested_off parameter. Change
15809         all callers.
15810         (Archive::interpret_header): Likewise.
15811         (Archive::include_all_members): Change to handle thin
15812         archives.
15813         (Archive::include_member): Likewise.
15814         * archive.h (Archive::Archive): Add new parameters and
15815         initializers.
15816         (Archive::armagt): New const.
15817         (Archive::setup): Remove task parameter.
15818         (Archive::unlock_nested_archives): New function.
15819         (Archive::read_header): Add nested_off parameter.
15820         (Archive::interpret_header): Likewise.
15821         (Archive::Nested_archive_table): New typedef.
15822         (Archive::is_thin_archive_): New field.
15823         (Archive::nested_archives_): New field.
15824         (Archive::options_): New field.
15825         (Archive::dirpath_): New field.
15826         (Archive::task_): New field.
15827         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15828         for thin archives.  Pass additional parameters to
15829         Archive::Archive.  Unlock the archive file after calling
15830         Archive::setup.
15831
15832 2008-03-29  Ian Lance Taylor  <iant@google.com>
15833
15834         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15835         version symbol to be local.
15836         * testsuite/ver_test_4.sh: New file.
15837         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15838         (check_DATA): Add ver_test_4.syms.
15839         (ver_test_4.syms): New target.
15840         * testsuite/Makefile.in: Rebuild.
15841
15842         * output.cc
15843         (Output_section::Input_section_sort_entry::has_priority): New
15844         function.
15845         (Output_section::Input_section_sort_entry::match_file_name): New
15846         function.
15847         (Output_section::Input_section_sort_entry::match_section_name):
15848         Remove.
15849         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15850         Remove.
15851         (Output_section::Input_section_sort_entry::match_section_file):
15852         Remove.
15853         (Output_section::Input_section_sort_compare::operator()): Rewrite
15854         using new Input_section_sort_entry functions.  Sort crtbegin and
15855         crtend first.  Sort sections with no priority before sections with
15856         a priority.
15857         * testsuite/initpri1.c (d3): Check j != 4.
15858         (cd5): New constructor/destructor function.
15859         (main): Check j != 2.
15860
15861         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15862         new symbol when resolving, don't call set_is_default.
15863         * testsuite/ver_test_7.cc: New file.
15864         * testsuite/ver_test_7.sh: New file.
15865         * testsuite/Makefile.am (ver_test_7.so): New target.
15866         (ver_test_7.o): New target.
15867         (check_SCRIPTS): Add ver_test_7.sh.
15868         (check_DATA): Add ver_test_7.syms.
15869         (ver_test_7.syms): New target.
15870
15871 2008-03-28  Ian Lance Taylor  <iant@google.com>
15872
15873         * layout.cc (Layout::layout): If we see an input section with a
15874         name that needs sorting, set the must_sort flag for the output
15875         section.
15876         (Layout::make_output_section): If the name of the output section
15877         indicates that it might require sorting, set the may_sort flag.
15878         * output.h (Output_section::may_sort_attached_input_sections): New
15879         function.
15880         (Output_section::set_may_sort_attached_input_sections): New
15881         function.
15882         (Output_section::must_sort_attached_input_sections): New
15883         function.
15884         (Output_section::set_must_sort_attached_input_sections): New
15885         function.
15886         (class Output_section): Declare Input_section_sort_entry.  Define
15887         Input_section_sort_compare.  Declare
15888         sort_attached_input_sections.  Add new fields:
15889         may_sort_attached_input_sections_,
15890         must_sort_attached_input_sections_,
15891         attached_input_sections_are_sorted_.
15892         * output.cc (Output_section::Output_section): Initialize new
15893         fields.
15894         (Output_section::add_input_section): Add an entry to
15895         input_sections_ if may_sort or must_sort are true.
15896         (Output_section::set_final_data_size): Call
15897         sort_attached_input_sections if necessary.
15898         (Output_section::Input_section_sort_entry): Define new class.
15899         (Output_section::Input_section_sort_compare::operator()): New
15900         function.
15901         (Output_section::sort_attached_input_sections): New function.
15902         * configure.ac: Check whether the compiler supports constructor
15903         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15904         * testsuite/initpri1.c: New file.
15905         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15906         CONSTRUCTOR_PRIORITY.
15907         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15908         (initpri1_LDFLAGS): New variable.
15909         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15910
15911 2008-03-27  Ian Lance Taylor  <iant@google.com>
15912
15913         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15914         * testsuite/common_test_1.c: New file.
15915         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15916         (common_test_1_SOURCES): New variable.
15917         (common_test_1_DEPENDENCIES): New variable.
15918         (common_test_1_LDFLAGS): New variable.
15919
15920         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15921         and commons_ correctly when NAME/VERSION does not override
15922         NAME/NULL.
15923         * testsuite/ver_test_6.c: New file.
15924         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15925         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15926         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15927
15928 2008-03-26  Ian Lance Taylor  <iant@google.com>
15929
15930         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15931         of an undefined symbol from a version script.
15932         * testsuite/Makefile.am (ver_test_5.so): New target.
15933         (ver_test_5.o): New target.
15934         (check_SCRIPTS): Add ver_test_5.sh.
15935         (check_DATA): Add ver_test_5.syms.
15936         (ver_test_5.syms): New target.
15937         * testsuite/ver_test_5.cc: New file.
15938         * testsuite/ver_test_5.script: New file.
15939         * testsuite/ver_test_5.sh: New file.
15940         * Makefile.in, testsuite/Makefile.in: Rebuild.
15941
15942         PR gold/5986
15943         Fix problems building gold with gcc 4.3.0.
15944         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15945         (gold_error_at_location, gold_warning_at_location): Use it.
15946         * configure.ac: Check whether we can compile and use a template
15947         function with a printf attribute.
15948         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15949         when jumping over bytes.
15950         * object.cc: Instantiate Object::read_section_data.
15951         * debug.h: Include <cstring>
15952         * dwarf_reader.cc: Include <algorithm>
15953         * main.cc: Include <cstring>.
15954         * options.cc: Include <cstring>.
15955         * output.cc: Include <cstring>.
15956         * script.cc: Include <cstring>.
15957         * script.h: Include <string>.
15958         * symtab.cc: Include <cstring> and <algorithm>.
15959         * target-select.cc: Include <cstring>.
15960         * version.cc: Include <string>.
15961         * testsuite/testmain.cc: Include <cstdlib>.
15962         * configure, config.in: Rebuild.
15963
15964 2008-03-25  Ian Lance Taylor  <iant@google.com>
15965
15966         * options.cc: Include "../bfd/bfdver.h".
15967         (options::help): Print bug reporting address.
15968
15969         * version.cc (print_version): Adjust output for current value of
15970         BFD_VERSION_STRING.
15971
15972         * NEWS: New file.
15973
15974         * options.cc (options::help): Print list of supported targets.
15975         * target-select.h: Include <vector>.
15976         (class Target_selector): Make machine_, size_, and is_big_endian_
15977         fields const.  Add bfd_name_ and instantiated_target_ fields.
15978         (Target_selector::Target_selector): Add bfd_name parameter.
15979         (Target_selector::recognize): Make non-virtual, call
15980         do_recognize.
15981         (Target_selector::recognize_by_name): Make non-virtual, call
15982         do_recognize_by_name.
15983         (Target_selector::supported_names): New function.
15984         (Target_selector::bfd_name): New function.
15985         (Target_selector::do_instantiate_target): New pure virtual
15986         function.
15987         (Target_selector::do_recognize): New virtual function.
15988         (Target_selector::do_recognize_by_name): New virtual function.
15989         (Target_selector::instantiate_target): New private function.
15990         (supported_target_names): Declare.
15991         * target-select.cc (Target_selector::Target_selector): Update for
15992         new parameter and fields.
15993         (select_target_by_name): Check that the name matches before
15994         calling recognize_by_name.
15995         (supported_target_names): New function.
15996         * i386.cc (class Target_selector_i386): Update Target_selector
15997         constructor call.  Remove recognize and recognize_by_name.  Add
15998         do_instantiate_target.
15999         * x86_64.cc (class Target_selector_x86_64): Likewise.
16000         * testsuite/testfile.cc (class Target_selector_test): Update for
16001         changes to Target_selector.
16002
16003         * README: Rewrite, with some notes on unsupported features.
16004
16005 2008-03-24  Cary Coutant  <ccoutant@google.com>
16006
16007         * i386.cc (Target_i386::Got_type): New enum declaration.
16008         (Target_i386::Scan::local): Updated callers of Output_data_got
16009         member functions.
16010         (Target_i386::Scan::global): Likewise.
16011         (Target_i386::Relocate::relocate): Likewise.
16012         (Target_i386::Relocate::relocate_tls): Likewise.
16013         * object.h (Got_offset_list): New class.
16014         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16015         (Sized_relobj::local_got_offset): Likewise.
16016         (Sized_relobj::set_local_got_offset): Likewise.
16017         (Sized_relobj::local_has_tls_got_offset): Removed.
16018         (Sized_relobj::local_tls_got_offset): Removed.
16019         (Sized_relobj::set_local_tls_got_offset): Removed.
16020         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16021         * output.cc (Output_data_got::add_global): Added got_type parameter.
16022         (Output_data_got::add_global_with_rel): Likewise.
16023         (Output_data_got::add_global_with_rela): Likewise.
16024         (Output_data_got::add_global_pair_with_rel): New function.
16025         (Output_data_got::add_global_pair_with_rela): New function.
16026         (Output_data_got::add_local): Added got_type parameter.
16027         (Output_data_got::add_local_with_rel): Likewise.
16028         (Output_data_got::add_local_with_rela): Likewise.
16029         (Output_data_got::add_local_pair_with_rel): New function.
16030         (Output_data_got::add_local_pair_with_rela): New function.
16031         (Output_data_got::add_global_tls): Removed.
16032         (Output_data_got::add_global_tls_with_rel): Removed.
16033         (Output_data_got::add_global_tls_with_rela): Removed.
16034         (Output_data_got::add_local_tls): Removed.
16035         (Output_data_got::add_local_tls_with_rel): Removed.
16036         (Output_data_got::add_local_tls_with_rela): Removed.
16037         * output.h (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         * resolve.cc (Symbol::override_base_with_special): Removed
16054         reference to has_got_offset_ field.
16055         * symtab.cc (Symbol::init_fields): Replaced initialization
16056         of got_offset_ with got_offsets_.  Removed initialization
16057         of has_got_offset_
16058         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16059         (Symbol::got_offset): Likewise.
16060         (Symbol::set_got_offset): Likewise.
16061         (Symbol::has_tls_got_offset): Removed.
16062         (Symbol::tls_got_offset): Removed.
16063         (Symbol::set_tls_got_offset): Removed.
16064         (Symbol::got_offset_): Removed.
16065         (Symbol::tls_mod_got_offset_): Removed.
16066         (Symbol::tls_pair_got_offset_): Removed.
16067         (Symbol::got_offsets_): New field.
16068         (Symbol::has_got_offset): Removed.
16069         (Symbol::has_tls_mod_got_offset): Removed.
16070         (Symbol::has_tls_pair_got_offset): Removed.
16071         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16072         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16073         member functions.
16074         (Target_x86_64::Scan::global): Likewise.
16075         (Target_x86_64::Relocate::relocate): Likewise.
16076         (Target_x86_64::Relocate::relocate_tls): Likewise.
16077
16078 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16079
16080         * yyscript.y: Fix spelling error in comment.
16081
16082 2008-03-24  Ian Lance Taylor  <iant@google.com>
16083
16084         * options.h (class General_options): Define build_id option.
16085         * layout.h (class Layout): Declare write_build_id, create_note,
16086         create_build_id.  Add build_id_note_ member.
16087         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16088         "libiberty.h", "md5.h", "sha1.h".
16089         (Layout::Layout): Initialize eh_frame_data_,
16090         eh_frame_hdr_section_, and build_id_note_.
16091         (Layout::finalize): Call create_build_id.
16092         (Layout::create_note): New function, broken out of
16093         Layout::create_gold_note.
16094         (Layout::create_gold_note): Call create_note.
16095         (Layout::create_build_id): New function.
16096         (Layout::write_build_id): New function.
16097         (Close_task_runner::run): Call write_build_id.
16098
16099         * x86_64.cc: Correct license to GPLv3.
16100
16101 2008-03-23  Ian Lance Taylor  <iant@google.com>
16102
16103         * options.cc: Include "demangle.h".
16104         (parse_optional_string): New function.
16105         (parse_long_option): Handle takes_optional_argument.
16106         (parse_short_option): Update dash_z initializer.  Handle
16107         takes_optional_argument.
16108         (General_options::General_options): Initialize do_demangle_.
16109         (General_options::finalize): Set do_demangle_.  Handle demangling
16110         style.
16111         * options.h (parse_optional_string): Declare.
16112         (struct One_option): Add optional_arg field.  Update constructor.
16113         Update call constructor calls.  Add takes_optional_argument
16114         function.
16115         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16116         (DEFINE_optional_string): Define.
16117         (General_options::demangle): Change from DEFINE_bool to
16118         DEFINE_optional_string.
16119         (General_options::no_demangle): New function.
16120         (General_options::do_demangle): New function.
16121         (General_options::set_do_demangle): New function.
16122         (General_options::execstack_status_): Move definition to end of
16123         class definition.
16124         (General_options::static_): Likewise.
16125         (General_options::do_demangle_): New field.
16126         * object.cc (big_endian>::get_symbol_location_info): Call
16127         Options::do_demangle, not Options::demangle.
16128         * symtab.cc (demangle): Likewise.
16129
16130 2008-03-22  Ian Lance Taylor  <iant@google.com>
16131
16132         * gold.h: Include <cstddef> and <sys/types.h>
16133         * options.h: Include <cstring>.
16134
16135 2008-03-21  Ian Lance Taylor  <iant@google.com>
16136
16137         * Added source code to GNU binutils.
16138 \f
16139 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16140
16141 Copying and distribution of this file, with or without modification,
16142 are permitted in any medium without royalty provided the copyright
16143 notice and this notice are preserved.
16144
16145 Local Variables:
16146 mode: change-log
16147 left-margin: 8
16148 fill-column: 74
16149 version-control: never
16150 End: