Use "gold_info" instead of "gold_warning" for erratum fix.
[external/binutils.git] / gold / ChangeLog
1 2015-07-09  Han Shen  <shenhan@google.com>
2
3         Use "gold_info" instead of "gold_warning" for erratum fix.
4
5         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
6         'gold_info'.
7         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
8
9 2015-07-09  Han Shen  <shenhan@google.com>
10
11         Drop missing symbol warning for arm/aarch64.
12
13         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
14         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
15         symbol warning.
16
17 2015-07-07  Han Shen  <shenhan@google.com>
18
19         Make gold aarch64 accept long form of mapping symbols.
20
21         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
22         of mapping symbols.
23
24 2015-06-29  Doug Kwan  <dougkwan@google.com>
25
26         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
27           at address expected by test.
28         * testsuite/arm_cortex_a8_b.s: Ditto.
29         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
30         * testsuite/arm_cortex_a8_bl.s: Ditto.
31         * testsuite/arm_cortex_a8_blx.s: Ditto.
32         * testsuite/arm_cortex_a8_local.s: Ditto.
33         * testsuite/arm_fix_v4bx.s: Ditto.
34         * testsuite/arm_unaligned_reloc.s: Ditto.
35         * testsuite/thumb_bl_out_of_range.s: Ditto.
36         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
37         * testsuite/thumb_blx_out_of_range.s: Ditto.
38
39 2015-06-29  Han Shen  <shenhan@google.com>
40
41         Patch for erratum 843419 internal error.
42
43         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
44         (Erratum_stub::update_erratum_insn): New method.
45         (Stub_table::relocate_stubs): Modified to place relocated insn.
46         (AArch64_relobj::fix_errata): Modified gold_assert.
47
48 2015-06-12  Han Shen  <shenhan@google.com>
49
50         Fix erratum 835769.
51
52         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
53         defintion outside class definition.
54         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
55         (AArch64_insn_utilities::aarch64_op31): New member.
56         (AArch64_insn_utilities::aarch64_ra): New member.
57         (AArch64_insn_utilities::aarch64_mac): New member.
58         (AArch64_insn_utilities::aarch64_mlxl): New member.
59         (ST_E_835769): New global enum member.
60         (Stub_table::relocate_stubs): Add 835769 handler.
61         (Stub_template_repertoire::Stub_template_repertoire): Install new
62         stub type.
63         (AArch64_relobj::scan_errata): This func is renamed from
64         scan_erratum_843419.
65         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
66         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
67         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
68         (Target_aarch64::scan_erratum_835769_span): New method.
69         (Target_aarch64::create_erratum_stub): New method.
70         (Target_aarch64::is_erratum_835769_sequence): New method.
71         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
72         code into create_erratum_stub.
73         * options.h (fix_cortex_a53_835769): New option.
74
75 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
76
77         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
78         outside class body.
79         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
80
81 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
82
83         PR gold/17731
84         * layout.cc (corresponding_uncompressed_section_name): New function.
85         (Layout::choose_output_section): Call it.
86         * layout.h (corresponding_uncompressed_section_name): New function.
87         * script-sections.cc (Input_section_info::set_section_name): Check
88         for compressed debug section (.zdebug style).
89
90 2015-06-11  Jing Yu  <jingyu@google.com>
91
92         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
93         * testsuite/Makefile.in: Regenerate.
94
95 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
96
97         * gold.h (is_cident): Correct typo.
98
99 2015-06-10  Han Shen  <shenhan@google.com>
100         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
101
102         Now fixing for 843419 is fully functional.
103
104         The first part of the erratum fix CL is here -
105         https://sourceware.org/ml/binutils/2015-04/msg00229.html
106
107         * aarch64.cc(global enum): New constants representing stub types.
108         (Stub_template): New POD struct.
109         (Stub_template_repertoire): New class.
110         (Stub_base): New class.
111         (Erratum_stub): New class.
112         (Reloc_stub): Refactored to be a subclass of Stub_base.
113         (Reloc_stub::Stub_type): Removed.
114         (Reloc_stub::offset): Moved to Stub_base.
115         (Reloc_stub::set_offset): Moved to Stub_base.
116         (Reloc_stub::destination_address): Moved to Stub_base.
117         (Reloc_stub::set_destination_address): Moved to Stub_base.
118         (Reloc_stub::reset_destination_address): Moved to Stub_base.
119         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
120         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
121         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
122         (Reloc_stub::write): Moved to Stub_base.
123         (Reloc_stub::invalid_offset): Moved to Stub_base.
124         (Reloc_stub::invalid_address): Moved to Stub_base.
125         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
126         (Reloc_stub::stub_insns_): Moved to Stub_base.
127         (Reloc_stub::offset_): Moved to Stub_base.
128         (Reloc_stub::destination_address_): Moved to Stub_base.
129         (Stub_table::The_aarch64_relobj): New typedef.
130         (Stub_table::The_erratum_stub): New typedef.
131         (Stub_table::The_erratum_stub_less): New typedef.
132         (Stub_table::The_erratum_stub_set): New typedef.
133         (Stub_table::The_erratum_stub_set_iter): New typedef.
134         (Stub_table::empty): Added emptiness testing for erratum stubs.
135         (Stub_table::add_erratum_stub): New method to add an erratum stub.
136         (Stub_table::find_erratum_stub): New method.
137         (Stub_table::find_erratum_stubs_for_input_section): New method.
138         (Stub_table::erratum_stub_address): New method.
139         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
140         (Stub_table::do_addralign): Modified to handle erratum stubs.
141         (Stub_table::erratum_stubs_): New member.
142         (Stub_table::erratum_stub_size_): New member.
143         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
144         (Stub_table::do_write): Modified to handle erratum stubs.
145         (AArch64_relobj::The_erratum_stub): New typedef.
146         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
147         (AArch64_relobj::fix_errata): New method.
148         (Target_aarch64::The_reloc_stub_type): Removed.
149         (Target_aarch64::The_erratum_stub): New typede.
150         (AArch64_relocate_functions::construct_b): New method.
151
152 2015-06-08  Nick Clifton  <nickc@redhat.com>
153
154         * po/fr.po: New French Translation.
155
156 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
157
158         PR gold/18288
159         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
160         callers. Don't use STT_COMMON to check for common symbols.
161         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
162         symbol that's not in a common section.
163         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
164         common symbols.
165
166 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
167
168         PR gold/18200
169         * Makefile.am (diststuff): Add target.
170         * Makefile.in: Regenerate.
171
172 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
173
174         PR gold/17498
175         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
176         temporary locals in merge sections.
177         * options.cc (General_options::parse_discard_all): New method.
178         (General_options::parse_discard_locals): New method.
179         (General_options::parse_discard_none): New method.
180         (General_options::General_options): Initialize discard_locals_.
181         * options.h (--discard-all): Convert to special option.
182         (--discard-locals): Likewise.
183         (--discard-none): New option.
184         (General_options::discard_all): New method.
185         (General_options::discard_locals): New method.
186         (General_options::discard_sec_merge): New method.
187         (General_options::Discard_locals): New enum.
188         (General_options::discard_locals_): New data member.
189
190 2015-06-03  Cary Coutant  <cary@google.com>
191
192         * script-sections.cc (Script_sections::Script_sections): Initialize
193         segments_created_.
194         (Script_sections::create_note_and_tls_segments): Set flag when
195         segments are created.
196         (Script_sections::expected_segment_count): Count PT_INTERP.
197         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
198         segments are created.
199         * script-sections.h (Script_sections::segments_created_): New data
200         member.
201
202 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
203
204         PR gold/15370
205         * script-sections.cc
206         (Output_section_element_input::set_section_addresses): When there
207         are several patterns with no sort spec, put all sections in the same
208         bin.
209         * testsuite/Makefile.am (script_test_12): New testcase.
210         (script_test_12i): New testcase.
211         * testsuite/Makefile.in: Regenerate.
212         * testsuite/script_test_12.t: New test linker script.
213         * testsuite/script_test_12i.t: New test linker script.
214         * testsuite/script_test_12a.c: New test source file.
215         * testsuite/script_test_12b.c: New test source file.
216
217 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
218
219         * nacl.h (Sniff_file): Switch parameters to get_view to get an
220         aligned view.
221
222 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
223
224         PR gold/17819
225         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
226         separate task to schedule the build id computation.
227         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
228         add Output_file and offset.
229         (Hash_task::run): Get and release the input views.
230         (Hash_task::is_runnable): Always return NULL (always runnable).
231         (Layout::queue_build_id_tasks): Remove.
232         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
233         parameters; use them instead of class members.
234         (Build_id_task_runner::run): New function.
235         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
236         to write_build_id.
237         * layout.h (Layout::queue_build_id_tasks): Remove.
238         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
239         parameters.
240         (Layout::array_of_hashes_): Remove.
241         (Layout::size_of_array_of_hashes_): Remove.
242         (Layout::input_view_): Remove.
243         (Build_id_task_runner): New class.
244         (Close_task_runner::Close_task_runner): Add array_of_hashes and
245         size_of_hashes parameters.
246         (Close_task_runner::array_of_hashes_): New data member.
247         (Close_task_runner::size_of_hashes_): New data member.
248         * testsuite/Makefile.am
249         (flagstest_compress_debug_sections_and_build_id_tree): New test.
250         * testsuite/Makefile.in: Regenerate.
251
252 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
253
254         * merge.cc (get_input_merge_map): Update for data structure change.
255         (get_or_make_input_merge_map): Update for data structure change.
256         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
257         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
258
259 2015-05-16  Alan Modra  <amodra@gmail.com>
260
261         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
262         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
263         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
264         (lis_0): Rename from lis_0_0.
265
266 2015-04-29  Cary Coutant  <cary@google.com>
267             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
268
269         * gc.h (Garbage_collection::is_section_garbage): Change Object*
270         to Relobj*.
271         (Garbage_collection::add_reference): Likewise.
272         (Garbage_collection::gc_process_relocs): Likewise. Don't push
273         object/shndx pair onto *secvec for dynamic objects. Don't follow
274         relocations pointing to dynamic objects for GC.
275         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
276         (Icf::unfold_section): Likewise.
277         (Icf::is_section_folded): Likewise.
278         (Icf::get_folded_section): Likewise.
279         * icf.h: (Icf::get_folded_section): Likewise.
280         (Icf::unfold_section): Likewise.
281         (Icf::is_section_folded): Likewise.
282         (Icf::section_has_function_pointers): Likewise.
283         (Icf::set_section_has_function_pointers): Likewise.
284         * object.h (Section_id): Likewise.
285         (Const_section_id): Likewise.
286         * output.cc (Output_section::update_section_layout): Likewise.
287         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
288         Likewise.
289         * plugin.cc (update_section_order): Likewise.
290         (unique_segment_for_sections): Likewise.
291         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
292         (Target_powerpc::do_gc_add_reference): Likewise.
293         (Target_powerpc::gc_process_relocs): Likewise.
294         (Target_powerpc::do_gc_add_reference): Likewise.
295         * symtab.cc (Symbol_table::is_section_folded): Likewise.
296         (Symbol_table::gc_mark_symbol): Likewise.
297         * symtab.h: (Symbol_table::is_section_folded): Likewise.
298         * target.h: (Sized_target::gc_add_reference): Likewise.
299         (Sized_target::do_gc_add_reference): Likewise.
300
301 2015-04-29  Nick Clifton  <nickc@redhat.com>
302
303         * po/fi.po: Updated Finnish translation.
304
305 2015-04-28  Alan Modra  <amodra@gmail.com>
306
307         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
308         than unsigned int for find_global_entry result temp.  Compare
309         against invalid_address.
310         (Target_powerpc::do_plt_address_for_global): Likewise.
311         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
312         on plt call stub existence for debug info.  Do assert for plt
313         and global entry stub existence if an alloc section.
314
315 2015-04-28  Alan Modra  <amodra@gmail.com>
316
317         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
318         on missing global entry stub due to bogus debug info.
319
320 2015-04-27  Han Shen  <shenhan@google.com>
321
322         * options.h (--fix-cortex-a53-843419): Rename option.
323         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
324         option.
325         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
326
327 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
328
329         PR gold/18327
330         * output.cc (Output_section::is_input_address_mapped): Assume a missing
331         entry is mapped.
332         * testsuite/Makefile.am: Add the eh_test test.
333         * testsuite/Makefile.in: Regenerate.
334         * testsuite/eh_test_a.cc: New test.
335         * testsuite/eh_test_b.cc: New test.
336
337 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
338
339         * options.h (--weak-unresolved-symbols): New option.
340         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
341         binding to weak with new option.
342         * symtab.h (is_weak_undefined): Check for new option.
343         (is_strong_undefined): Check for new option.
344         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
345         * testsuite/Makefile.in: Regenerate.
346         * testsuite/weak_unresolved_symbols_test.cc: New file.
347
348 2015-04-20  Ian Coolidge  <icoolidge@google.com>
349
350         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
351         GNU_UNIQUE.
352
353 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
354
355         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
356         push_back.
357         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
358         * object.cc (Sized_relobj_file::do_layout): Use push_back.
359         * powerpc.cc (process_gc_mark): Use push_back.
360         (Target_powerpc::do_gc_mark_symbol): Use push_back.
361         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
362
363 2015-04-16  Han Shen  <shenhan@google.com>
364
365         * aarch64.cc (AArch64_insn_utilities): New utility class.
366         (AArch64_relobj::Mapping_symbol_position): New struct.
367         (AArch64_relobj::Mapping_symbol_info): New typedef.
368         (AArch64_relobj::do_count_local_symbols): New function overriding
369         parent's implementation.
370         (AArch64_relobj::mapping_symbol_info_): New member
371         (AArch64_relobj::scan_erratum_843419): New method.
372         (Target_aarch64::scan_erratum_843419_span): New method.
373         (Target_aarch64::is_erratum_843419_sequence): New method.
374         * options.h (fix_cortex_a53): New option.
375
376 2015-04-09  Cary Coutant  <ccoutant@google.com>
377
378         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
379         in a PIE link.
380         * testsuite/Makefile.am (tls_pie_test.sh): New test.
381         * testsuite/Makefile.in: Regenerate.
382         * testsuite/tls_pie_test.sh: New.
383
384 2015-04-09  Cary Coutant  <ccoutant@google.com>
385
386         * debug.h (DEBUG_LOCATION): New.
387         (DEBUG_ALL): Include DEBUG_LOCATION.
388         (debug_string_to_enum): Add DEBUG_LOCATION.
389         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
390         output to print correct context.
391         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
392         up to 4 more locations at the beginning of the function.
393         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
394         result before sorting list of line numbers.
395         * testsuite/debug_msg.sh: Allow range of line numbers for
396         canonical results on optimized code.
397
398 2015-04-07  HC Yen <hc.yen@mediatek.com>
399
400         Add AArch32 support for gold linker.
401         gold/
402         * arm.cc: Add V8 arch combine table.
403
404 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
405
406         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
407
408 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
409
410         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
411         to find by using the return value of insert.
412
413 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
414
415         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
416         constructor call.
417
418 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
419
420         PR gold/17641
421         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
422         (Target_x86_64::Scan::local): Don't create GOT entry, when we
423         can convert mov to lea.
424         (Target_x86_64::Scan::global): Ditto.
425         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
426         %reg to lea foo(%rip), %reg if possible.
427         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
428         * testsuite/x86_64_mov_to_lea1.s: New.
429         * testsuite/x86_64_mov_to_lea2.s: Ditto.
430         * testsuite/x86_64_mov_to_lea3.s: Ditto.
431         * testsuite/x86_64_mov_to_lea4.s: Ditto.
432         * testsuite/x86_64_mov_to_lea.sh: Ditto.
433
434 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
435
436         * configure: Regenerated.
437
438 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
439
440         PR gold/17640
441         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
442         (Target_i386::Scan::local): Don't create GOT entry, when we
443         can convert GOT to GOTOFF.
444         (Target_i386::Scan::global): Ditto.
445         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
446         lea foo@GOTOFF(%reg), %reg if possible.
447         * testsuite/Makefile.am (i386_mov_to_lea): New test.
448         * testsuite/i386_mov_to_lea1.s: New.
449         * testsuite/i386_mov_to_lea2.s: Ditto.
450         * testsuite/i386_mov_to_lea3.s: Ditto.
451         * testsuite/i386_mov_to_lea4.s: Ditto.
452         * testsuite/i386_mov_to_lea5.s: Ditto.
453         * testsuite/i386_mov_to_lea.sh: Ditto.
454
455 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
456
457         * Makefile.am (ZLIB): New.
458         (ZLIBINC): Likewise.
459         (AM_CFLAGS): Add $(ZLIBINC).
460         (AM_CXXFLAGS): Likewise.
461         (ldadd_varldadd_var): Add $(ZLIB).
462         (incremental_dump_LDADD): Likewise.
463         (dwp_LDADD): Likewise.
464         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
465         <zlib.h>.
466         (zlib_compress): Don't check HAVE_ZLIB_H.
467         (zlib_decompress): Likewise.
468         * options.h (compress_debug_sections): Likewise.
469         * configure.ac (AM_CONDITIONAL): Removed.
470         * testsuite/Makefile.am (ZLIB): New.
471         (LDADD): Add $(ZLIB).
472         Don't check HAVE_ZLIB.
473         * Makefile.in: Regenerated.
474         * config.in: Likewise.
475         * configure: Likewise.
476         * testsuite/Makefile.in: Likewise.
477
478 2015-03-30  Jing Yu  <jingyu@google.com>
479
480         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
481         TLSLD_ADD_DTPREL_LO12_NC.
482         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
483         _TLS_MODULE_BASE_ point to the start of tls segment.
484         (Target_aarch64::optimize_tls_reloc): Add cases for
485         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
486         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
487         (Target_aarch64::Scan::local): Likewise.
488         (Target_aarch64::Scan::global): Likewise.
489         (Target_aarch64::Relocate::relocate): Likewise.
490         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
491         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
492         relocations.
493
494 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
495
496         * merge.cc (Object_merge_map::add_mapping): call
497         Object_merge_map::Input_merge_map::add_mapping.
498         (Object_merge_map::Input_merge_map::add_mapping): New.
499         (Output_merge_data::do_add_input_section): Call
500         get_or_make_input_merge_map before a loop.
501         (Output_merge_string<Char_type>::finalize_merged_data): Call
502         get_or_make_input_merge_map before a loop.
503         * merge.h (Object_merge_map): Make Input_merge_map public.
504         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
505         (Relobj::get_or_create_merge_map): New.
506         * object.h (Relobj::get_or_create_merge_map): New.
507
508 2015-03-24  Alan Modra  <amodra@gmail.com>
509
510         PR 18147
511         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
512         relocation errors for branches to strong undefined symbols.
513
514 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
515
516         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
517         (Object_merge_map::is_merge_section_for): Remove.
518         (Object_merge_map::find_merge_section): New.
519         * merge.h (Object_merge_map::is_merge_section_for): Remove.
520         (Object_merge_map::find_merge_section): New.
521         (Object_merge_map::get_input_merge_map): Add a const version.
522         * object.cc (Relobj::is_merge_section_for): Remove.
523         (Relobj::find_merge_section): New.
524         * object.h (Relobj::is_merge_section_for): Remove.
525         (Relobj::find_merge_section): New.
526         * output.cc
527         (Output_section::Input_section::is_merge_section_for): Remove.
528         (Output_section::add_merge_input_section): Don't call
529         add_merge_input_section.
530         (Output_section::find_merge_section): Return const. Use
531         object->find_merge_section.
532         (Output_section::build_lookup_maps): Don't build a map for
533         merge sections.
534         (Output_section::is_input_address_mapped): Return false if
535         section is not found.
536         (Output_section::find_starting_output_address): Use
537         find_merge_section instead of is_merge_section_for.
538         (Output_section::add_script_input_section):  Don't build a map for
539         merge sections.
540         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
541         (Output_section_lookup_maps::find_merge_section): Remove.
542         (Output_section_lookup_maps::add_merge_input_section) Remove.
543         (Output_section::find_merge_section): Return const.
544
545 2015-03-22  Cary Coutant  <cary@google.com>
546
547         PR gold/18106
548         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
549         non-SIB form of lea, with nop after the call.
550
551 2015-03-21  Cary Coutant  <cary@google.com>
552
553         PR gold/14217
554         * output.cc (Output_segment::is_first_section_relro): Don't ignore
555         .tdata section.
556         (Output_segment::set_section_addresses): Don't align size of relro
557         segment for .tbss.
558
559 2015-03-21  Cary Coutant  <cary@google.com>
560
561         PR gold/18010
562         * stringpool.cc (Stringpool_template): Don't optimize if section
563         alignment is greater than sizeof(char).
564
565 2015-03-21  Cary Coutant  <cary@google.com>
566
567         PR gold/18048
568         * script-c.h (script_include_directive): Add first_token parameter.
569         * script.cc (script_include_directive): Add first_token parameter, and
570         pass it to read_script_file.
571         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
572         (PARSING_MEMORY_DEF): New tokens.
573         (top): Add new productions for INCLUDE files.
574         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
575         Pass PARSING_LINKER_SCRIPT to script_include_directive.
576         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
577         (section_cmd): Pass PARSING_SECTION_CMDS.
578         (file_or_sections_cmd): Remove.
579         (memory_def): Pass PARSING_MEMORY_DEF.
580         * testsuite/Makefile.am (memory_test_2): New test.
581         * testsuite/Makefile.in: Regenerate.
582         * testsuite/memory_test_inc.t: New script file.
583         * testsuite/memory_test_inc_1.t.src: New script file.
584         * testsuite/memory_test_inc_2.t.src: New script file.
585         * testsuite/memory_test_inc_3.t.src: New script file.
586
587 2015-03-21  Cary Coutant  <cary@google.com>
588
589         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
590         (Sized_relobj_dwo::setup): Build compressed section map.
591         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
592         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
593         section map.
594         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
595         compressed_sections_ field.
596         (build_compressed_section_map): Take Object instead of
597         Sized_relobj_file parameter; add decompress_if_needed parameter.
598         (Sized_relobj_file::do_find_special_sections): Store compressed
599         section map in parent Object.
600         (Sized_relobj_file::do_decompressed_section_contents): Move
601         implementation to Object::decompressed_section_contents.
602         (Sized_relobj_file::do_discard_decompressed_sections): Move
603         implementation to Object::discard_decompressed_sections.
604         * object.h (build_compressed_section_map): Declare.
605         (Object::Object): Add compressed_sections_ field.
606         (Object::section_is_compressed): Move implementation here.
607         (Object::decompressed_section_contents): De-virtualize.
608         (Object::discard_decompressed_sections): De-virtualize.
609         (Object::do_section_is_compressed): Delete.
610         (Object::do_decompressed_section_contents): Delete.
611         (Object::set_compressed_sections): New method.
612         (Object::compressed_sections): New method.
613         (Object::compressed_sections_): New data member.
614         (Compressed_section_info, Compressed_section_map): Move to top of file.
615         (Sized_relobj_file::do_section_is_compressed): Delete.
616         (Sized_relobj_file::do_decompressed_section_contents): Delete.
617         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
618         (Sized_relobj_file::compressed_sections_): Move to Object class.
619
620 2015-03-21  Cary Coutant  <ccoutant@google.com>
621
622         PR gold/18152
623         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
624         deferred objects.
625
626 2015-03-11  Cary Coutant  <ccoutant@google.com>
627
628         * options.cc (General_options::finalize): Don't allow -z relro
629         with incremental linking.
630         * testsuite/Makefile.am (incremental_test): Add -z norelro.
631         (incremental_test_2): Likewise.
632         (incremental_test_3): Likewise.
633         (incremental_test_4): Likewise.
634         (incremental_test_5): Likewise.
635         (incremental_test_6): Likewise.
636         (incremental_copy_test): Likewise.
637         (incremental_common_test_1): Likewise.
638         (incremental_comdat_test_1): Likewise.
639         * testsuite/Makefile.in: Regenerate.
640
641 2015-03-09  Cary Coutant  <ccoutant@google.com>
642
643         PR gold/14675
644         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
645         return enum indicating whether .eh_frame section is empty, optimizable,
646         unrecognized, or an end marker. Adjust explicit instantiations.
647         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
648         (Eh_frame::add_ehframe_input_section): Change return type.
649         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
650         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
651         to the .eh_frame output section until we see the end marker.
652         (Layout::finalize_eh_frame_section): New.
653         * layout.h: (Layout::finalize_eh_frame_section): New.
654
655 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
656
657         * output.cc (Relobj::initialize_input_to_output_map<size>):
658         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
659
660 2015-03-04  Cary Coutant  <ccoutant@google.com>
661
662         * parameters.cc (Parameters::set_target_once): Call
663         Target::select_as_default_target just once from here...
664         (set_parameters_target): ...instead of from here.
665
666 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
667
668         * ehframe.cc (Cie::set_output_offset): Pass in and use a
669         Output_section_data instead of a Merge_map.
670         (Eh_frame::Eh_frame): Don't initialize merge_map_.
671         (Eh_frame::read_cie): Use add_merge_mapping instead of
672         Merge_map::add_mapping.
673         (Eh_frame::read_fde): Ditto.
674         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
675         (Eh_frame::do_output_offset): Use merge_output_offset istead of
676         merge_map_->get_output_offset.
677         (Eh_frame::do_is_merge_section_for): Delete.
678         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
679         instead of a Merge_map.
680         (Cie::set_output_offset): Pass in a Output_section_data instead of a
681         Merge_map.
682         (Eh_frame::do_is_merge_section_for): Delete.
683         (Eh_frame::merge_map_): Delete.
684         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
685         and use a Output_section_data instead of a Merge_map.
686         (Object_merge_map::add_mapping): Ditto.
687         (Object_merge_map::get_output_offset): Remove the merge_map argument.
688         (Object_merge_map::is_merge_section_for): Pass in and use a
689         Output_section_data instead of a Merge_map.
690         (Merge_map): Delete.
691         (Output_merge_base::do_output_offset): Use merge_output_offset instead
692         of merge_map_.get_output_offset.
693         (Output_merge_base::do_is_merge_section_for): Delete.
694         (Output_merge_data::do_add_input_section): Use
695         object->add_merge_mapping instead of add_mapping.
696         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
697         * merge.h (Merge_map): Delete forward declaration.
698         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
699         instead of a Merge_map.
700         (Object_merge_map::get_output_offset): Remove the merge_map argument.
701         (Object_merge_map::is_merge_section_for): Pass in and use a
702         Output_section_data instead of a Merge_map.
703         (Input_merge_map::Object_merge_map::merge_map): Replace with
704         output_data.
705         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
706         Output_section_data instead of a Merge_map.
707         (Merge_map): Delete.
708         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
709         (Output_merge_base::do_is_merge_section_for): Delete.
710         (Output_merge_base::add_mapping): Delete.
711         (Output_merge_base::merge_map_): Delete.
712         * object.cc (Relobj::initialize_input_to_output_map): New.
713         (Relobj::initialize_input_to_output_map): New.
714         (Relobj::merge_output_offset): New.
715         (Relobj::is_merge_section_for): New.
716         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
717         bits.
718         * object.h (Relobj::merge_map): Delete.
719         (initialize_input_to_output_map): New.
720         (set_merge_map): Delete.
721         (add_merge_mapping): New.
722         (merge_output_offset): New.
723         (is_merge_section_for): New.
724         * output.cc (Output_section::Input_section::is_merge_section_for):
725         Use object->is_merge_section_for.
726         * output.h (Output_section_data::is_merge_section_for): Delete.
727         (Output_section_data::do_is_merge_section_for): Delete.
728         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
729         Use object->initialize_input_to_output_map.
730         (Merged_symbol_value<size>::value_from_output_section): Use
731         object->merge_output_offset.
732
733 2015-03-02  Peter Collingbourne  <pcc@google.com>
734             Cary Coutant  <ccoutant@google.com>
735
736         * output.cc (Output_section::add_merge_input_section): Do not
737         attempt to merge sections with an entsize of 0.
738
739 2015-03-02  Khem Raj  <raj.khem@gmail.com>
740
741         * attributes.h (class Output_attributes_section_data ): Add
742         do_print_to_mapfile function.
743
744 2015-02-24  Alan Modra  <amodra@gmail.com>
745
746         PR 18010
747         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
748         complain if value is not a multiple of four.
749         (Target_powerpc::Relocate::relocate): Correct handling of
750         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
751
752 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
753
754         * configure.ac (default_size): Set to 32 for x32.
755         * configure: Regenerated.
756
757 2015-02-18  Alan Modra  <amodra@gmail.com>
758
759         PR 17954
760         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
761         visibility.
762
763 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
764
765         * gc.h (Garbage_collection::add_reference): Don't use find.
766
767 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
768
769         * object.cc (write_local_symbols): avoid std::vector copy.
770
771 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
772
773         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
774
775 2015-02-09  Mark Wielaard  <mjw@redhat.com>
776
777         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
778         DW_LANG_Fortran03 and DW_LANG_Fortran08.
779
780 2015-02-16  Cary Coutant  <ccoutant@google.com>
781
782         PR gold/13577
783         PR gold/16992
784         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
785         DF_SYMBOLIC if --dynamic-list option is used.
786         * options.cc (General_options::finalize): --dynamic-list is not
787         mutually exclusive with -Bsymbolic.
788         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
789         listed in --dynamic-list.
790         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
791         -Bsymbolic-functions.
792         * testsuite/Makefile.in: Regenerate.
793
794 2015-02-16  Cary Coutant  <ccoutant@google.com>
795
796         PR gold/17971
797         * incremental.cc: Remove redundant include of "output.h".
798
799 2015-02-12  Jing Yu  <jingyu@google.com>
800
801         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
802         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
803         New relocation.
804         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
805         TLSLE_MOVW_* relocations.
806         (Target_aarch64::Scan::global): Likewise.
807         (Target_aarch64::Relocate::relocate): Likewise.
808         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
809         for new TLSLE_MOVW_* relocations.
810
811 2015-02-11  Will Newton  <will.newton@linaro.org>
812
813         PR gold/13321
814         * arm.cc (Target_arm::make_plt_section): Create an ARM
815         state mapping symbol at the start of the PLT.
816
817 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
818
819         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
820         Replace two_file_shared_2.so with two_file_shared_1.so.
821         * testsuite/Makefile.in: Regenerated.
822
823 2015-02-09  Alan Modra  <amodra@gmail.com>
824
825         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
826         plugin_test_thin.a and defsym_test.
827         * testsuite/Makefile.in: Regenerate.
828
829 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
830
831         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
832         body.
833
834 2015-02-04  Peter Collingbourne  <pcc@google.com>
835
836         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
837         forwarding symbols when computing symbol resolution info for plugins.
838         * plugin.h (Plugin_manager::symtab): New method.
839         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
840
841 2015-02-03  Cary Coutant  <ccoutant@google.com>
842             Peter Collingbourne  <pcc@google.com>
843
844         PR gold/15660
845         * archive.cc (Thin_archive_object_unlocker): New class.
846         (Archive::include_member): Unlock external members of thin archives.
847         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
848         (plugin_test_2): Likewise.
849         (plugin_test_3): Likewise.
850         (plugin_test_4): Likewise.
851         (plugin_test_5): Likewise.
852         (plugin_test_6): Likewise.
853         (plugin_test_7): Likewise.
854         (plugin_test_8): Likewise.
855         (plugin_test_9): Likewise.
856         (plugin_test_10): Likewise.
857         (plugin_test_11): New test case.
858         * testsuite/Makefile.in: Regenerate.
859         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
860         file to decide whether to claim file.
861         (all_symbols_read_hook): Likewise.
862         * testsuite/plugin_test_1.sh: Adjust expected output.
863         * testsuite/plugin_test_2.sh: Likewise.
864         * testsuite/plugin_test_3.sh: Likewise.
865         * testsuite/plugin_test_6.sh: Likewise.
866         * testsuite/plugin_test_tls.sh: Likewise.
867         * testsuite/plugin_test_11.sh: New testcase.
868
869 2015-02-03  Cary Coutant  <ccoutant@google.com>
870
871         * descriptors.cc (Descriptors::open): Set artificially-low limit for
872         file descriptors when debugging enabled. Add debug output.
873         (Descriptors::release): Add debug output.
874         (Descriptors::close_some_descriptor): Likewise.
875         (Descriptors::close_all): Likewise.
876         * fileread.cc (File_read::lock): Likewise.
877         (File_read::unlock): Likewise.
878
879 2015-02-02  Cary Coutant  <ccoutant@google.com>
880
881         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
882         executable output file.
883
884 2015-01-22  Han Shen  <shenhan@google.com>
885
886         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
887         (Target_arm::do_plt_address_for_global): New method.
888         (Target_arm::do_plt_address_for_local): New method.
889         (Target_arm::rel_irelative_section): New method.
890         (Target_arm::make_data_plt): Add more parameters for plt ctor.
891         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
892         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
893         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
894         (Target_arm::Scan::check_non_pic): Add ifunc support.
895         (Target_arm::Scan::local): Add ifunc support.
896         (Target_arm::Scan::global): Add ifunc support.
897         (Target_arm::make_plt_section): New method.
898         (Target_arm::make_plt_entry): Change to call to make_plt_section.
899         (Target_arm::make_local_ifunc_plt_entry): New method.
900         (Target_arm::got_irelative_): New member.
901         (Target_arm::rel_irelative_): New member.
902         (Target_arm::got_section): Add creation for got_irelative_.
903         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
904         (Target_arm::Relocate::relocate): Properly set local ifunc address.
905         (Target_arm::do_dynsym_value): Properly set global ifunc address.
906         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
907         (Output_data_plt_arm::IRelative_data): New type.
908         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
909         (Output_data_plt_arm::add_entry): Add more parameters.
910         (Output_data_plt_arm::add_relocation): New method.
911         (Output_data_plt_arm::add_local_ifunc_entry): New method.
912         (Output_data_plt_arm::rel_irelative): New method.
913         (Output_data_plt_arm::entry_count): Modified.
914         (Output_data_plt_arm::address_for_global): New method.
915         (Output_data_plt_arm::address_for_local): New method.
916 gold/
917         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
918         (Output_data_plt_arm::insert_irelative_data): New method.
919         (Output_data_plt_arm::irelative_rel_): New member.
920         (Output_data_plt_arm::got_): New member.
921         (Output_data_plt_arm::got_irelative_): New member.
922         (Output_data_plt_arm::irelative_count_): New member.
923         (Output_data_plt_arm::IRelative_data_vec): New typedef.
924         (Output_data_plt_arm::irelative_data_vec_): New member.
925         (Output_data_plt_arm::do_write): Write out irelative entries.
926         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
927         more parameters to ctor.
928         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
929         more parameters to ctor.
930         * output.h (Output_data_reloc::add_local_relative): New method.
931         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
932
933 2015-01-29  Alan Modra  <amodra@gmail.com>
934
935         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
936         and GOT_TLSGD to LE optimization.
937
938 2015-01-28  Cary Coutant  <ccoutant@google.com>
939
940         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
941         for undef TLS symbols.
942         (Target_x86_64::Relocate::relocate_tls): Likewise.
943         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
944
945 2015-01-25  Cary Coutant  <ccoutant@google.com>
946
947         * output.cc (Output_segment::set_section_addresses): Fix calculation
948         of size of relro segment.
949
950 2015-01-22  Alan Modra  <amodra@gmail.com>
951
952         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
953         condition for need of ifunc plt entry.
954         (Target_powerpc::Scan::global <got relocs>): Likewise.
955
956 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
957
958         * mips.cc (reloc_high): Add r_sym.
959         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
960         reloc_high constructor.
961         (Mips_relocate_functions::relgot16_local): Likewise.
962         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
963         r_type to decide whether LO16 matches HI16.
964         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
965         rello16 and relgot16_local.
966
967 2015-01-09  Cary Coutant  <ccoutant@google.com>
968
969         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
970         unless alignment is larger than page size.
971
972 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
973             Cary Coutant  <ccoutant@google.com>
974
975         PR gold/17729
976         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
977         (DEFAULT_TARGET_X32): Set for x32.
978         * x86_64.cc (cmp_insn_32): New.
979         (lea_r10_insn_32): Likewise.
980         (lea_r11_insn_32): Likewise.
981         (cmp_insn_64): Likewise.
982         (lea_r10_insn_64): Likewise.
983         (lea_r11_insn_64): Likewise.
984         (Target_x86_64<size>::do_calls_non_split): Handle x32.
985         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
986         (check_DATA): Add split_x32 files.
987         (split_x32_[1234n].o): New targets.
988         (split_x32_[124]): New targets.
989         (split_x32_[1234r].stdout): New targets.
990         * testsuite/split_x32.sh: New file.
991         * testsuite/split_x32_1.s: Likewise.
992         * testsuite/split_x32_2.s: Likewise.
993         * testsuite/split_x32_3.s: Likewise.
994         * testsuite/split_x32_4.s: Likewise.
995         * testsuite/split_x32_n.s: Likewise.
996         * configure: Regenerated.
997         * testsuite/Makefile.in: Likewise.
998
999 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1000
1001         PR gold/17809
1002         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1003         x32.
1004
1005 2015-01-02  Alan Modra  <amodra@gmail.com>
1006
1007         * version.cc (print_version): Just print current year.
1008         * dwp.cc (print_version): Likewise.
1009
1010 2015-01-01  Alan Modra  <amodra@gmail.com>
1011
1012         Update year range in copyright notice of all files.
1013
1014 2014-12-25  Alan Modra  <amodra@gmail.com>
1015
1016         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1017         new enums.
1018         (Target_arm::merge_object_attributes, ): Likewise.
1019
1020 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1021
1022         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1023         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1024         AEABI_VFP_args_vfp to check that.
1025         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1026         value and replace hardcoded values by enum values.
1027
1028 2014-12-22  Cary Coutant  <ccoutant@google.com>
1029
1030         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1031
1032 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1033
1034         PR gold/14608
1035         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1036         to "return i * i * 3;".
1037
1038 2014-12-16  Cary Coutant  <ccoutant@google.com>
1039
1040         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1041         (Mapfile::print_output_data): Use current_data_size() to avoid
1042         assert for sections requiring postprocessing; if address is not valid,
1043         print 0.
1044         (Mapfile::print_output_section): Use current_data_size(); print note
1045         that addresses and sizes are before compression.
1046
1047 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1048
1049         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1050         Cast current_group_size to unsigned long when reporting error.
1051
1052 2014-12-10  Jing Yu  <jingyu@google.com>
1053
1054         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1055         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1056         Update error message.
1057         (Target_aarch64::do_relax): Use absolute value of option
1058         stub_group_size. Replace local variable with class member
1059         stub_group_size_.
1060
1061 2014-12-04  Alan Modra  <amodra@gmail.com>
1062
1063         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1064         addend of PLTREL24 reloc when not generating a plt stub.  Make
1065         max_branch_offset an "Address".
1066         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1067         (Target_powerpc::Relocate::relocate): Likewise.
1068
1069 2014-12-04  Alan Modra  <amodra@gmail.com>
1070
1071         PR 17670
1072         * symtab.cc (Symbol::set_undefined): Remove assertion.
1073         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1074         on symbols defined in discarded sections, instead return false.
1075         Rearrange params, update all callers.
1076         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1077         branches to syms in discarded sections.
1078         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1079         undefined and flag as discarded.
1080         (Target_powerpc::Relocate::relocate): Localize variable.
1081
1082 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1083
1084         PR gold/17675
1085         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1086         * testsuite/Makefile.in: Regenerated.
1087
1088 2014-12-03  Alan Modra  <amodra@gmail.com>
1089
1090         PR 17566
1091         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1092         when adding dynamic relocations against section symbols.
1093
1094 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1095
1096         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1097         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1098         * options.h (General_options): New -z option (global).
1099
1100 2014-12-01  Cary Coutant  <ccoutant@google.com>
1101
1102         PR gold/17578
1103         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1104         is given.
1105         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1106         given but some inputs require executable stack.
1107
1108 2014-11-26  Cary Coutant  <ccoutant@google.com>
1109
1110         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1111         .debug_str_offsets; strip .debug_gnu_pubnames and
1112         .debug_gnu_pubtypes.
1113         (lines_only_debug_sections): Strip all four new sections.
1114
1115 2014-11-26  Jing Yu  <jingyu@google.com>
1116
1117         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1118         register to be x0 when to relax TLSDESC_LD64_LO12.
1119
1120 2014-11-26  Alan Modra  <amodra@gmail.com>
1121
1122         * powerpc.cc (struct Stub_table_owner): New.
1123         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1124         unsigned int vector.  Update all references.
1125         (powerpc_relobj::set_stub_table): Take an unsigned int param
1126         rather than a Stub_table.  Update callers.
1127         (Powerpc_relobj::clear_stub_table): New function.
1128         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1129         stub_group_size_ vars.
1130         (Target_powerpc::new_stub_table): Delete.
1131         (max_branch_delta): New function, extracted from..
1132         (Target_powerpc::Relocate::relocate): ..here..
1133         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1134         status on whether stub created successfully.
1135         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1136         default sizing to..
1137         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1138         reduce on relax failure.
1139         (Target_powerpc::group_sections): Add "no_size_errors" param.
1140         Use stub_group_size_.  Set up group info in a temp vector,
1141         before building Stub_table vector.  Account for input sections
1142         possibly already converted to relaxed sections.
1143         (Stub_table::init): Delete.  Merge into..
1144         (Stub_table::Stub_table): ..here.
1145         (Stub_table::can_reach_stub): New function.
1146         (Stub_table::add_plt_call_entry): Add "from" parameter and
1147         return true iff stub could be reached.
1148         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1149         param too.
1150         (Stub_table::clear_stubs): Add "all" param.
1151
1152 2014-11-26  Alan Modra  <amodra@gmail.com>
1153
1154         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1155         (Target_powerpc::group_sections): Use it.
1156
1157 2014-11-25  Cary Coutant  <ccoutant@google.com>
1158
1159         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1160         (Binary_to_elf::write_symbol): Add st_size parameter.
1161         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1162
1163 2014-11-25  Cary Coutant  <ccoutant@google.com>
1164
1165         PR gold/17639
1166         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1167         (Sized_relobj_file::do_layout): Handle deferred sections properly
1168         during GC pass 1. Don't add reloc sections to deferred list twice.
1169         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1170         (Sized_relobj_file::is_deferred_layout_): New data member.
1171
1172 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1173
1174         PR gold/17619
1175         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1176         Check PC-relative offset overflow in PLT entry.
1177
1178 2014-11-21  Alan Modra  <amodra@gmail.com>
1179
1180         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1181         for undefined weaks.
1182
1183 2014-11-20  Alan Modra  <amodra@gmail.com>
1184
1185         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1186         from --stub-group-size parameter divided by 1024.
1187         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1188         template parameter.  Update all uses.
1189         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1190         has_stub_value.  Set for long branches.  Don't report overflow for
1191         branch to undefined weak symbols.  Print info message on
1192         overflowing branch to stub.
1193
1194 2014-11-20  Alan Modra  <amodra@gmail.com>
1195
1196         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1197
1198 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1199
1200         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1201         entry for R_X86_64_GOTPLT64.
1202         (Target_x86_64<size>::Relocate::relocate): Update comments for
1203         R_X86_64_GOTPLT64.
1204
1205 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1206
1207         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1208         * plugin.h: add lock definition
1209
1210 2014-10-29  Han Shen  <shenhan@google.com>
1211             Jing Yu   <jingyu@google.com>
1212
1213         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1214         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1215         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1216         Symbol::TLS_REF.
1217         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1218         method.
1219         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1220         (Target_aarch64::tls_ld_to_le): New method.
1221         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1222         for 64bit targets.
1223         (Output_data_plt_aarch64::irelative_rel_): New data member.
1224         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1225         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1226         (Output_data_plt_aarch64::add_relocation): New method.
1227         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1228         offset. Add got_irelative size to got size.
1229         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1230         type string with the new typename.
1231         (AArch64_relocate_functions::update_adr): Replace parameter x with
1232         immed.
1233         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1234         (AArch64_relocate_functions::reloc_common): New method.
1235         (AArch64_relocate_funcsions::rela_general): Extract common part out
1236         into reloc_common method.
1237         (AArch64_relocate_functions::rela_general): Likewise.
1238         (AArch64_relocate_functions::pcrela_general): Likewise.
1239         (AArch64_relocate_functions::adr): New method.
1240         (AArch64_relocate_functions::adrp): Calculate immed before calling
1241         update_adr.
1242         (AArch64_relocate_functions::adrp): Likewise.
1243         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1244         comparing x to 0. Calculate immed from ~x when x < 0.
1245         (Target_aarch64::optimize_tls_reloc): Add new cases for
1246         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1247         TLSLD_MOVW_DTPREL_G0_NC.
1248         (Target_aarch64::possible_function_pointer_reloc): Implement this
1249         method.
1250         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1251         comment.
1252         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1253         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1254         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1255         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1256         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1257         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1258         (Target_aarch64::make_plt_entry): Call add_entry with two more
1259         parameters.
1260         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1261         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1262         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1263         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1264         (Target_aarch64::Relocate::relocate_tls): Add cases for
1265         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1266         TLSLD_MOVW_DTPREL_G0_NC.
1267         * testsuite/icf_safe_so_test.cc: Correct test comment.
1268         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1269
1270 2014-10-22  Alan Modra  <amodra@gmail.com>
1271
1272         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1273         thread_starter.
1274
1275 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1276
1277         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1278
1279 2014-10-17  Cary Coutant  <ccoutant@google.com>
1280
1281         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1282         Add "typename" keyword.
1283
1284 2014-10-15  Han Shen  <shenhan@google.com>
1285             Jing Yu   <jingyu@google.com>
1286
1287         Patch for gold aarch64 backend to support relaxation.
1288         * aarch64-reloc.def: Change format.
1289         * aarch64.cc (class Reloc_stub): New class.
1290         (class Stub_table): New class.
1291         (class AArch64_relobj): New class.
1292         (class AArch64_input_section): New class.
1293         (class AArch64_output_section): New class.
1294         (Target_aarch64::new_stub_table): New method.
1295         (Target_aarch64::new_aarch64_input_section): New method.
1296         (Target_aarch64::find_aarch64_input_section): New method.
1297         (Target_aarch64::scan_section_for_stubs): New method.
1298         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1299         (Target_aarch64::relocate_stub): New method.
1300         (Target_aarch64::current_target): New method.
1301         (Target_aarch64::do_make_elf_object): New method.
1302         (Target_aarch64::do_may_relax): New method.
1303         (Target_aarch64::do_relax): New method.
1304         (Target_aarch64::group_sections): New method.
1305         (Target_aarch64::scan_reloc_for_stub): New method.
1306         (Target_aarch64::do_make_output_section): New method.
1307         (Target_aarch64::stub_tables_): New data member.
1308         (Target_aarch64::aarch64_input_section_map_): New data member.
1309         (AArch64_relocate_functions::maybe_apply_stub): New method.
1310
1311 2014-09-30  Cary Coutant  <ccoutant@google.com>
1312
1313         PR gold/17432
1314         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1315
1316 2014-09-30  Kito Cheng  <kito@0xlab.org>
1317
1318         PR gold/13597
1319         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1320         hash table before sysv-style hash table.
1321
1322 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1323
1324         * options.h (--pic-executable): Add negative to alias to -no-pie.
1325
1326 2014-09-26  Cary Coutant  <ccoutant@google.com>
1327
1328         PR gold/16773
1329         * object.cc (Sized_relobj_file): Compute value of section symbols
1330         for TLS sections the same as TLS symbols.
1331
1332 2014-09-25  Cary Coutant  <ccoutant@google.com>
1333
1334         PR gold/17432
1335         * resolve.cc (Symbol_table::resolve): Override common placeholder
1336         symbols, but adjust sizes.
1337         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1338         symbols to common lists.
1339
1340 2014-09-24  Alan Modra  <amodra@gmail.com>
1341
1342         * po/POTFILES.in: Regenerate.
1343
1344 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1345             Cary Coutant  <ccoutant@google.com>
1346
1347         PR gold/14860
1348         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1349         on input_sections_blocker.
1350         * layout.cc (Write_sections_task::locks): Unblock
1351         input_sections_blocker_.
1352         * layout.h (Write_sections_task::Write_sections_task): Add
1353         input_sections_blocker.
1354         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1355         to DEPENDENCIES.
1356         * testsuite/Makefile.in: Regenerate.
1357
1358 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1359
1360         * testsuite/Makefile.am (plugin_test_10): New test.
1361         * testsuite/Makefile.in: Regenerate
1362         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1363         * testsuite/plugin_test_10.sh: New file.
1364
1365 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1366
1367         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1368         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1369         during the replacement phase.
1370
1371 2014-09-17  Han Shen  <shenhan@google.com>
1372             Jing Yu  <jingyu@google.com>
1373
1374         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1375         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1376         * aarch64.cc (Target_aarch64): Add data members
1377         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1378         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1379         constructor.
1380         (Target_aarch64::do_reloc_symbol_index): New method.
1381         (Target_aarch64::do_reloc_addend): New method.
1382         (Target_aarch64::add_tlsdesc_info): New method.
1383         (Target_aarch64::do_dynsym_value): New method.
1384         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1385         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1386         (Target_aarch64::make_data_plt): Add new parameters: got,
1387         got_irelative. Pass them to do_make_data_plt.
1388         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1389         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1390         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1391         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1392         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1393         (Target_aarch64::got_tlsdesc_section): New method.
1394         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1395         (Target_aarch64::define_tls_base_symbol): New method.
1396         (Target_aarch64::reserve_tlsdesc_entries): New method.
1397         (Target_aarch64::got_mod_index_entry): New method.
1398         (Target_aarch64::rela_tlsdesc_section): New method.
1399         (Target_aarch64::rela_irelative_section): New method.
1400         (Target_aarch64::Tlsdesc_info): New struct.
1401         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1402         relocations and tlsdesc relocations.
1403         (Target_aarch64::optimize_tls_reloc): Implement method.
1404         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1405         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1406         in constructor.
1407         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1408         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1409         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1410         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1411         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1412         (Output_data_plt_aarch64::rela_irelative): New method.
1413         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1414         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1415         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1416         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1417         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1418         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1419         (Output_data_plt_aarch64_standard): New member variables:
1420         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1421         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1422         New parameter: got, got_irelative.
1423         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1424         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1425         (Output_data_plt_aarch64::do_write): Replace got_address with
1426         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1427         (AArch64_relocate_functions::update_movnz): New method.
1428         (AArch64_relocate_functions): Correct format.
1429         (AArch64_relocate_functions::movnz): New method.
1430         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1431         before the switch. Add new cases to switch.
1432         Check ie_to_le relaxation on tlsie relocations. Add code handling
1433         tlsgd tlsdesc cases.
1434         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1435         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1436         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1437         Call reloc_name_in_error_message to print unsupported reloc.
1438         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1439         make_data_plt.
1440         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1441         relocs. Fill in some more dynamic tags.
1442         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1443         Skip call tls_get_addr when tlsgd is relaxed.
1444         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1445         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1446         tlsdesc->ie relaxation.
1447
1448 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1449
1450         * mips.cc (Target_mips_nacl): New class.
1451         (Target_selector_mips_nacl): New class.
1452         (target_selector_mips32): Rename from target_selector_mips32be and use
1453         Target_selector_mips_nacl instead of Target_selector_mips.
1454         (target_selector_mips32el): Rename from target_selector_mips32 and use
1455         Target_selector_mips_nacl instead of Target_selector_mips.
1456         (target_selector_mips64): Rename from target_selector_mips64be and use
1457         Target_selector_mips_nacl instead of Target_selector_mips.
1458         (target_selector_mips64el): Rename from target_selector_mips64 and use
1459         Target_selector_mips_nacl instead of Target_selector_mips.
1460         (Target_mips::mips_info): Add const attribute.
1461
1462 2014-09-02  Cary Coutant  <ccoutant@google.com>
1463
1464         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1465         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1466         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1467         (Sized_incr_dynobj::do_section_name): Likewise.
1468         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1469         (Sized_incr_dynobj::do_section_name): Likewise.
1470         * object.h (Object::section_name): Likewise.
1471         (Object::do_section_name): Likewise.
1472         (Sized_relobj_file::do_section_name): Likewise.
1473         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1474         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1475
1476 2014-09-02  Cary Coutant  <ccoutant@google.com>
1477
1478         PR gold/17005
1479         * ehframe.cc (Fde::write): Add output_offset parameter.
1480         (Cie::write): Likewise.
1481         (Eh_frame::set_final_data_size): Account for offset within output
1482         section.
1483         (Eh_frame::do_sized_write): Likewise.
1484         * ehframe.h (Fde::write): Add output_offset parameter.
1485         (Cie::write): Likewise.
1486         * output.cc (Output_section::Input_section_sort_entry): Remove
1487         section_has_name_; add output_section_name parameter. Use
1488         output section name for non-input sections.
1489         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1490         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1491         (Output_section::Input_section_sort_compare): Remove logic for
1492         sections without names.
1493         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1494         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1495         Likewise.
1496         (Output_section::Input_section_sort_section_name_compare): Likewise.
1497
1498 2014-08-29 Han Shen <shenhan@google.com>
1499            Jing Yu <jingyu@google.com>
1500
1501         * aarch64-reloc-property.cc
1502         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1503         reference reloc property in the table.
1504         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1505         3 other entries.
1506         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1507         2 new overloaded methods.
1508         (Output_data_got_aarch64::do_write): Add code to write out
1509         static relocs.
1510         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1511         static relocs.
1512         (Output_data_got_aarch64::static_relocs): New vector to
1513         hold static relocs.
1514         (Target_aarch64::TCB_SIZE): New const static memeber.
1515         (Target_aarch64::tcb_size): New method.
1516         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1517         (Target_aarch64::Relocate::relocate_tls): New method.
1518         (Target_aarch64::Scan::local): Add code handling new reloc types.
1519         (Target_aarch64::Scan::global): Add code handling new reloc types.
1520
1521 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1522
1523         * options.h (-no-pie): Add option.
1524
1525 2014-08-08  Jing Yu  <jingyu@google.com>
1526             Han Shen  <shenhan@google.com>
1527
1528         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1529         (DEFFILES): add aarch64-reloc.def.
1530         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1531         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1532         * Makefile.in: Regenerate.
1533         * aarch64-reloc-property.cc: New file.
1534         * aarch64-reloc-property.h: New file.
1535         * aarch64-reloc.def: New file.
1536         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1537         with tab to make the format consistent.
1538         (Output_data_got_aarch64::symbol_table_): New method.
1539         (Target_aarch64::do_plt_address_for_global): New method.
1540         (Target_aarch64::do_plt_address_for_local): New method.
1541         (Target_aarch64::do_select_as_default_target): New method.
1542         (Target_aarch64::do_make_data_plt): New method.
1543         (Target_aarch64::make_data_plt): New method.
1544         (Output_data_plt_aarch64::has_irelative_section): New method.
1545         (Output_data_plt_aarch64::address_for_global): New method.
1546         (Output_data_plt_aarch64::address_for_local): New method.
1547         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1548         (Output_data_plt_aarch64::add_entry): Implement contents.
1549         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1550         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1551         the got_pov entry to plt0.
1552         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1553         Implement contents.
1554         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1555         (AArch64_howto): New struct.
1556         (aarch64_howto[]): New static const array.
1557         (AArch64_relocate_functions): New class.
1558         (Target_aarch64::Scan::get_reference_flags): Remove method.
1559         (Target_aarch64::Scan::local): Implement to support a few relocations.
1560         (Target_aarch64::Scan::global): Implement to support a few relocations.
1561         (Target_aarch64::make_plt_section): Implement contents.
1562         (Target_aarch64::make_plt_entry): Implement contents.
1563         (Target_aarch64::do_finalize_sections): Implement contents.
1564         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1565         (Target_aarch64::relocate_section): Implement contents.
1566
1567 2014-08-06  Alan Modra  <amodra@gmail.com>
1568
1569         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1570
1571 2014-08-06  Alan Modra  <amodra@gmail.com>
1572
1573         PR 13227
1574         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1575
1576 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1577
1578         * object.cc (Relobj::is_section_name_included): Add
1579         ".rodata.nptl_version" to not garbage collect this section.
1580
1581 2014-07-08  Cary Coutant  <ccoutant@google.com>
1582
1583         * expression.cc (struct Expression::Expression_eval_info): Add
1584         new fields type_pointer, vis_pointer, and nonvis_pointer.
1585         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1586         nonvis_pointer parameters. Adjust all calls.
1587         (Symbol_expression::value): Update type, visibility, and nonvis bits
1588         in caller.
1589         * script.cc (Symbol_assignment::sized_finalize): Update type,
1590         visibility, and remaining st_other bits for new symbol.
1591         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1592         vis_pointer, and nonvis_pointer parameters.
1593         * symtab.h (Symbol::set_type): New method.
1594
1595         * testsuite/Makefile.am (defsym_test): New test.
1596         * testsuite/Makefile.in: Regenerate.
1597         * testsuite/defsym_test.c: New file.
1598         * testsuite/defsym_test.sh: New file.
1599
1600 2014-07-08  Cary Coutant  <ccoutant@google.com>
1601
1602         PR gold/15639
1603         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1604         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1605         (Sized_dynobj::base_read_symbols): ...new method.
1606         * object.h (Sized_relobj_file::base_read_symbols): New method.
1607         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1608         (Sized_relobj_file::base_read_symbols): ...new method.
1609         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1610         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1611         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1612
1613 2014-07-04  Alan Modra  <amodra@gmail.com>
1614
1615         * po/POTFILES.in: Regenerate.
1616
1617 2014-07-02  Jing Yu  <jingyu@google.com>
1618
1619         * aarch64.cc: New file
1620         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1621         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1622         * Makefile.in: Regenerate.
1623         * configure.tgt: Add entries for aarch64*.
1624         * configure.ac:  Likewise.
1625         * configure: Likewise.
1626
1627 2014-06-27  Alan Modra  <amodra@gmail.com>
1628
1629         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1630
1631 2014-06-24  Cary Coutant  <ccoutant@google.com>
1632
1633         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1634         sections.
1635         (Dwo_file::sized_read_unit_index): Likewise.
1636
1637 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1638
1639         * mips.cc: New file.
1640         * Makefile.am (TARGETSOURCES): Add mips.cc
1641         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1642         * configure.tgt: Add entries for mips*.
1643         * configure.ac: Likewise.
1644         * Makefile.in: Regenerate.
1645         * configure: Likewise.
1646
1647 2014-06-09  Cary Coutant  <ccoutant@google.com>
1648
1649         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1650         unit_length is within section bounds.
1651
1652 2014-06-09  Cary Coutant  <ccoutant@google.com>
1653
1654         PR gold/16980
1655         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1656         map.
1657
1658 2014-06-07  Alan Modra  <amodra@gmail.com>
1659
1660         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1661
1662 2014-06-06  Cary Coutant  <ccoutant@google.com>
1663
1664         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1665         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1666         (Dwarf_pubnames_table::read_header): Likewise.
1667         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1668         .debug_gnu_pubtypes.
1669
1670 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1671
1672         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1673         * Makefile.in, configure: Regenerate.
1674
1675 2014-06-03  Alan Modra  <amodra@gmail.com>
1676
1677         * powerpc.cc (addis_12_2): Define.
1678         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1679
1680 2014-06-03  Alan Modra  <amodra@gmail.com>
1681
1682         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1683         st_other output.
1684
1685 2014-06-02  Alan Modra  <amodra@gmail.com>
1686
1687         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1688         Only ignore relocs on ELFv1.
1689         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1690
1691 2014-05-30  Cary Coutant  <ccoutant@google.com>
1692
1693         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1694         * testsuite/Makefile.in: Regenerate.
1695         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1696
1697 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1698
1699         PR gold/16945
1700         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1701         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1702
1703 2014-05-15  Alan Modra  <amodra@gmail.com>
1704
1705         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1706         Compare FDE contents with DW_CFA_nop rather than 0.
1707
1708 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1709
1710         * symtab.h (may_need_copy_reloc): Remove check for position independent
1711         code.
1712         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1713         position independence before pc absolute may_need_copy_reloc call.
1714         Add check for executable output befor pc relative may_need_copy_reloc
1715         call.
1716         * i386.cc: Ditto.
1717         * arm.cc: Ditto.
1718         * sparc.cc: Ditto.
1719         * tilegx.cc: Ditto.
1720         * powerpc.cc: Add check for no position independence before
1721         may_need_copy_reloc calls.
1722         * testsuite/pie_copyrelocs_test.cc: New file.
1723         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1724         * Makefile.am (pie_copyrelocs_test): New test.
1725         * Makefile.in: Regenerate.
1726
1727 2014-05-08  Martin Liška  <mliska@suse.cz>
1728
1729         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1730
1731 2014-05-06  Cary Coutant  <ccoutant@google.com>
1732
1733         PR gold/16900
1734         * i386.cc (Output_data_got_plt_i386): New class.
1735         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1736         parameter. Change all callers.
1737         (Output_data_plt_i386::layout_): Remove.
1738         (Output_data_plt_i386::got_plt_): Change type.
1739         (Target_i386::got_plt_): Change type. Change all references.
1740         (Target_i386::got_section): Create instance of new class.
1741         (Output_data_got_plt_i386::do_write): New function.
1742         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1743         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1744         parameter. Change all callers.
1745         (Output_data_plt_x86_64::layout_): Remove.
1746         (Output_data_plt_x86_64::got_plt_): Change type.
1747         (Target_x86_64::got_plt_): Change type. Change all references.
1748         (Target_x86_64::got_section): Create instance of new class.
1749         (Output_data_got_plt_x86_64::do_write): New function.
1750         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1751         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1752         class.
1753
1754 2014-05-05  Cary Coutant  <ccoutant@google.com>
1755
1756         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1757         if we have pubnames/pubtypes.
1758
1759 2014-05-02  Cary Coutant  <ccoutant@google.com>
1760
1761         * defstd.cc (in_segment): Define __ehdr_start here...
1762         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1763         output segment when known.
1764         * resolve.cc (Symbol::override_base_with_special): Remember
1765         the original binding.
1766         * symtab.cc (Symbol::set_output_segment): New function.
1767         (Symbol::set_undefined): New function.
1768         * symtab.h (Symbol::is_weak_undefined): Check original undef
1769         binding.
1770         (Symbol::is_strong_undefined): New function.
1771         (Symbol::set_output_segment): New function.
1772         (Symbol::set_undefined): New function.
1773         * target-reloc.h (is_strong_undefined): Remove.
1774         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1775         Check for hidden undefs.
1776         (relocate_section): Call Symbol::is_strong_undefined.
1777
1778         * testsuite/Makefile.am (ehdr_start_test_1)
1779         (ehdr_start_test_2, ehdr_start_test_3)
1780         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1781         * testsuite/Makefile.in: Regenerate.
1782         * testsuite/ehdr_start_def.cc: New source file.
1783         * testsuite/ehdr_start_test.cc: New source file.
1784         * testsuite/ehdr_start_test.t: New linker script.
1785         * testsuite/ehdr_start_test_4.sh: New shell script.
1786
1787 2014-04-23  Cary Coutant  <ccoutant@google.com>
1788
1789         PR gold/16870
1790         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1791
1792 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1793
1794         * layout.cc (Layout::include_section): Allow a target to decide
1795         whether to include a section.
1796         * target.h (Target::should_include_section): New function.
1797         (Target::do_should_include_section): New function.
1798
1799 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1800
1801         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1802         inline into ...
1803         (Copy_relocs::emit): ... here.
1804         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1805         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1806         (Copy_reloc_entry::entries_): Change from private to protected.
1807
1808 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1809
1810         * icf.cc (get_section_contents): Replace copies of reloc
1811         vectors with const references.
1812
1813 2014-04-02  Cary Coutant  <ccoutant@google.com>
1814
1815         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1816         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1817         * configure: Regenerate.
1818         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1819         -fno-use-linker-plugin.
1820         (LINK1, CXXLINK1): Add it to the link command.
1821         * testsuite/Makefile.in: Regenerate.
1822
1823 2014-03-12  Alan Modra  <amodra@gmail.com>
1824
1825         * Makefile.in: Regenerate.
1826
1827 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1828
1829         * symtab.h (Symbol::set_nonvis): New function.
1830
1831 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1832
1833         * symtab.cc (Sized_symbol<32>::init_output_data):
1834         Instantiate the template.
1835         (Sized_symbol<64>::init_output_data): Likewise.
1836
1837 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1838
1839         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1840         adjust dynamic symbol value.
1841         * target.h (Target::adjust_dyn_symbol): New function.
1842         (Target::do_adjust_dyn_symbol): New function.
1843
1844 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1845
1846         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1847         Get the value of DYNAMIC_CUSTOM dynamic entry.
1848         * output.h (Output_data_dynamic::add_custom): New function.
1849         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1850         dynamic entry.
1851         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1852         * target.h (Target::dynamic_tag_custom_value): New function.
1853         (Target::do_dynamic_tag_custom_value): New function.
1854
1855 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1856
1857         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1858         dynsym indexes.
1859         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1860         (Target::do_has_custom_set_dynsym_indexes): New function.
1861         (Target::set_dynsym_indexes): New function.
1862         (Target::do_set_dynsym_indexes): New function.
1863
1864 2014-03-07  Alan Modra  <amodra@gmail.com>
1865
1866         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1867         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1868         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1869         (Powerpc_relocate_functions::has_overflow_bitfield,
1870         overflowed): Use the above.
1871         (Target_powerpc::Relocate::relocate): Correct overflow checking
1872         for a number of relocations.  Modify overflow test for 16-bit
1873         fields in instructions to signed/unsigned according to whether
1874         the field takes a signed or unsigned value.
1875
1876 2014-03-05  Alan Modra  <amodra@gmail.com>
1877
1878         Update copyright years.
1879
1880 2014-03-05  Alan Modra  <amodra@gmail.com>
1881
1882         * powerpc.cc (Target_powerpc::Scan::local, global): Support
1883         R_PPC64_ADDR64_LOCAL.
1884         (Target_powerpc::Relocate::relocate): Likewise.
1885
1886 2014-03-03  Alan Modra  <amodra@gmail.com>
1887
1888         * dwp.cc (print_version): Update copyright year to current.
1889
1890 2014-02-10  Alan Modra  <amodra@gmail.com>
1891
1892         * po/gold.pot: Regenerate.
1893
1894 2014-02-06  Cary Coutant  <ccoutant@google.com>
1895
1896         Fix problem where -u is ignored when a weak undef is seen.
1897
1898         * archive.cc (Library_base::should_include_member): Reorder
1899         code to check for -u option if a weak undef has already been seen.
1900         * testsuite/Makefile.am (weak_undef_test_2): New test case.
1901         * testsuite/Makefile.in: Regenerate.
1902         * testsuite/weak_undef_file3.cc: New file.
1903         * testsuite/weak_undef_file4.cc: New file.
1904         * testsuite/weak_undef_test_2.cc: New file.
1905
1906 2014-02-05  Cary Coutant  <ccoutant@google.com>
1907
1908         Fix issues with gold undefined symbol diagnostics.
1909
1910         PR binutils/15435
1911         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1912         check to here.
1913         * target-reloc.h (is_strong_undefined): New function.
1914         (relocate_section): Move undef vtable symbol check from here.
1915         Check for is_strong_undefined.
1916
1917 2014-02-05  Cary Coutant  <ccoutant@google.com>
1918
1919         Fix problems with the --dynamic-list option.
1920
1921         PR gold/13577
1922         * options.cc (General_options::parse_dynamic_list):
1923         Set have_dynamic_list_.
1924         (General_options::General_options): Initialize have_dynamic_list_.
1925         (General_options::finalize): Turn off -Bsymbolic and
1926         -Bsymbolic-functions if --dynamic-list provided.
1927         * options.h (General_options::have_dynamic_list): New function.
1928         (General_options::have_dynamic_list_): New data member.
1929         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1930         correctly.
1931
1932         PR gold/16530
1933         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1934         in --dynamic-list, mark it.
1935
1936         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1937         (dynamic_list_2): New test case.
1938         * testsuite/Makefile.in: Regenerate.
1939         * testsuite/dynamic_list_2.cc: New file.
1940         * testsuite/dynamic_list_2.t: New file.
1941         * testsuite/dynamic_list_lib1.cc: New file.
1942         * testsuite/dynamic_list_lib2.cc: New file.
1943         * testsuite/gc_dynamic_list_test.c: New file.
1944         * testsuite/gc_dynamic_list_test.sh: New file.
1945         * testsuite/gc_dynamic_list_test.t: New file.
1946
1947 2014-01-28  Cary Coutant  <ccoutant@google.com>
1948
1949         Add .gdb_index version 7 support.
1950
1951         * gold/dwarf_reader.cc: include <utility> (for make_pair).
1952         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1953         debug sections.
1954         (Dwarf_ranges_table::read_ranges_table): Likewise.
1955         (Dwarf_pubnames_table::read_section): Check for GNU-style
1956         sections, and for compressed debug sections.
1957         (Dwarf_pubnames_table::read_header): Compute end address of table.
1958         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
1959         for end of list by offset, not by offset == 0.
1960         (Dwarf_info_reader::do_read_string_table): Check for compressed
1961         debug sections.
1962         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1963         Initialize new data members.
1964         (Dwarf_pubnames_table::next_name): return flag_byte.
1965         (Dwarf_pubnames_table::end_of_table_): New data member.
1966         (Dwarf_pubnames_table::is_gnu_style_): New data member.
1967         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1968         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1969         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1970         read skeleton type unit DIEs.
1971         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1972         (Gdb_index::do_write): Write flag_byte.
1973         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1974         (Gdb_index::Cu_vector): Store flags along with cu indexes.
1975         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1976         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1977
1978 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1979
1980         * version.cc (print_version): Update copyright year to 2014.
1981
1982 2013-12-19  Dimitry Andric  <dimitry@andric.com>
1983
1984         * stringpool.cc (Stringpool_template::reserve): Add
1985         HAVE_UNORDERED_MAP case.
1986         * stringpool.cc (Stringpool_template::print_stats): Likewise.
1987
1988 2013-12-18  Cary Coutant  <ccoutant@google.com>
1989
1990         * configure.ac: Check for <unordered_set> and <unordered_map>.
1991         * config.in: Regenerate.
1992         * configure: Regenerate.
1993         * system.h: Use <unordered_set> and <unordered_map> if available.
1994
1995 2013-12-10  Roland McGrath  <mcgrathr@google.com>
1996
1997         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1998         with $(INSTALL_PROGRAM_ENV).
1999         * Makefile.in: Regenerate.
2000
2001 2013-11-22  Cary Coutant  <ccoutant@google.com>
2002
2003         * configure.ac: Add check for which library is needed for
2004         dlopen.
2005         * configure: Regenerate.
2006
2007 2013-11-22  Cary Coutant  <ccoutant@google.com>
2008
2009         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2010         assembler.
2011         * testsuite/Makefile.in: Regenerate.
2012
2013 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2014
2015         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2016         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2017         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2018         (Target_x86_64<size>::Scan::local): Likewise.
2019         (Target_x86_64<size>::Scan::global): Likewise.
2020         (Target_x86_64<size>::Relocate::relocate): Likewise.
2021         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2022         Likewise.
2023         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2024         R_X86_64_PC32_BND.
2025
2026         * testsuite/Makefile.am (check_PROGRAMS): Add
2027         exception_x86_64_bnd_test.
2028         (exception_x86_64_bnd_test_SOURCES): New macro.
2029         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2030         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2031         (exception_x86_64_bnd_test_LDADD): Likewise.
2032         (exception_x86_64_bnd_1.o): New rule.
2033         (exception_x86_64_bnd_2.o): Likewise.
2034         * testsuite/Makefile.in: Regenerated.
2035
2036 2013-11-15  Alan Modra  <amodra@gmail.com>
2037
2038         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2039         accessor.
2040         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2041         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2042         symval_for_branch lookup to ELFv1.
2043         (Stub_table::add_plt_call_entry): Use unsigned int off.
2044         (Output_data_glink::Address, invalid_address): New.
2045         (Output_data_glink::add_eh_frame): Move out of line.  Add
2046         support for ELFv2.
2047         (Output_data_glink::add_global_entry, find_global_entry,
2048         global_entry_address): New functions.
2049         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2050         ge_size): New variables.
2051         (Output_data_glink::set_final_data_size): Add global entry
2052         stub sizing.
2053         (Output_data_glink::do_write): Write global entry stubs.
2054         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2055         parameter.  Return true for ELFv2.  Adjust callers.
2056         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2057         ELFv1.  Similarly for ifunc and dynamic relocation processing
2058         specific to ELFv1.  Recognize that symbols are defined on
2059         their plt entries for ELFv2.
2060         (Target_powerpc::symval_for_branch): Assert if called for
2061         ELFv2 or ppc32.
2062         (Target_powerpc::Relocate::relocate): Use global entry plt
2063         stub for symbol value if such exists on ELFv2.
2064         (Target_powerpc::Relocate::relocate): Don't call
2065         symval_for_branch when ELFv2.  Do adjust for local entry
2066         offset when ELFv2.
2067         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2068         plt stub for ELFv2.
2069         (Target_powerpc::do_plt_address_for_global): Similarly.
2070
2071 2013-11-14  Cary Coutant  <ccoutant@google.com>
2072
2073         Revert patch -- this did not fix the problem, and there is
2074         no race there.
2075
2076         2013-11-14  Cary Coutant  <ccoutant@google.com>
2077
2078             PR gold/14860
2079             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2080             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2081             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2082             updating fde_offsets_.
2083             (Eh_frame_hdr::lock_): New data member.
2084
2085 2013-11-14  Cary Coutant  <ccoutant@google.com>
2086
2087         * dwp.cc (Dwo_file_entry): New type.
2088         (File_list): Use Dwo_file_entry.
2089         (Dwo_file::verify): New function.
2090         (Dwo_file::verify_dwo_list): New function.
2091         (Dwo_file::sized_verify_dwo_list): New function.
2092         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2093         list.
2094         (Dwp_options): New enum type.
2095         (dwp_options): Add --verify-only.
2096         (usage): Likewise.
2097         (main): Likewise.
2098         * dwp.h (gold_info): Add declaration.
2099
2100 2013-11-14  Cary Coutant  <ccoutant@google.com>
2101
2102         PR gold/14860
2103         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2104         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2105         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2106         updating fde_offsets_.
2107         (Eh_frame_hdr::lock_): New data member.
2108
2109 2013-11-06  Cary Coutant  <ccoutant@google.com>
2110
2111         PR gold/15758
2112         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2113         before reloc sections.
2114
2115 2013-11-04  Alan Modra  <amodra@gmail.com>
2116
2117         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2118         (Symbol::needs_dynamic_reloc): Test new flag.
2119         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2120         (Target_powerpc::Scan::get_reference_flags): Add target param.
2121         Return FUNC_DESC_ABI for 64-bit ELFv1.
2122         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2123         call.
2124         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2125         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2126
2127 2013-10-31  Cary Coutant  <ccoutant@google.com>
2128
2129         Restore support for dwp v2 DWARF package file format.
2130
2131         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2132         tu_length parameter.  Adjust all callers.
2133         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2134         * dwp.cc: Include dwarf.h.
2135         (Section_bounds): New struct type.
2136         (Unit_set): New struct type.
2137         (Dwo_file::Dwo_file): Initialize new data member.
2138         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2139         Combine and rename to...
2140         (Dwo_file::read_unit_index): ...this.
2141         (Dwo_file::sized_read_compunit_index)
2142         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2143         (Dwo_file::sized_read_unit_index): ...this.
2144         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2145         parameters; add section_id parameter.
2146         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2147         (Dwo_file::add_unit_set): ...this.
2148         (Dwo_file::shndx_map_): Remove.
2149         (Dwo_file::sect_offsets_): New data member.
2150         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2151         (Dwp_output_file::add_section): Rename to...
2152         (Dwp_output_file::add_contribution): ...this.
2153         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2154         (Dwp_output_file::add_tu_set): Likewise.
2155         (Dwp_output_file::Contribution): New type.
2156         (Dwp_output_file::Section::contributions): New data member.
2157         (Dwp_output_file::Cu_or_tu_set): Remove.
2158         (Dwp_output_file::Section::Section): New ctor.
2159         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2160         (Dwp_output_file::Dwp_index::Section_table): New type.
2161         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2162         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2163         parameter.
2164         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2165         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2166         (Dwp_output_file::Dwp_index::section_table): New member function.
2167         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2168         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2169         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2170         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2171         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2172         (Dwp_output_file::Dwp_index::section_table_): New data member.
2173         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2174         (Dwp_output_file::add_output_section): New member function.
2175         (Dwp_output_file::write_new_section): New member function.
2176         (Dwp_output_file::write_contributions): New member function.
2177         (Dwp_output_file::section_id_map_): New data member.
2178         (class Dwo_id_info_reader): Remove.
2179         (class Unit_reader): New class.
2180         (get_dwarf_section_name): New function.
2181         (Dwo_file::read_executable): Adjust initializations of class data.
2182         (Dwo_file::read): Add support for v2 package file format.
2183         (Dwo_file::read_unit_index): Likewise.
2184         (Dwo_file::sized_read_unit_index): Likewise.
2185         (Dwo_file::copy_section): Likewise.
2186         (Dwo_file::add_unit_set): Likewise.
2187         (Dwp_output_file::add_output_section): Likewise.
2188         (Dwp_output_file::add_contribution): Likewise.
2189         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2190         for empty slot.
2191         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2192         file format.
2193         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2194         slot.
2195         (Dwp_output_file::initialize): Remove unused function.
2196         (Dwp_output_file::finalize): Add support for v2 package file format.
2197         (Dwp_output_file::write_index): Likewise.
2198         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2199         function prototype.
2200
2201 2013-10-31  Cary Coutant  <ccoutant@google.com>
2202
2203         * configure.ac: Fix check for -fmerge-constants.
2204         * configure.ac: Regenerate.
2205
2206 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2207
2208         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2209         Correct 9-byte nop sequence to match what the assembler generates.
2210
2211 2013-10-30  Alan Modra  <amodra@gmail.com>
2212
2213         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2214         ppc64_local_entry_offset, ppc64_local_entry_offset,
2215         do_read_symbols): New functions.
2216         (Powerpc_relobj::e_flags_, st_other_): New vars.
2217         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2218         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2219         (Powerpc_relobj::e_flags_): New var.
2220         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2221         and adjust for ELFv2.
2222         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2223         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2224         (Powerpc_dynobj::do_find_special_sections): Likewise.
2225         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2226         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2227         to ELFv2 local entry.
2228         (Target_powerpc::do_relax): No thread safe barriers needed for
2229         ELFv2.
2230         (Output_data_plt_powerpc::initial_plt_entry_size_,
2231         plt_entry_size): Delete.  Replace all uses with
2232         first_plt_entry_offset() and plt_entry_size().
2233         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2234         reserved_size parm.  Update callers.
2235         (Output_data_plt_powerpc::entry_count): Update.
2236         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2237         and use Target_powerpc::first_plt_entry_offset().
2238         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2239         rename to plt_entry_size.
2240         (Output_data_plt_powerpc::add_ifunc_entry,
2241         add_local_ifunc_entry): Adjust reloc for ELFv2.
2242         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2243         (glink_eh_frame_fde_64v2): New.
2244         (Stub_table::plt_call_size): Support ELFv2 sizing.
2245         (Output_data_glink::add_eh_frame): Use the new FDE.
2246         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2247         (Stub_table::do_write): Write ELFv2 stubs and glink.
2248         (Target_powerpc::Relocate::relocate): Replaces nop after call
2249         with ld 2,24(1) and adjust local offset destination for ELFv2.
2250
2251 2013-10-30  Alan Modra  <amodra@gmail.com>
2252
2253         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2254         (Target_powerpc::Scan::global, local): Likewise.
2255         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2256         on all ppc64 @h and @ha relocs.
2257
2258 2013-10-14  Alan Modra  <amodra@gmail.com>
2259
2260         * output.h (Output_data_got::add_constant): Tidy.
2261         (Output_data_got::add_constant_pair): New function.
2262         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2263         methods used so as to first call reserve_ent().
2264
2265 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2266
2267         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2268         add_got_entry and add_got_entry_pair.
2269
2270         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2271         (HAVE_PUBNAMES): Likewise.
2272         * configure: Regenerate.
2273
2274         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2275         * testsuite/Makefile.in: Regenerate.
2276
2277         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2278         Remove const from declaration.
2279         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2280         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2281         * output.h (Output_file_header): Remove const from member target_
2282         and corresponding constructor argument.
2283         * output.cc (Output_file_header::Output_file_header): Update prototype.
2284         (Output_file_header::do_sized_write): Use this->target_ in place
2285         of parameters()->target().
2286
2287         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2288
2289         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2290         * configure: Regenerate.
2291         * Makefile.in: Regenerate.
2292         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2293         * testsuite/merge_string_literals_2.c: Likewise.
2294         * testsuite/Makefile.am
2295         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2296         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2297         literal -fmerge-constants.
2298         * testsuite/Makefile.in: Regenerate.
2299
2300         * i386.cc (Target_i386): Remove unused member dynbss_.
2301         * arm.cc (Target_arm): Likewise.
2302         * powerpc.cc (Target_powerpc): Likewise.
2303         * sparc.cc (Target_sparc): Likewise.
2304         * tilegx.cc (Target_tilegx): Likewise.
2305         * x86_64.cc (Target_x86_64): Likewise.
2306         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2307         type_signature_, type_offset_.
2308         * plugin.h (Plugin_hook): Remove unused member layout_.
2309         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2310         mapfile_.
2311         (Read_member): Remove unused members input_objects_, symtab_,
2312         mapfile_, layout_.
2313         (Check_library): Remove unused member symtab_.
2314         * archive.h (Lib_group): Remove unused member lib_.
2315         * archive.cc (Lib_group::Lib_group): Update initializer.
2316         * incremental.h (Incremental_binary): Remove unused member target_.
2317         (Incremental_script_entry): Removed unused member script_.
2318         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2319         * icf.h (Icf): Remove unused member num_tracked_relocs.
2320
2321         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2322         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2323         its only use.
2324         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2325
2326         * archive.h: Use struct rather than class for forward declaration
2327         of Read_symbols_data.
2328
2329 2013-10-07  Cary Coutant  <ccoutant@google.com>
2330
2331         PR gold/16010
2332         * testsuite/Makefile.am (icf_test): Fix dependencies.
2333         (icf_safe_test): Likewise.
2334         (icf_safe_so_test): Likewise.
2335         (large_symbol_alignment): Add empty _LDADD rule.
2336         * testsuite/Makefile.in: Regenerate.
2337
2338 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2339
2340         PR gold/15927
2341         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2342         relocation for R_X86_64_32 on x32.
2343
2344 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2345
2346         * output.cc (Output_segment::set_section_addresses): Take new
2347         Target* argument.  If target->isolate_execinstr() and the segment
2348         is executable and starts at a target->abi_pagesize() boundary,
2349         pad its end out to a target->abi_pagesize() boundary with code fill.
2350         * output.h (Output_segment::set_section_addresses): Update decl.
2351         * layout.h (Layout::check_output_data_for_reset_values): Take new
2352         argument RELAX_OUTPUTS.
2353         (Layout): New member relax_output_list_.
2354         (Layout::add_relax_output): New method.
2355         * layout.cc (Layout::Layout): Update constructor.
2356         (Layout::reset_relax_output): New method.
2357         (Layout::clean_up_after_relaxation): Call it.
2358         (Layout::prepare_for_relaxation): Update caller.
2359         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2360         Call reset_relax_output before re-processing segments for
2361         isolate_execinstr case.
2362         (Layout::write_data): Handle relax_output_list_.
2363         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2364         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2365
2366 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2367
2368         PR binutils/15834
2369         * object.h: Fix typos.
2370
2371 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2372
2373         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2374         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2375
2376 2013-08-07  Cary Coutant  <ccoutant@google.com>
2377
2378         Revert support for v2 DWP files:
2379
2380         2013-03-01  Cary Coutant  <ccoutant@google.com>
2381
2382             Add dwp support for v2 DWARF package file format.
2383             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2384             tu_length parameter.  Adjust all callers.
2385             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2386             * dwp.cc: Include dwarf.h.
2387             (Section_bounds): New struct type.
2388             (Unit_set): New struct type.
2389             (Dwo_file::Dwo_file): Initialize new data member.
2390             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2391             Combine and rename to...
2392             (Dwo_file::read_unit_index): ...this.
2393             (Dwo_file::sized_read_compunit_index)
2394             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2395             (Dwo_file::sized_read_unit_index): ...this.
2396             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2397             parameters; add section_id parameter.
2398             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2399             (Dwo_file::add_unit_set): ...this.
2400             (Dwo_file::shndx_map_): Remove.
2401             (Dwo_file::sect_offsets_): New data member.
2402             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2403             (Dwp_output_file::add_section): Rename to...
2404             (Dwp_output_file::add_contribution): ...this.
2405             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2406             (Dwp_output_file::add_tu_set): Likewise.
2407             (Dwp_output_file::Contribution): New type.
2408             (Dwp_output_file::Section::contributions): New data member.
2409             (Dwp_output_file::Cu_or_tu_set): Remove.
2410             (Dwp_output_file::Section::Section): New ctor.
2411             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2412             (Dwp_output_file::Dwp_index::Section_table): New type.
2413             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2414             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2415             parameter.
2416             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2417             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2418             (Dwp_output_file::Dwp_index::section_table): New member function.
2419             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2420             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2421             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2422             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2423             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2424             (Dwp_output_file::Dwp_index::section_table_): New data member.
2425             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2426             (Dwp_output_file::add_output_section): New member function.
2427             (Dwp_output_file::write_new_section): New member function.
2428             (Dwp_output_file::write_contributions): New member function.
2429             (Dwp_output_file::section_id_map_): New data member.
2430             (class Dwo_id_info_reader): Remove.
2431             (class Unit_reader): New class.
2432             (get_dwarf_section_name): New function.
2433             (Dwo_file::read_executable): Adjust initializations of class data.
2434             (Dwo_file::read): Add support for v2 package file format.
2435             (Dwo_file::read_unit_index): Likewise.
2436             (Dwo_file::sized_read_unit_index): Likewise.
2437             (Dwo_file::copy_section): Likewise.
2438             (Dwo_file::add_unit_set): Likewise.
2439             (Dwp_output_file::add_output_section): Likewise.
2440             (Dwp_output_file::add_contribution): Likewise.
2441             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2442             for empty slot.
2443             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2444             file format.
2445             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2446             slot.
2447             (Dwp_output_file::initialize): Remove unused function.
2448             (Dwp_output_file::finalize): Add support for v2 package file format.
2449             (Dwp_output_file::write_index): Likewise.
2450             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2451             function prototype.
2452
2453 2013-07-31  Cary Coutant  <ccoutant@google.com>
2454
2455         * object.cc (Sized_relobj::do_output_section_address): New function.
2456         (Sized_relobj): Instantiate explicitly.
2457         * object.h (Object::output_section_address): New function.
2458         (Object::do_output_section_address): New function.
2459         (Sized_relobj::do_output_section_address): New function.
2460         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2461
2462 2013-07-30  Cary Coutant  <ccoutant@google.com>
2463             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2464
2465         * parameters.cc (Parameters::entry): Return target-specific entry
2466         symbol name.
2467         * target.h (Target::entry_symbol_name): New function.
2468         (Target_info::entry_symbol_name): New data member.
2469
2470         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2471         * i386.cc (Target_i386::i386_info): Likewise.
2472         (Target_i386_nacl::i386_nacl_info): Likewise.
2473         * sparc.cc (Target_sparc::sparc_info): Likewise.
2474         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2475         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2476         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2477         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2478
2479 2013-07-22  Sterling Augustine  <saugustine@google.com>
2480
2481         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2482         Convert parameter shndx to local variable. Add parameters symtab
2483         and symtab_size.  Scan over section names.  Find relocation
2484         section corresponding to current section.  Create and initialize
2485         reloc_mapper_ and reloc_type_.
2486         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2487         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2488         cu_offset_.
2489         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2490         Initialize new fields unit_length_ and cu_offset_.
2491         (Dwarf_pubnames_table::read_section): Update prototype.
2492         (Dwarf_pubnames_table::cu_offset): New member function.
2493         (Dwarf_pubnames_table::subsection_size): Likewise.
2494         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2495         New fields.
2496         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2497         member functions public.
2498         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2499         Update comment.  Rework logic.  Move repeated parts to...
2500         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2501         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2502         pubtypes_table_, and stmt_list_offset.
2503         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2504         Gdb_index::find_pubtype_offset,
2505         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2506         (Gdb_index::pubnames_read): Update prototype and rework logic.
2507         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2508         Forward declare.
2509         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2510         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2511         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2512         Gdb_index::map_pubtable_to_dies):
2513         Declare functions.
2514         (Gdb_index::pubnames_read): Update declaration.
2515         (Gdb_index::Pubname_offset_map): New type.
2516         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2517         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2518         Gdb_index::stmt_list_offset): Declare.
2519         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2520         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2521         Gdb_index::pubtypes_offset_): Remove.
2522
2523 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2524
2525         * options.h (General_options): Add -Trodata-segment option.
2526         * parameters.cc (Parameters::check_rodata_segment): New function.
2527         (Parameters::set_target_once): Call it.
2528         * parameters.h (Parameters): Declare it (private member function).
2529         * layout.cc (load_seg_unusable_for_headers): New function, broken
2530         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2531         then validate rodata segment rather than text segment.
2532         (relaxation_loop_body): Call that.
2533         (is_text_segment): New function.  Don't admit a non-executable
2534         segment if TARGET->isolate_execinstr().
2535         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2536
2537 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2538
2539         PR gold/15070
2540         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2541         * nacl.h (Sniff_file::View::View): Request aligned view.
2542
2543 2013-07-11  Cary Coutant  <ccoutant@google.com>
2544
2545         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2546         correct BRLT entry size.
2547
2548 2013-07-03  Alan Modra  <amodra@gmail.com>
2549
2550         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2551         comment.
2552
2553 2013-07-01  Cary Coutant  <ccoutant@google.com>
2554
2555         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2556         reloc_type_.
2557         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2558         (Dwarf_ranges_table::lookup_reloc): New function.
2559         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2560         reloc_type_.
2561         (Dwarf_ranges_table::lookup_reloc): New function.
2562         (Dwarf_ranges_table::reloc_type_): New data member.
2563
2564 2013-06-27  Jing Yu  <jingyu@google.com>
2565
2566         PR gold/15662
2567         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2568         function.
2569         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2570         (Target_powerpc::do_relax): Call the above.
2571
2572 2013-06-27  Cary Coutant  <ccoutant@google.com>
2573
2574         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2575         on garbage collected .opd section.
2576
2577 2013-06-27  Alan Modra  <amodra@gmail.com>
2578
2579         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2580         is non-zero.
2581         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2582         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2583
2584 2013-06-14  Cary Coutant  <ccoutant@google.com>
2585
2586         * resolve.cc (Symbol::override_base): Don't override st_type
2587         from plugin placeholder symbols.
2588         (Symbol_table::resolve): Likewise.
2589         (Symbol_table::should_override): Don't complain about TLS mismatch
2590         if the TO symbol is a plugin placeholder.
2591         * testsuite/Makefile.am (plugin_test_tls): New test.
2592         * testsuite/Makefile.in: Regenerate.
2593         * testsuite/plugin_test_tls.sh: New test script.
2594         * testsuite/two_file_test_2_tls.cc: New test source.
2595         * testsuite/two_file_test_tls.cc: New test source.
2596
2597 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2598
2599         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2600         the maximum segment alignment is larger than the page size.
2601         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2602         correctly aligns the symbols with large alignemnt.
2603         * testsuite/Makefile.in: Regenerate.
2604         * testsuite/large_symbol_alignment.cc: New file.
2605
2606 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2607             Sriraman Tallam  <tmsriram@google.com>
2608
2609         * options.h (sort_section): New option.
2610         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2611         Rename from Input_section_sort_section_name_special_ordering_compare.
2612         (Input_section_sort_section_name_compare): New struct.
2613         * output.cc (Output_section::Input_section_sort_section_name_compare::
2614         operator()): New function.
2615         (Output_section::sort_attached_input_sections): Use new sort function
2616         for .text if --sort-section=name is specified.
2617         * layout.cc (Layout::make_output_section):
2618         Add sorting by name when --sort-section=name is specified.
2619         * testsuite/Makefile.am (text_section_grouping): Test option
2620         --sort-section=name.
2621         * testsuite/Makefile.in: Regenerate.
2622         * testsuite/section_sorting_name.cc: New file.
2623         * testsuite/section_sorting_name.sh: New file.
2624
2625 2013-05-21  Cary Coutant  <ccoutant@google.com>
2626
2627         * symtab.h (Symbol::is_cxx_vtable): New function.
2628         * target-reloc.h (relocate_section): Check for vtable symbol.
2629         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2630         * testsuite/Makefile.in: Regenerate.
2631         * testsuite/missing_key_func.cc: New test source.
2632         * testsuite/missing_key_func.sh: New test script.
2633
2634 2013-05-21  Cary Coutant  <ccoutant@google.com>
2635
2636         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2637         type of enclosing symbol.
2638         (Relocate_info::location): Check symbol type when describing symbol.
2639         * object.h (Symbol_location_info): Remove unused line_number;
2640         add enclosing_symbol_type.
2641         * testsuite/debug_msg.sh: Adjust expected output.
2642
2643 2013-05-13  Cary Coutant  <ccoutant@google.com>
2644
2645         * configure.ac: Export DEFAULT_TARGET.
2646         * configure: Regenerate.
2647         * Makefile.in: Regenerate.
2648         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2649         * testsuite/Makefile.in: Regenerate.
2650         * testsuite/debug_msg.sh: Delete duplicate tests.
2651         Don't check undef_int error message match for powerpc where the
2652         source file and line number aren't available.
2653
2654 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2655
2656         * options.h (General_options): Add --rosegment-gap option.
2657         * options.cc (finalize): --rosegment-gap implies --rosegment.
2658         * layout.cc (set_segment_offsets): Let user option override
2659         target->rosegment_gap().
2660
2661 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2662
2663         * options.h (General_options): Remove leading space from help
2664         messages for -nostdlib and --rosegment.
2665
2666 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2667
2668         PR ld/15365
2669         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2670
2671 2013-05-03  Alan Modra  <amodra@gmail.com>
2672
2673         * merge.cc (Output_merge_string::do_add_input_section): Correct
2674         scan for number of strings.  Rename vars to avoid shadowing.
2675         Include missing terminator in input_size_.
2676
2677 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2678
2679         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2680         Restore empty string handling.
2681
2682 2013-05-01  Cary Coutant  <ccoutant@google.com>
2683
2684         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2685         uninitialized warning.
2686
2687 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2688
2689         * output.cc (Output_section::add_merge_input_section): Allow
2690         to merge sections if the alignment is more than character size.
2691         * merge.h (Output_merge_string::Output_merge_string): Remove
2692         assert.
2693         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2694         only not-null strings. Check the alignment of strings.
2695         * stringpool.h
2696         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2697         alignment as the argument.
2698         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2699         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2700         Align non-zero length strings according to the addralign_.
2701         (Stringpool_template<Stringpool_char>::set_string_offsets):
2702         Updating offsets according to the given alignment.
2703         * testsuite/Makefile.am (text_section_grouping): Test if string
2704         literals are getting merged.
2705         * testsuite/Makefile.in: Regenerate.
2706         * testsuite/merge_string_literals_1.c: New file.
2707         * testsuite/merge_string_literals_2.c: Ditto.
2708         * testsuite/merge_string_literals.sh: Ditto.
2709
2710 2013-04-26  Ian Lance Taylor  <iant@google.com>
2711
2712         * target-reloc.h (relocate_section): If the reloc offset is out of
2713         range, pass VIEW as NULL to relocate.relocate.
2714         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2715         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2716         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2717         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2718         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2719         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2720
2721 2013-04-26  Geoff Pike  <gpike@chromium.org>
2722
2723         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2724         * layout.cc (Hash_task): New class.
2725         (Layout::queue_build_id_tasks): New function.
2726         (Layout::write_build_id): Handle single-thread portion of build ID
2727         computation.  (In some cases, all of it is single-threaded.)  Replace
2728         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2729         functionality in fewer lines of code.
2730         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2731         * options.h (General_options): make "--build-id" default to tree
2732         rather than sha1.  Add two new options related to --build-id=tree:
2733         --build-id-chunk-size-for-treehash and
2734         --build-id-min-file-size-for-treehash.
2735         * Makefile.am: add testing of --build-id=tree and related new options
2736         (these tests will be invoked by "make check").
2737         * Makefile.in: Regenerate.
2738
2739 2013-04-25  Alan Modra  <amodra@gmail.com>
2740
2741         * configure.tgt: Add powerpcle and powerpc64le.
2742
2743 2013-04-22  Alan Modra  <amodra@gmail.com>
2744
2745         PR gold/15355
2746         * layout.cc (Layout::segment_precedes): Allow more than one
2747         segment with the same type and flags.
2748
2749 2013-04-15  Cary Coutant  <ccoutant@google.com>
2750
2751         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2752         allocate space in file for BSS sections.
2753
2754 2013-04-15  Cary Coutant  <ccoutant@google.com>
2755
2756         * script-sections.cc (Orphan_output_section): Reset address
2757         to zero after each orphaned section for relocatable links.
2758
2759 2013-04-15  Cary Coutant  <ccoutant@google.com>
2760
2761         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2762         section starting address for relocatable link.
2763         * testsuite/Makefile.am (script_test_11): New test.
2764         * testsuite/Makefile.in: Regenerate.
2765         * testsuite/script_test_11.c: New source file.
2766         * testsuite/script_test_11.t: New linker script.
2767
2768 2013-04-13  Alan Modra  <amodra@gmail.com>
2769
2770         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2771         owner when sections are not adjacent and exceed group size.
2772         (Target_powerpc::group_sections): Handle corner case.
2773         (Target_powerpc::Branch_info::make_stub): Handle case where
2774         stub table doesn't exist due to branches in non-exec sections.
2775         (Target_powerpc::Relocate::relocate): Likewise.
2776
2777 2013-04-11  Alan Modra  <amodra@gmail.com>
2778
2779         PR gold/15354
2780         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2781         .branch_lt to match bfd ld.  Adjust comments throughout file.
2782
2783 2013-04-04  Ian Lance Taylor  <iant@google.com>
2784
2785         GCC PR c++/56840
2786         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2787         sections before checking whether they are included in the link.
2788
2789 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2790
2791         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2792         object before calling the plugin claim_file handler.  Pass the elf
2793         object of the archive to the plugin. Delete the elf object if the
2794         plugin claims the file.
2795
2796 2013-03-21  Alan Modra  <amodra@gmail.com>
2797
2798         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2799         segment when omagic.
2800
2801 2013-03-21  Alan Modra  <amodra@gmail.com>
2802
2803         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2804         comparison warning.
2805         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2806         uninitialized" warning.
2807
2808 2013-03-20  Alan Modra  <amodra@gmail.com>
2809
2810         * symtab.h (Symbol::clear_version): New function.
2811         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2812         is_needed by weak references.  Clear version for symbols defined
2813         in as-needed objects that are not needed.
2814
2815 2013-03-15  Alan Modra  <amodra@gmail.com>
2816
2817         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2818         static and public.  Add report_err param.  Return false for data refs.
2819         (Target_powerpc::rela_dyn_section): New overloaded function.
2820         (Target_powerpc::plt_, iplt_): Elucidate.
2821         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2822         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2823         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2824         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2825         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2826         push_branch and make_plt_entry for ifunc syms when
2827         reloc_needs_plt_for_ifunc.
2828         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2829         for ifunc unless reloc_needs_plt_for_ifunc.
2830
2831 2013-03-15  Alan Modra  <amodra@gmail.com>
2832
2833         * gc.h (gc_process_relocs): Don't look through function descriptors.
2834         * icf.cc (get_section_contents): Do so here instead.
2835
2836 2013-03-13  Alan Modra  <amodra@gmail.com>
2837
2838         * powerpc.cc (is_branch_reloc): Forward declare.
2839         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2840         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2841         false for 64-bit, true for 32-bit non-branch relocs.
2842         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2843         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2844         nm output.
2845         (icf_safe_test): Generate linker map file as well as nm output.
2846         (icf_safe_so_test): Likewise.
2847         * testsuite/Makefile.in: Regenerate.
2848         * testsuite/icf_test.sh: Parse linker map file to determine
2849         section folding.
2850         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2851         * testsuite/icf_safe_so_test.sh: Likewise.
2852         (X86_32_or_ARM_specific_safe_fold): Merge into..
2853         (arch_specific_safe_fold): ..this.
2854         (X86_64_specific_safe_fold): Delete unused function.
2855
2856 2013-03-12  Alan Modra  <amodra@gmail.com>
2857
2858         * gc.h (gc_process_relocs): Look through function descriptors
2859         to determine shndx, symvalue and addend used by ICF.  Tidy
2860         variable duplication.
2861
2862 2013-03-11  Alan Modra  <amodra@gmail.com>
2863
2864         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2865         * layout.cc (Layout_task_runner::run): ..to here.
2866         * symtab.h (struct Symbol_location): Extract from..
2867         (class Symbol_table): ..here.
2868         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2869         * target.h (class Target): Add function_location and
2870         do_function_location functions.
2871         (class Sized_target): Add do_function_location.
2872         * object.h (class Sized_relobj_file): Move find_shdr..
2873         (class Object): ..to here.
2874         * object.cc: Likewise.  Update to suit.  Instantiate.
2875         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2876         * powerpc.cc (class Powerpc_dynobj): New.
2877         (Target_powerpc::do_function_location): New function.
2878         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2879         (Powerpc_dynobj::do_read_symbols): New function.
2880         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2881
2882 2013-03-08  Ian Lance Taylor  <iant@google.com>
2883
2884         * options.cc (General_options::string_to_object_format): Accept
2885         "default".
2886
2887 2013-03-08  Alan Modra  <amodra@gmail.com>
2888
2889         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2890         pointer to Post_fde.
2891         (struct Post_fde): Move definition to here..
2892         * ehframe.cc (struct Post_fde): ..from here.
2893         (Cie::write): Don't alloc Post_fde.
2894         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2895
2896 2013-03-07  Alan Modra  <amodra@gmail.com>
2897
2898         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2899         relocation referencing .LC0.
2900         * testsuite/discard_locals_test.sh: Remove FIXMEs.
2901
2902 2013-03-07  Alan Modra  <amodra@gmail.com>
2903
2904         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2905         always_inline.  Add assembly for powerpc to avoid GOT.
2906
2907 2013-03-07  Alan Modra  <amodra@gmail.com>
2908
2909         * testsuite/script_test_10.sh: Don't test .bss section
2910         header number.
2911
2912 2013-03-06  Alan Modra  <amodra@gmail.com>
2913
2914         * powerpc.cc (class Powerpc_relobj): Move some member functions.
2915         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
2916         all callers.  Handle folded sections.
2917         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2918         to Powerpc_relobj.
2919         (Global_symbol_visitor_opd::operator()): Likewise.
2920
2921 2013-03-04  Alan Modra  <amodra@gmail.com>
2922
2923         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2924         * testsuite/Makefile.in: Regenerate.
2925
2926 2013-03-01  Cary Coutant  <ccoutant@google.com>
2927
2928         Add dwp support for v2 DWARF package file format.
2929         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2930         tu_length parameter.  Adjust all callers.
2931         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2932         * dwp.cc: Include dwarf.h.
2933         (Section_bounds): New struct type.
2934         (Unit_set): New struct type.
2935         (Dwo_file::Dwo_file): Initialize new data member.
2936         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2937         Combine and rename to...
2938         (Dwo_file::read_unit_index): ...this.
2939         (Dwo_file::sized_read_compunit_index)
2940         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2941         (Dwo_file::sized_read_unit_index): ...this.
2942         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2943         parameters; add section_id parameter.
2944         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2945         (Dwo_file::add_unit_set): ...this.
2946         (Dwo_file::shndx_map_): Remove.
2947         (Dwo_file::sect_offsets_): New data member.
2948         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2949         (Dwp_output_file::add_section): Rename to...
2950         (Dwp_output_file::add_contribution): ...this.
2951         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2952         (Dwp_output_file::add_tu_set): Likewise.
2953         (Dwp_output_file::Contribution): New type.
2954         (Dwp_output_file::Section::contributions): New data member.
2955         (Dwp_output_file::Cu_or_tu_set): Remove.
2956         (Dwp_output_file::Section::Section): New ctor.
2957         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2958         (Dwp_output_file::Dwp_index::Section_table): New type.
2959         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2960         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2961         parameter.
2962         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2963         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2964         (Dwp_output_file::Dwp_index::section_table): New member function.
2965         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2966         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2967         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2968         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2969         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2970         (Dwp_output_file::Dwp_index::section_table_): New data member.
2971         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2972         (Dwp_output_file::add_output_section): New member function.
2973         (Dwp_output_file::write_new_section): New member function.
2974         (Dwp_output_file::write_contributions): New member function.
2975         (Dwp_output_file::section_id_map_): New data member.
2976         (class Dwo_id_info_reader): Remove.
2977         (class Unit_reader): New class.
2978         (get_dwarf_section_name): New function.
2979         (Dwo_file::read_executable): Adjust initializations of class data.
2980         (Dwo_file::read): Add support for v2 package file format.
2981         (Dwo_file::read_unit_index): Likewise.
2982         (Dwo_file::sized_read_unit_index): Likewise.
2983         (Dwo_file::copy_section): Likewise.
2984         (Dwo_file::add_unit_set): Likewise.
2985         (Dwp_output_file::add_output_section): Likewise.
2986         (Dwp_output_file::add_contribution): Likewise.
2987         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2988         for empty slot.
2989         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2990         file format.
2991         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2992         slot.
2993         (Dwp_output_file::initialize): Remove unused function.
2994         (Dwp_output_file::finalize): Add support for v2 package file format.
2995         (Dwp_output_file::write_index): Likewise.
2996         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2997         function prototype.
2998
2999 2013-03-01  Cary Coutant  <ccoutant@google.com>
3000
3001         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3002         function into class definition in header file.
3003         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3004         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3005         New function.
3006         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3007
3008 2013-02-28  Alan Modra  <amodra@gmail.com>
3009
3010         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3011         * target.cc (Target::do_plt_fde_location): New function.
3012         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3013         accessor function, and constructor param.
3014         (struct Post_fde, Post_fdes): Declare.
3015         (Cie::write): Add post_fdes param.
3016         * ehframe.cc (Fde::write): Use plt_fde_location.
3017         (struct Post_fde): Define.
3018         (Cie::write): Stash FDEs added post merge mapping.
3019         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3020         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3021         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3022         other FDEs.
3023         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3024         (Target_powerpc::has_glink): New function.
3025         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3026         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3027         glink_eh_frame_fde_32, default_fde): New data.
3028         (Stub_table::eh_frame_added_): New var.
3029         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3030         Make const.
3031         (Stub_table::add_eh_frame): New function.
3032         (Output_data_glink::add_eh_frame): New function.
3033         (Target_powerpc::make_glink_section): Call add_eh_frame.
3034
3035 2013-02-15  Ian Lance Taylor  <iant@google.com>
3036
3037         * options.h (DEFINE_uint64_alias): Define.
3038         (class General_options): Add -Ttext-segment as an alias for
3039         -Ttext.
3040
3041 2013-02-15  Alan Modra  <amodra@gmail.com>
3042
3043         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3044         (Stub_table::do_write): ..here, two places.
3045         (Stub_table::plt_call_size): Use it here too.
3046
3047 2013-02-11  Ian Lance Taylor  <iant@google.com>
3048
3049         * descriptors.cc (Descriptors::close_all): New function.
3050         * descriptors.h (class Descriptors): Declare close_all.
3051         (close_all_descriptors): New inline function.
3052         * plugin.cc: Include "descriptors.h".
3053         (Plugin_manager::cleanup): Call close_all_descriptors.
3054
3055 2013-02-06  Alan Modra  <amodra@gmail.com>
3056
3057         * README: Update coding style link.
3058
3059 2013-01-28  Cary Coutant  <ccoutant@google.com>
3060
3061         * dwp.cc (File_list): New typedef.
3062         (Dwo_name_info_reader): New class.
3063         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3064         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3065         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3066         (Dwo_file::read_executable): New function.
3067         (Dwo_file::read): Move common setup code to ...
3068         (Dwo_file::make_object): ... here.
3069         (dwp_options): Add --exec/-e.
3070         (usage): Likewise.
3071         (main): Likewise.
3072
3073 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3074
3075         * layout.cc (Layout::layout): Check for option text_reorder.
3076         (Layout::make_output_section): Ditto.
3077         * options.h (text_reorder): New option.
3078         * output.cc (Input_section_sort_compare): Remove special ordering
3079         of section names.
3080         (Output_section::
3081          Input_section_sort_section_name_special_ordering_compare::
3082          operator()): New function.
3083         (Output_section::sort_attached_input_sections): Use new sort function
3084         for .text.
3085         * output.h (Input_section_sort_section_name_special_ordering_compare):
3086         New struct.
3087         * testsuite/Makefile.am (text_section_grouping): Test option
3088         --no-text-reorder
3089         * testsuite/Makefile.in: Regenerate.
3090         * testsuite/text_section_grouping.sh: Check order of functions without
3091         default text reordering.
3092
3093 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3094
3095         * options.h (General_options): Change default to true for new_dtags.
3096
3097 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3098
3099         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3100         when enable_new_dtags is false.  Only add DT_RUNPATH when
3101         enable_new_dtags is true.
3102
3103 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3104
3105         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3106         used in declaration and definition consistent.
3107         (Target_powerpc::symval_for_branch): Ditto.
3108
3109 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3110
3111         * testsuite/plugin_final_layout.cc: Fix comment.
3112
3113 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3114
3115         * layout.cc (Layout::layout): Do not do default sorting for
3116         text sections when section ordering is specified.
3117         (make_output_section): Ditto.
3118         * testsuite/plugin_final_layout.cc: Name the function sections
3119         to catch reordering issues.
3120
3121 2013-01-15  Alan Modra  <amodra@gmail.com>
3122
3123         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3124         plt-thread-safe.
3125
3126 2013-01-15  Alan Modra  <amodra@gmail.com>
3127
3128         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3129         * testsuite/Makefile.in: Regenerate.
3130
3131 2013-01-14  Alan Modra  <amodra@gmail.com>
3132
3133         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3134         * testsuite/Makefile.in: Regenerate.
3135
3136 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3137
3138         PR bfd/14430
3139         Fix mingw gold build with plugins enabled
3140         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3141         * configure.ac: Export DLOPEN_LIBS and add headers check.
3142         * plugin.cc: Handle non-dlfcn case.
3143         * Makefile.in: Regenerate.
3144         * config.in: Regenerate.
3145         * configure: Regenerate.
3146         * testsuite/Makefile.in: Regenerate.
3147
3148 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3149
3150         * output.h (sort_attached_input_sections): Change to be public.
3151         * script-sections.cc
3152         (Output_section_definition::set_section_addresses): Sort
3153         attached input sections according to section order before linker
3154         script assigns section addresses.
3155         (Orphan_output_section::set_section_addresses): Sort
3156         attached input sections according to section order before linker
3157         script assigns section addresses.
3158         * Makefile.am (final_layout.sh): Use a simple linker script to
3159         check if section ordering still works.
3160         * Makefile.in: Regenerate.
3161
3162 2013-01-09  Ben Cheng  <bccheng@google.com>
3163
3164         * arm.cc (Target_arm::attributes_accept_div): New function.
3165         (Target_arm::attributes_forbid_div): New function.
3166         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3167         attribute using the same new functions as what bfd/elf32_arm.c
3168         does.
3169
3170 2013-01-07  Cary Coutant  <ccoutant@google.com>
3171
3172         PR gold/14993
3173         * output.cc (Output_section::add_input_section): For incremental
3174         updates, don't track input sections that are allocated from patch
3175         space.
3176
3177 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3178             Ian Lance Taylor  <iant@google.com>
3179
3180         PR gold/14897
3181         * configure.ac (--enable-ld): Removed.
3182         (install_as_default): Set to yes only for --enable-gold=default
3183         or --disable-ld.
3184         * configure: Regenerated.
3185
3186 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3187
3188         * options.h (General_options): Add -fuse-ld= for GCC linker
3189         option compatibility.
3190
3191 2013-01-04  Cary Coutant  <ccoutant@google.com>
3192
3193         * configure.ac: Fix typo restoring CXXFLAGS.
3194         * configure: Regenerate.
3195
3196 2013-01-04  Cary Coutant  <ccoutant@google.com>
3197
3198         * testsuite/Makefile.am (CXXLINK_S): New macro.
3199         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3200         * testsuite/Makefile.in: Regenerate.
3201
3202 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3203
3204         * version.cc (print_version): Update copyright year to 2013.
3205
3206 2012-12-20  Ian Lance Taylor  <iant@google.com>
3207
3208         * layout.cc (Layout::special_ordering_of_input_section): New
3209         function.
3210         (Layout::layout): If input section requires special ordering, must
3211         sort input sections.
3212         (Layout::make_output_section): May sort .text input sections.
3213         (Layout::is_section_name_prefix_grouped): Remove.
3214         * layout.h (class Layout): Declare
3215         special_ordering_of_input_section.  Don't declare
3216         is_section_name_prefix_grouped.
3217         * output.cc (Output_section::add_input_section): Revert last
3218         change.
3219         (Output_section::Input_section_sort::match_file_name): Don't crash
3220         if called on output section data.
3221         (Output_section::Input_section_sort_compare): Sort based on
3222         special ordering.
3223         (Output_section::Input_section_sort_section_order_index_compare):
3224         Revert last patch.
3225         (Output_section::sort_attached_input_sections): Likewise.
3226
3227 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3228
3229         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3230         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3231         * output.cc (Output_section::add_input_section): Check if section
3232         name contains special prefix.  Keep input sections to sort such
3233         sections.
3234         (Output_section::Input_section_sort_section_order_index_compare
3235          ::operator()): Group sections according to prefixes.
3236         (Output_section::sort_attached_input_sections): Add condition to
3237         Input_section_entry constructor call.
3238         * testsuite/Makefile.am (text_section_grouping): New test.
3239         * testsuite/Makefile.in: Regenerate.
3240         * testsuite/text_section_grouping.cc: New file.
3241         * testsuite/text_section_grouping.sh: New file.
3242
3243 2012-12-17  Nick Clifton  <nickc@redhat.com>
3244
3245         * Makefile.am: Add copyright notice.
3246         * NEWS: Likewise.
3247         * README: Likewise.
3248         * configure.ac: Likewise.
3249         * ftruncate.c: Likewise.
3250         * Makefile.in: Regenerate.
3251
3252 2012-12-14  Cary Coutant  <ccoutant@google.com>
3253
3254         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3255         --no-as-needed flag.
3256         (exception_separate_shared_12_test): Likewise.
3257         (incremental_copy_test): Likewise.
3258         * testsuite/Makefile.in: Regenerate.
3259
3260 2012-12-14  Cary Coutant  <ccoutant@google.com>
3261
3262         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3263         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3264
3265 2012-12-12  Alan Modra  <amodra@gmail.com>
3266
3267         * powerpc.cc (class Track_tls): New.
3268         (class Relocate, class Scan): Inherit Track_tls.
3269         (Target_powerpc::Scan::local, global): Track tls optimization
3270         and avoid creating plt entry for __tls_get_addr if all uses
3271         are optimized away.
3272         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3273
3274 2012-12-12  Alan Modra  <amodra@gmail.com>
3275
3276         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3277         Replace no_toc_optimize with toc_optimize.
3278         * output.h (Output_section::input_sections): Provide non-const variant.
3279         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3280         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3281         accessors.
3282         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3283         (class Sort_toc_sections): New.
3284         (Target_powerpc::do_finalize_sections): Sort toc sections.
3285         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3286
3287 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3288
3289         * testsuite/binary_unittest.cc (read_all): New function.
3290         (Sized_binary_test): Use it instead of ::read.
3291         * fileread.cc (do_read): Don't assume pread always reads the whole
3292         amount in a single call.
3293
3294 2012-12-10  Alan Modra  <amodra@gmail.com>
3295
3296         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3297         Set EM_PPC64 or EM_PPC here.
3298         (Target_selector_powerpc::do_recognize): Delete.
3299
3300 2012-12-10  Alan Modra  <amodra@gmail.com>
3301
3302         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3303         stub_table_.
3304         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3305
3306 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3307
3308         * testsuite/binary_unittest.cc (Sized_binary_test):
3309         Use open_descriptor rather than ::open.
3310
3311 2012-12-07  Alan Modra  <amodra@gmail.com>
3312
3313         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3314         typedef and invalid_address constant.
3315         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3316         instantiate constants.
3317
3318 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3319
3320         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3321         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3322         * aclocal.m4: Regenerate.
3323         * configure: Regenerate.
3324         * Makefile.in: Regenerate.
3325         * testsuite/Makefile.in: Regenerate.
3326
3327 2012-12-07  Alan Modra  <amodra@gmail.com>
3328
3329         * options.h (General_options): Add no_toc_optimize.
3330         * powerpc.cc (ok_lo_toc_insn): New function.
3331         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3332
3333 2012-12-06  Alan Modra  <amodra@gmail.com>
3334
3335         * options.h (General_options): Add plt_align, plt_static_chain,
3336         plt_thread_safe.  Update stub_group_size help text.
3337         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3338         for new plt_thread_safe_ var.
3339         (use_plt_offset): Correct comments.
3340         (Target_powerpc::do_relax): Look for thread creation symbols to
3341         determine default plt_thread_safe value.  Clear plt call stubs
3342         as well as branch stubs each iteration.
3343         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3344         insn constants.
3345         (l, hi, ha, write_insn): Move earlier.
3346         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3347         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3348         plt stubs too.
3349         (Stub_table::update_size): Adjust.
3350         (Stub_table::prev_size, set_prev_size): Delete.
3351         (Stub_table::stub_align): Let --plt-align affect result.
3352         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3353         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3354         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3355         (Stub_table::do_write): Support more stub variants.
3356
3357 2012-12-04  Alan Modra  <amodra@gmail.com>
3358
3359         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3360         (Target_powerpc::do_define_standard_symbols): New function.
3361
3362 2012-12-03  Alan Modra  <amodra@gmail.com>
3363
3364         * output.h: Formatting, whitespace.
3365
3366 2012-12-03  Alan Modra  <amodra@gmail.com>
3367
3368         * layout.h (Layout::get_executable_sections): Declare.
3369         * layout.cc (Layout::get_executable_sections): New function.
3370         * arm.cc (Target_arm::group_sections): Use it.
3371         (Arm_output_section::group_sections): Delete now redundant test.
3372         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3373         param to handle relative relocs.
3374         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3375         (Output_data_reloc::add_absolute): Adjust.
3376         (Output_data_reloc::add_relative): New function.
3377         (Output_data::reset_data_size): New function.
3378         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3379         (Output_section::set_addralign): New function.
3380         (Output_section::checkpoint_set_addralign): New function.
3381         (Output_section::clear_section_offsets_need_adjustment): New function.
3382         (Output_section::input_sections): Make public.
3383         * powerpc.cc (class Output_data_brlt_powerpc): New.
3384         (class Stub_table, class Stub_control): New.
3385         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3386         stub_table_, set_stub_table, stub_table): New vectors and accessor
3387         functions.
3388         (Target_powerpc::do_may_relax, do_relax, push_branch,
3389         new_stub_table, stub_tables, brlt_section, group_sections,
3390         add_branch_lookup_table, find_branch_lookup_table,
3391         write_branch_lookup_table, make_brlt_section): New functions.
3392         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3393         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3394         branch_info_): New vars.
3395         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3396         make call stubs here.
3397         (Output_data_glink): Remove all call stub handling from this class.
3398         (Target_powerpc::Scan::local, global): Save interesting branch
3399         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3400         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3401         functions on final link.
3402         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3403         Handle long branch destinations too.
3404         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3405         do_plt_address_for_local): Adjust lookup of plt call stubs.
3406
3407 2012-11-30  Alan Modra  <amodra@gmail.com>
3408
3409         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3410         relocs against protected symbols when building 32-bit shared libs.
3411
3412 2012-11-30  Alan Modra  <amodra@gmail.com>
3413
3414         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3415         param.  Call got_section() to make .got.  Update all callers
3416         and their callers and so on.
3417
3418 2012-11-30  Alan Modra  <amodra@gmail.com>
3419
3420         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3421         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3422         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3423         value if it already exists.
3424
3425 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3426
3427         PR gold/14858
3428         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3429
3430 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3431
3432         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3433         than bfc instruction for data sandboxing.
3434
3435 2012-11-08  Alan Modra  <amodra@gmail.com>
3436
3437         * po/POTFILES.in: Regenerate.
3438
3439 2012-11-05  Alan Modra  <amodra@gmail.com>
3440
3441         * configure.ac: Apply 2012-09-10 change to config.in here.
3442         * configure: Regenerate.
3443
3444 2012-11-05  Alan Modra  <amodra@gmail.com>
3445
3446         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3447         (struct Opd_ent): Use "Address" rather than "Offset".
3448         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3449         (Target_powerpc::got_section): Make public.
3450         (Target_powerpc::scan_relocs): Move code setting symbols..
3451         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3452         Create _SDA_BASE_ only when referenced.
3453
3454 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3455
3456         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3457         from last change.
3458
3459 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3460
3461         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3462         for offset_in_output_section parameter.
3463         (Sized_target::relocate_special_relocatable): Likewise.
3464         * arm.cc (Target_arm::relocate_relocs): Likewise.
3465         (Target_arm::relocate_special_relocatable): Likewise.
3466         * i386.cc (Target_i386::relocate_relocs): Likewise.
3467         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3468         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3469         * target-reloc.h (relocate_relocs): Likewise.
3470         * testsuite/testfile.cc (Target_test): Likewise.
3471         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3472         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3473
3474         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3475         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3476
3477         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3478         parameter, which is unused in the [!F_SETFD] case.
3479
3480         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3481         SYMNDX to off_t before comparing it to this->data_size().
3482         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3483         * incremental.cc (Output_section_incremental_inputs::do_write):
3484         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3485
3486         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3487
3488 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3489
3490         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3491         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3492         in EABI_VER5.
3493
3494 2012-10-29  Cary Coutant  <ccoutant@google.com>
3495
3496         * dwp.cc (usage): Add file and exit status parameters;
3497         add --help and --version options.
3498         (print_version): New function.
3499         (main): Add --help and --version options.
3500
3501 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3502
3503         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3504         final_layout_sequence.txt.
3505         * testsuite/Makefile.in: Regenerated.
3506
3507 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3508
3509         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3510         COMPILE generated by automake.
3511         (LINK1): Likewise.
3512         (CXXCOMPILE1): Likewise.
3513         (CXXLINK1): Likewise.
3514         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3515         (LINK): Likewise.
3516         (CXXCOMPILE): Likewise.
3517         (CXXLINK): Likewise.
3518         * testsuite/Makefile.in: Regenerated.
3519
3520 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3521
3522         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3523         on bad fwrite return.
3524
3525 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3526
3527         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3528         on val.
3529
3530 2012-10-23  Cary Coutant  <ccoutant@google.com>
3531
3532         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3533         * testsuite/Makefile.in: Regenerate.
3534         * testsuite/dwp_test.h: New source file.
3535         * testsuite/dwp_test_1.cc: New source file.
3536         * testsuite/dwp_test_1.s: New source file.
3537         * testsuite/dwp_test_1.sh: New source file.
3538         * testsuite/dwp_test_1b.cc: New source file.
3539         * testsuite/dwp_test_1b.s: New source file.
3540         * testsuite/dwp_test_2.cc: New source file.
3541         * testsuite/dwp_test_2.s: New source file.
3542         * testsuite/dwp_test_2.sh: New source file.
3543         * testsuite/dwp_test_main.cc: New source file.
3544         * testsuite/dwp_test_main.s: New source file.
3545
3546 2012-10-23  Cary Coutant  <ccoutant@google.com>
3547
3548         * dwp.h: New header file.
3549         * dwp.cc: New source file.
3550         * gold.h: Move shared declarations to system.h.
3551         * system.h: New header file.
3552         * Makefile.am: Add dwp.
3553         * Makefile.in: Regenerate.
3554
3555 2012-10-23  Cary Coutant  <ccoutant@google.com>
3556
3557         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3558         Dwarf_info_reader::read_from_pointer.
3559         (Dwarf_pubnames_table::read_header): Likewise.
3560         (Dwarf_pubnames_table::next_name): Likewise.
3561         (Dwarf_die::read_attributes): Likewise.
3562         (Dwarf_die::skip_attributes): Likewise.
3563         (Dwarf_info_reader::read_from_pointer): New function template.
3564         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3565         (Dwarf_pubnames_table): Likewise.
3566         (Dwarf_info_reader::read_from_pointer): New function template.
3567         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3568         Dwarf_pubnames_table ctor.
3569
3570 2012-10-23  Cary Coutant  <ccoutant@google.com>
3571
3572         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3573         abbrev_shndx.
3574         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3575         abbrev_shndx_.
3576         (Dwarf_info_reader::set_abbrev_shndx): New method.
3577         (Dwarf_info_reader::abbrev_shndx_): New data member.
3578
3579 2012-10-23  Cary Coutant  <ccoutant@google.com>
3580
3581         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3582         from object, not parameters.
3583         (Dwarf_info_reader::parse): Likewise.
3584         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3585         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3586         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3587         methods.
3588
3589 2012-10-23  Cary Coutant  <ccoutant@google.com>
3590
3591         * fileread.cc (Input_file::Input_file): New constructor.
3592         * fileread.h (class Input_file): Add new constructor.
3593
3594 2012-10-18  Alan Modra  <amodra@gmail.com>
3595
3596         PR gold/14727
3597         * object.cc (Relobj::is_section_name_included): Also match
3598         .sdata personality section.
3599
3600 2012-10-18  Alan Modra  <amodra@gmail.com>
3601
3602         * target-reloc.h (class Default_comdat_behavior): New, package up..
3603         (get_comdat_behaviour): ..this.
3604         (relocate_section): Add Relocate_comdat_behavior template arg,
3605         adjust code to suit.
3606         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3607         (Target_arm::scan_reloc_section): Likewise.
3608         * i386.cc (Target_i386::relocate_section): Likewise.
3609         * sparc.cc (Target_sparc::relocate_section): Likewise.
3610         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3611         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3612         * powerpc.cc (class Relocate_comdat_behavior): New.
3613         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3614         gold::relocate_section with new template arg.
3615
3616 2012-10-18  Alan Modra  <amodra@gmail.com>
3617
3618         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3619         dynamic relocs for GOT_TPREL got entries, without symbol if
3620         resolving locally.
3621         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3622         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3623         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3624
3625 2012-10-17  Alan Modra  <amodra@gmail.com>
3626
3627         PR gold/14726
3628         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3629
3630 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3631
3632         * layout.cc (Layout::include_section): Keep sections marked
3633         SHF_EXCLUDE when doing relocatable links.
3634
3635 2012-10-16  Alan Modra  <amodra@gmail.com>
3636
3637         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3638         (Target_powerpc::do_finalize_sections): Call it.
3639         (Output_data_save_res): New class and supporting functions.
3640         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3641         normal symbols defined in object files.
3642
3643 2012-10-12  Alan Modra  <amodra@gmail.com>
3644
3645         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3646         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3647         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3648         section if scan_opd_relocs not yet called.
3649         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3650
3651 2012-10-12  Alan Modra  <amodra@gmail.com>
3652
3653         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3654         add_local_ifunc_entry): Revert last change.
3655         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3656
3657 2012-10-05  Alan Modra  <amodra@gmail.com>
3658
3659         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3660         do_plt_address_for_global): New functions.
3661         (Output_data_got_powerpc::do_write): Don't segfault when linking
3662         statically.
3663         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3664         add_local_ifunc_entry): Return true on adding entry..
3665         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3666         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3667         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3668         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3669         set up symbols here.
3670         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3671         syms here.  Do so even when no .iplt.  Don't segfault when linking
3672         statically.
3673         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3674         new variants without reloc param.
3675         (Glink_sym_ent::Glink_sym_ent): Likewise.
3676         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3677         reloc when refs will resolve to plt call stub.
3678         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3679         R_PPC_PLTREL24 to resolve locally.
3680         (Target_powerpc::Scan::global): Correct ifunc handling.
3681         (Target_powerpc::Relocate::relocate): Correct local sym glink
3682         lookup.  Don't destroy "value" when we have a plt call stub,
3683         and when checking plt call validity.
3684         (Target_powerpc::do_dynsym_value): Simplify.
3685
3686 2012-10-05  Alan Modra  <amodra@gmail.com>
3687
3688         * i386.cc (Output_data_plt_i386::address_for_global,
3689         address_for_local): Add plt offset to returned value.  Adjust uses.
3690         * sparc.cc (Output_data_plt_sparc::address_for_global,
3691         address_for_local): Likewise.
3692         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3693         address_for_local): Likewise.
3694         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3695         address_for_local): Likewise.
3696         * target.h (Target::plt_address_for_global, plt_address_for_local):
3697         Update comment.
3698         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3699         (Output_data_got::Got_entry::write): Nor here.
3700         * output.h: Comment fix.
3701
3702 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3703
3704         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3705         global_offset_table_ value for larget got.
3706         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3707
3708 2012-09-29  Alan Modra  <amodra@gmail.com>
3709
3710         * powerpc.cc (Target_powerpc::iplt_): New output section.
3711         (Target_powerpc::iplt_section, make_iplt_section,
3712         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3713         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3714         Target_powerpc::plt_entry_count): Count iplt entries too.
3715         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3716         reloc section in constructor.  New params.
3717         (Target_powerpc::make_plt_section): Create reloc section here instead.
3718         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3719         functions.
3720         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3721         (Output_data_glink::add_entry, find_entry): New functions to
3722         deal with local syms.
3723         (Glink_sym_ent): Add support for local syms.
3724         (Output_data_glink::do_write): Handle ifunc plt entries.
3725         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3726         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3727         (Target_powerpc::Relocate::relocate): Likewise.
3728         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3729
3730 2012-09-25  Alan Modra  <amodra@gmail.com>
3731
3732         * object.h (Sized_relobj_file::adjust_local_symbol,
3733         do_adjust_local_symbol): New functions.
3734         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3735         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3736         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3737         and irregular opd entry spacing.
3738         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3739         (Global_symbol_visitor_opd): New functor.
3740         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3741         on deleted opd entries.
3742
3743 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3744
3745         * tilegx.cc: New file.
3746         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3747         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3748         * configure.tgt: Add entries for tilegx*.
3749         * configure.ac: Likewise.
3750         * Makefile.in: Rebuild.
3751         * configure: Likewise.
3752         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3753         tilegx.
3754
3755 2012-09-13  Alan Modra  <amodra@gmail.com>
3756
3757         * target-reloc.h (scan_relocs): Call scan.local for relocs
3758         against symbols in discarded sections.  Pass is_discarded
3759         param.
3760         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3761         Add is_discarded param.
3762         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3763         is_discarded to flag opd entry as discarded.  Don't emit dyn
3764         relocs on such entries.
3765         (Target_powerpc::Scan::global): Similarly detect and handle
3766         such opd entries.
3767         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3768         opd_ent_.  Update all uses.
3769         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3770         (Target_powerpc::relocate_section): Zero out discarded opd
3771         entry relocs.
3772
3773 2012-09-12  Ian Lance Taylor  <iant@google.com>
3774
3775         PR gold/14570
3776         * output.cc: Rename Output_data_got template parameter from size
3777         to got_size for all functions.  Compile all variants of
3778         Output_data_got.
3779         (Output_data_got::Got_entry::write): Correct use of size for
3780         symbol value.  Use local_is_tls rather than casting to
3781         Sized_relobj_file.
3782         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3783         (class Sized_relobj_file): Add do_local_is_tls.
3784         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3785
3786 2012-09-11  Alan Modra  <amodra@gmail.com>
3787
3788         PR gold/14566
3789         * layout.cc (Layout::set_segment_offsets): When using
3790         common-page-size alignment, ensure we are on a new max-page-size
3791         page.
3792         * output.cc (Output_segment::set_section_addresses): Use
3793         abi_pagesize, not common_pagesize for relro boundary.
3794         (Output_segment::set_offset): Likewise.
3795
3796 2012-09-11  Alan Modra  <amodra@gmail.com>
3797
3798         * output.h (Output_data_got::add_global_tls, add_local_tls,
3799         add_local_tls_pair): New functions.
3800         (Output_data_got::add_local_pair_with_rel): Remove second
3801         reloc param.  Expand comment.
3802         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3803         use_plt_or_tls_offset_, similarly for constructor param.
3804         (Output_data_got::Got_entry::write): Add got_index param.
3805         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3806         add_local_tls_pair): New functions.
3807         (Output_data_got::Got_entry::write): Handle tls symbols
3808         with use_plt_or_tls_offset_ set specially.
3809         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3810         (Output_data_got::do_write): Replace iterator with index, pass
3811         index to entry write function.
3812         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3813         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3814         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3815         call.
3816         * i386.cc (Target_i386::Scan::local): Likewise.
3817         * sparc.cc (Target_sparc::Scan::local): Likewise.
3818         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3819         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3820         do_tls_offset_for_global): New functions.
3821         (Target_powerpc::Scan::local): Correct TLS relocations and got
3822         entry values.
3823         (Target_powerpc::Scan::global): Don't emit unnecessary
3824         dynamic relocations on TLS GOT entries.
3825
3826 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3827
3828         * config.in: Disable sanity check for kfreebsd.
3829
3830 2012-09-10  Sterling Augustine  <saugustine@google.com>
3831
3832         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3833         (Gdb_index::pubtypes_read): New parameter.
3834         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3835         to calls.
3836         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3837         pubtypes_object_.
3838
3839 2012-09-09  Alan Modra  <amodra@gmail.com>
3840
3841         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3842         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3843         * gc.h (gc_process_relocs): Call target gc_add_reference.
3844         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3845         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3846         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3847         unnecessary cast.
3848         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3849         to cater for when we don't need code offset.  Update use.
3850         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3851         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3852         set_opd_valid): New functions.
3853         (Target_powerpc::do_gc_add_reference): New function.
3854         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3855         stashed refs.
3856         (Target_powerpc::do_gc_mark_symbol): New function.
3857
3858 2012-09-06  Cary Coutant  <ccoutant@google.com>
3859
3860         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3861         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3862         (Dwarf_die::skip_attributes): Likewise.
3863         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3864         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3865         (main): Call it.
3866         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3867
3868 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3869
3870         * testsuite/script_test_3.t: Add .got.plt output section
3871         statement.
3872         * testsuite/script_test_4.t: Likewise.
3873
3874 2012-09-05  Alan Modra  <amodra@gmail.com>
3875
3876         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3877         update all uses and lose "enum" when using type.
3878
3879 2012-09-05  Alan Modra  <amodra@gmail.com>
3880
3881         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3882         * configure: Regenerate.
3883         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3884         (plugin_final_layout.stdout): Likewise.
3885         (memory_test): Set page sizes to 0x1000.
3886         * testsuite/Makefile.in: Regenerate.
3887         * testsuite/discard_locals_test.sh: Add FIXME comment.
3888         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3889         * testsuite/pr14265.t: Add .got output section statement.
3890         * testsuite/script_test_2.t: Likewise.
3891         * testsuite/script_test_3.t: Likewise.
3892         * testsuite/script_test_4.t: Likewise.
3893         * testsuite/script_test_5.t: Likewise.
3894         * testsuite/script_test_6.t: Likewise.
3895         * testsuite/script_test_7.t: Likewise.
3896         * testsuite/script_test_9.t: Likewise.
3897
3898 2012-09-05  Alan Modra  <amodra@gmail.com>
3899
3900         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3901         (Powerpc_relocate_functions::Status): New typedef.
3902         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3903         (Target_powerpc::Scan::local): Handle REL64.
3904         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3905         for REL32 and REL64.
3906         (Target_powerpc::symval_for_branch): New function, extracted from..
3907         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
3908         checks.  Report overflow errors.
3909
3910 2012-09-05  Alan Modra  <amodra@gmail.com>
3911
3912         * object.h (Sized_relobj_file::emit_relocs): Delete.
3913         (Sized_relobj_file::emit_relocs_reltype): Delete.
3914         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3915         relocate_relocs for --emit-relocs.
3916         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3917         * output.h: Update comment.
3918         (Output_segment::first_section): New function.
3919         (Output_segment::first_section_load_address): Use first_section.
3920         * output.cc (Output_segment::first_section): New function extracted..
3921         (Output_segment::first_section_load_address): ..from here.  Delete.
3922         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3923         * target.h (Sized_target::relocate_for_relocatable): Likewise.
3924         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3925         adjust call to target.h function.
3926         * i386.cc (Target_i386): Likewise.
3927         * sparc.cc (Target_sparc): Likewise.
3928         * x86_64.cc (Target_x86_64): Likewise.
3929         * powerpc.cc (Target_powerpc): Likewise.
3930         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
3931         first tls section has section symbol for optimised local dynamic
3932         output relocs.
3933         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3934         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3935         optimised tls code.
3936         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3937         Rename to relocate_relocs.  Update error message.
3938
3939 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
3940
3941         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3942         --just-symbols.
3943
3944 2012-08-31  Alan Modra  <amodra@gmail.com>
3945
3946         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3947         (Powerpc_relobj::toc_base_offset): New stub function.
3948         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
3949         got_mod_index_offset to tlsld_got_offset.  Update all refs.
3950         (Target_powerpc::Relocate::enum skip_tls): New.
3951         (Target_powerpc::call_tls_get_addr_): New var.
3952         (Target_powerpc::is_branch_reloc): Move to file scope.
3953         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3954         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3955         New functions.
3956         (Target_powerpc::enum Got_type): Delete old values, add new ones.
3957         (powerpc_info): Correct common_pagesize for ppc64.
3958         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3959         (Powerpc_relocate_functions): Add overflow check enums and functions.
3960         Add non-shift version of rela, rela_ua.  Delete all rel public
3961         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
3962         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3963         addr16_ha3, addr14 functions.
3964         (Output_data_got_powerpc::add_constant_pair): New function.
3965         (Output_data_got_powerpc::got_base_offset): Likewise.
3966         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3967         (instruction constants): Sort, add some more.
3968         (Output_data_glink::do_write): Add and use Address typedef.  Use
3969         object->toc_base_offset() stub for 64-bit.
3970         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3971         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3972         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3973         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
3974         Always treat .opd relocs as against locally defined symbol.
3975         Correct condition for RELATIVE relocs.
3976         (Target_powerpc::do_finalize_sections): Test for NULL sections.
3977         (Target_powerpc::Relocate::relocate): Use plt call stub as value
3978         for 32-bit syms with a plt entry.  Correct ppc64 toc base
3979         calculations.  Handle TLS relocs, and more.  Add overflow
3980         checking and adjust for Powerpc_relocate_functions changes.
3981         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3982         Reinstate --emit-relocs code with FIXME.
3983
3984 2012-08-30  Alan Modra  <amodra@gmail.com>
3985
3986         * layout.cc (Layout::set_segment_offsets): Set p_align to
3987         abi_pagesize, not common_pagesize.
3988         (Layout::relaxation_loop_body): Similarly use abi_pagesize
3989         to determine whether file header can go in segment.
3990
3991 2012-08-30  Alan Modra  <amodra@gmail.com>
3992
3993         * output.h (Output_reloc::Output_reloc <output section>): Add
3994         is_relative param.  Adjust calls.
3995         (Output_reloc::add_output_section_relative): New functions.
3996         * output.cc (Output_reloc::Output_reloc <output section>): Handle
3997         is_relative.
3998         (Output_reloc::symbol_value): Handle SECTION_CODE.
3999
4000 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4001
4002         * gold.cc (queue_middle_tasks): Call layout again when unique
4003         segments for sections is desired.
4004         * layout.cc (Layout::Layout): Initialize new members.
4005         (Layout::get_output_section_flags): New function.
4006         (Layout::choose_output_section): Call get_output_section_flags.
4007         (Layout::layout): Make output section for mapping to a unique segment.
4008         (Layout::insert_section_segment_map): New function.
4009         (Layout::attach_allocated_section_to_segment): Make unique segment for
4010         output sections marked so.
4011         (Layout::segment_precedes): Check for unique segments when sorting.
4012         * layout.h (Layout::Unique_segment_info): New struct.
4013         (Layout::Section_segment_map): New typedef.
4014         (Layout::insert_section_segment_map): New function.
4015         (Layout::get_output_section_flags): New function.
4016         (Layout::is_unique_segment_for_sections_specified): New function.
4017         (Layout::set_unique_segment_for_sections_specified): New function.
4018         (Layout::unique_segment_for_sections_specified_): New member.
4019         (Layout::section_segment_map_): New member.
4020         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4021         Rename is_gc_pass_one to is_pass_one.
4022         Rename is_gc_pass_two to is_pass_two.
4023         Rename is_gc_or_icf to is_two_pass.
4024         Check for which pass based on whether symbols data is present.
4025         Make it two pass when unique segments for sections is desired.
4026         * output.cc (Output_section::Output_section): Initialize new
4027         members.
4028         * output.h (Output_section::is_unique_segment): New function.
4029         (Output_section::set_is_unique_segment): New function.
4030         (Output_section::is_unique_segment_): New member.
4031         (Output_section::extra_segment_flags): New function.
4032         (Output_section::set_extra_segment_flags): New function.
4033         (Output_section::extra_segment_flags_): New member.
4034         (Output_section::segment_alignment): New function.
4035         (Output_section::set_segment_alignment): New function.
4036         (Output_section::segment_alignment_): New member.
4037         (Output_segment::Output_segment): Initialize is_unique_segment_.
4038         (Output_segment::is_unique_segment): New function.
4039         (Output_segment::set_is_unique_segment): New function.
4040         (Output_segment::is_unique_segment_): New member.
4041         * plugin.cc (allow_unique_segment_for_sections): New function.
4042         (unique_segment_for_sections): New function.
4043         (Plugin::load): Add new functions to transfer vector.
4044         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4045         * Makefile.in: Regenerate.
4046         * testsuite/plugin_final_layout.sh: Check if unique segment
4047         functionality works.
4048         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4049         are available.
4050         (allow_unique_segment_for_sections): New global.
4051         (unique_segment_for_sections): New global.
4052         (claim_file_hook): Call allow_unique_segment_for_sections.
4053         (all_symbols_read_hook): Call unique_segment_for_sections.
4054
4055 2012-08-22  Cary Coutant  <ccoutant@google.com>
4056
4057         * layout.cc (Layout::include_section): Don't assert on GROUP
4058         sections with --emit-relocs.
4059
4060 2012-08-21  Cary Coutant  <ccoutant@google.com>
4061
4062         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4063         if --export-dynamic-symbol names an undef symbol.
4064
4065 2012-08-18  Alan Modra  <amodra@gmail.com>
4066
4067         * powerpc.cc: Formatting and white space.
4068         (Powerpc_relobj): Rename got2_section_ to special_.
4069         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4070         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4071         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4072         (Target_powerpc): Add Address typedef and invalid_address.  Use
4073         throughout.
4074         (Target_powerpc::is_branch_reloc): New function.
4075         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4076         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4077         for dst_mask, value and addend.
4078         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4079         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4080         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4081         uint16_t for 24-bit offset.  Use get_output_section_offset and
4082         check return.
4083         (Target_powerpc::Scan::local): Handle more relocs.
4084         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4085         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4086         Plug in toc restoring insn after plt calls.  Translate branches
4087         to function descriptor symbols to corresponding entry point.
4088         (Target_powerpc::relocate_for_relocatable): Check return from
4089         get_output_section_offset.
4090         * symtab.h: Comment typo.
4091
4092 2012-08-14  Ian Lance Taylor  <iant@google.com>
4093
4094         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4095         unsupported_relocal_local to call unsupported_reloc_global.
4096
4097 2012-08-14  Nick Clifton  <nickc@redhat.com>
4098
4099         PR ld/14265
4100         * script-sections.cc (Sections_element::output_section_name): Add
4101         keep return parameter.
4102         (Output_section_element::match_name): Add keep return parameter.
4103         Return the value of the keep_ member.
4104         * script-sections.h (class Output_section): Update
4105         output_section_name prototype.
4106         * layout.cc (Layout::keep_input_section): New public member
4107         function.
4108         (Layout::choose_output_section): Pass keep parameter to
4109         output_section_name.
4110         * layout.h (class Layout): Add keep_input_section.
4111         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4112         sections.
4113         * testsuite/Makefile.am: Add a test.
4114         * testsuite/Makefile.in: Regenerate.
4115         * testsuite/pr14265.c: Source file for the test.
4116         * testsuite/pr14265.t: Linker script for the test.
4117         * testsuite/pr14265.sh: Shell script for the test.
4118
4119 2012-08-14  Alan Modra  <amodra@gmail.com>
4120
4121         * target.h (Target::output_section_name): New function.
4122         (Target::do_output_section_name): New function.
4123         * layout.cc (Layout::choose_output_section): Call the above.
4124         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4125
4126 2012-08-14  Alan Modra  <amodra@gmail.com>
4127
4128         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4129         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4130         for replace_constant call.
4131         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4132         (Output_data_glink::do_print_to_mapfile): New function.
4133         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4134         (Target_powerpc::Relocate::relocate): Likewise.
4135
4136 2012-08-14  Alan Modra  <amodra@gmail.com>
4137
4138         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4139         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4140         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4141         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4142         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4143         here.
4144         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4145         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4146         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4147         here.
4148         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4149         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4150
4151 2012-08-12  Alan Modra  <amodra@gmail.com>
4152
4153         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4154         (glink insn constants): Use uint32_t.
4155         (Output_data_glink::add_entry): Use insert, not [] operator.
4156
4157 2012-08-11  Alan Modra  <amodra@gmail.com>
4158
4159         * object.h (Sized_relobj_file::find_shdr): New function.
4160         (Sized_relobj_file::find_special_sections): New function.
4161         * object.cc (Sized_relobj_file::find_shdr): New function.
4162         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4163         (Sized_relobj_file::find_special_sections): New function, split out..
4164         (Sized_relobj_file::do_read_symbols): ..from here.
4165         * output.h (Output_data_got::replace_constant): New function.
4166         (Output_data_got::num_entries): New function.
4167         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4168         (Output_data_got::got_offset): Protected rather than private.
4169         (Output_data_got::replace_got_entry): New function.
4170         * output.cc (Output_data_got::replace_got_entry): New function.
4171         * powerpc.cc (class Powerpc_relobj): New.
4172         (class Powerpc_relocate_functions): Delete all psymval variants or
4173         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4174         Implement _ha functions using corresponding _hi function.
4175         (Powerpc_relobj::find_special_sections): New function.
4176         (Target_powerpc::do_make_elf_object): New function.
4177         (class Output_data_got_powerpc): New.
4178         (class Output_data_glink): New.
4179         (class Powerpc_scan_relocatable_reloc): New.
4180         Many more changes througout file.
4181
4182 2012-08-09  Nick Clifton  <nickc@redhat.com>
4183
4184         * po/vi.po: Updated Vietnamese translation.
4185
4186 2012-08-07  Ian Lance Taylor  <iant@google.com>
4187
4188         * layout.cc (Layout::add_target_dynamic_tags): If
4189         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4190         plt_rel.
4191
4192 2012-07-30  Nick Clifton  <nickc@redhat.com>
4193
4194         * po/gold.pot: Updated template.
4195         * po/es.po: Updated Spanish translation.
4196
4197 2012-07-18  Cary Coutant  <ccoutant@google.com>
4198
4199         PR gold/14344
4200         * configure.ac: Add check for -gpubnames support.
4201         * configure: Regenerate.
4202         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4203         support; force -gno-pubnames.
4204         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4205         support.
4206         (gdb_index_test_4): New test.
4207         * testsuite/Makefile.in: Regenerate.
4208         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4209         * testsuite/gdb_index_test_2.sh: Likewise.
4210         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4211         * testsuite/gdb_index_test_4.sh: New script.
4212         * testsuite/gdb_index_test_comm.sh: New script with common code;
4213         don't look for space after colon.
4214
4215 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4216
4217         * gold.cc (queue_middle_tasks): Update function order only after
4218         deferred objects due to plugins are processed.
4219
4220 2012-07-11  Ian Lance Taylor  <iant@google.com>
4221
4222         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4223         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4224         (Target_arm::scan_reloc_for_stub): Likewise.
4225         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4226         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4227         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4228         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4229         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4230
4231 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4232             Ian Lance Taylor  <iant@google.com>
4233
4234         PR gold/14309
4235         * configure.ac: Test whether std::tr1::hash<off_t> works.
4236         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4237         needed.
4238         * output.h (class Output_fill): Add virtual destructor.
4239         * configure, config.in: Rebuild.
4240
4241 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4242
4243         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4244
4245 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4246
4247         * plugin.cc (Plugin::load): Handle position independent executables.
4248
4249 2012-06-06  Cary Coutant  <ccoutant@google.com>
4250
4251         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4252         add .debug_macro.
4253         (lines_only_debug_sections): Likewise.
4254         (gdb_fast_lookup_sections): New static array.
4255         (is_gdb_debug_section): Rename formal parameter.
4256         (is_lines_only_debug_section): Likewise.
4257         (is_gdb_fast_lookup_section): New function.
4258         (Layout::include_section): Check for ".zdebug_" prefix; pass
4259         section name suffix to is_gdb_debug_section, et al.; check for
4260         fast-lookup sections when building .gdb_index.
4261         * options.h (--strip-debug-gdb): Update GDB version number.
4262
4263 2012-06-06  Cary Coutant  <ccoutant@google.com>
4264
4265         * configure.ac: Add check for fallocate.
4266         * configure: Regenerate.
4267         * config.in: Regenerate.
4268
4269         * options.h (class General_options): Add --mmap-output-file and
4270         --posix-fallocate options.
4271         * output.cc: (posix_fallocate): Remove; replace with...
4272         (gold_fallocate): New function.
4273         (Output_file::map_no_anonymous): Call gold_fallocate.
4274         (Output_file::map): Check --mmap-output-file option.
4275
4276 2012-06-05  Jing Yu  <jingyu@google.com>
4277
4278         * gold.h (textdomain): Add do {} to empty while(0).
4279         (bindtextdomain): Likewise.
4280
4281 2012-06-04  Cary Coutant  <ccoutant@google.com>
4282
4283         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4284         has_dynsym_index.
4285
4286 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4287
4288         * symtab.cc (Symbol_table::define_special_symbol):
4289         Initialize *poldsym to prevent uninitialized variable errors.
4290
4291 2012-05-23  Cary Coutant  <ccoutant@google.com>
4292
4293         * layout.cc (Layout::section_name_mapping): Add rules to handle
4294         exact match on .data.rel.ro.local or .data.rel.ro.
4295         (Layout::output_section_name): Check for exact matches.
4296
4297 2012-05-23  Cary Coutant  <ccoutant@google.com>
4298
4299         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4300         more carefully.
4301
4302 2012-05-22  Cary Coutant  <ccoutant@google.com>
4303
4304         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4305         object before exporting symbol.
4306
4307 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4308
4309         * testsuite/tls_test.cc: Include "config.h" first.
4310         * testsuite/tls_test_c.c: Likewise.
4311
4312 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4313             Nick Clifton  <nickc@redhat.com>
4314
4315         PR 14072
4316         * configure.in: Add check that sysdep.h has been included before
4317         any system header files.
4318         * configure: Regenerate.
4319         * config.in: Regenerate.
4320
4321 2012-05-14  Cary Coutant  <ccoutant@google.com>
4322
4323         * layout.cc (Layout::make_output_section): Mark .tdata section
4324         as RELRO.
4325         * testsuite/relro_test.cc: Add a TLS variable.
4326
4327 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4328
4329         PR gold/14091
4330         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4331         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4332         R_X86_64_64.
4333
4334 2012-05-08  Cary Coutant  <ccoutant@google.com>
4335
4336         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4337         (lines_only_debug_sections): Likewise.
4338
4339 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4340
4341         * nacl.cc: New file.
4342         * nacl.h: New file.
4343         * Makefile.am (CCFILES, HFILES): Add them.
4344         * Makefile.in: Regenerate.
4345         * i386.cc (Output_data_plt_i386_nacl): New class.
4346         (Output_data_plt_i386_nacl_exec): New class.
4347         (Output_data_plt_i386_nacl_dyn): New class.
4348         (Target_i386_nacl): New class.
4349         (Target_selector_i386_nacl): New class.
4350         (target_selector_i386): Use it instead of Target_selector_i386.
4351         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4352         (Target_x86_64_nacl): New class.
4353         (Target_selector_x86_64_nacl): New class.
4354         (target_selector_x86_64, target_selector_x32): Use it instead of
4355         Target_selector_x86_64.
4356         * arm.cc (Output_data_plt_arm_nacl): New class.
4357         (Target_arm_nacl): New class.
4358         (Target_selector_arm_nacl): New class.
4359         (target_selector_arm, target_selector_armbe): Use it instead of
4360         Target_selector_arm.
4361
4362         * target-select.cc (select_target): Take new Input_file* and off_t
4363         arguments, pass them on to recognize method of selector.
4364         * object.cc (make_elf_sized_object): Update caller.
4365         * parameters.cc (parameters_force_valid_target): Likewise.
4366         * incremental.cc (make_sized_incremental_binary): Likewise.
4367         * target-select.h: Update decl.
4368         (Target_selector::recognize): Take new Input_file* argument,
4369         pass it on to do_recognize.
4370         (Target_selector::do_recognize): Take new Input_file* argument.
4371         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4372         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4373         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4374         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4375
4376         * target.h (Target::Target_info): New members isolate_execinstr
4377         and rosegment_gap.
4378         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4379         * arm.cc (Target_arm::arm_info): Update initializer.
4380         * i386.cc (Target_i386::i386_info): Likewise.
4381         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4382         * sparc.cc (Target_sparc::sparc_info): Likewise.
4383         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4384         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4385         * layout.cc (Layout::attach_allocated_section_to_segment):
4386         Take new const Target* argument.  If target->isolate_execinstr(), act
4387         like --rosegment.
4388         (Layout::find_first_load_seg): Take new const Target* argument;
4389         if target->isolate_execinstr(), reject PF_X segments.
4390         (Layout::relaxation_loop_body): Update caller.
4391         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4392         reset file offset to zero when we hit LOAD_SEG, and then do a second
4393         loop over the segments before LOAD_SEG to reassign offsets after
4394         addresses have been determined.  Handle target->rosegment_gap().
4395         (Layout::attach_section_to_segment): Take new const Target* argument;
4396         pass it to attach_allocated_section_to_segment.
4397         (Layout::make_output_section): Update caller.
4398         (Layout::attach_sections_to_segments): Take new const Target* argument;
4399         pass it to attach_section_to_segment.
4400         * gold.cc (queue_middle_tasks): Update caller.
4401         * layout.h (Layout): Update method decls with new arguments.
4402
4403         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4404         Target_info pointer to use.
4405         (Target_arm::do_make_data_plt): New virtual method.
4406         (Target_arm::make_data_plt): New method that calls it.
4407         (Target_arm::make_plt_entry): Use it.
4408         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4409         for the section alignment.
4410         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4411         method.
4412         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4413         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4414         method.
4415         (Output_data_plt_arm::get_plt_entry_size): Call it.
4416         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4417         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4418         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4419         method.
4420         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4421         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4422         method instead of sizeof(plt_entry).
4423         (Output_data_plt_arm::add_entry): Likewise.
4424         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4425         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4426         than static method.
4427         (Target_arm::plt_entry_size): Likewise.
4428         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4429         Move to ...
4430         (Output_data_plt_arm_standard): ... here, new class.
4431         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4432         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4433         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4434
4435         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4436         Take additional argument for the PLT entry size.
4437         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4438         Use get_plt_entry_size method rather than plt_entry_size variable.
4439         (Output_data_plt_x86_64::reserve_slot): Likewise.
4440         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4441         (Output_data_plt_x86_64::add_entry): Likewise.
4442         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4443         (Output_data_plt_x86_64::address_for_global): Likewise.
4444         (Output_data_plt_x86_64::address_for_local): Likewise.
4445         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4446         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4447         Make method non-static.
4448         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4449         method.
4450         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4451         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4452         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4453         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4454         virtual method.
4455         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4456         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4457         virtual method.
4458         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4459         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4460         virtual method.
4461         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4462         (Output_data_plt_x86_64::plt_entry_size)
4463         (Output_data_plt_x86_64::first_plt_entry)
4464         (Output_data_plt_x86_64::plt_entry)
4465         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4466         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4467         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4468         (Output_data_plt_x86_64_standard): ... here, new class.
4469         (Target_x86_64::Target_x86_64): Take optional argument for the
4470         Target_info pointer to use.
4471         (Target_x86_64::do_make_data_plt): New virtual method.
4472         (Target_x86_64::make_data_plt): New method to call it.
4473         (Target_x86_64::init_got_plt_for_update): Use that.
4474         Call this->plt_->add_eh_frame method here.
4475         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4476         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4477         rather than static method.
4478         (Target_x86_64::plt_entry_size): Likewise.
4479         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4480         rather than plt_entry_size variable.  Move guts of PLT filling to...
4481         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4482         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4483         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4484
4485         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4486         additional argument for the section alignment.
4487         Don't do add_eh_frame_for_plt here.
4488         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4489         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4490         variable.
4491         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4492         method.
4493         (Output_data_plt_i386::get_plt_entry_size): Call it.
4494         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4495         (Output_data_plt_i386::add_eh_frame): New method to call it.
4496         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4497         method.
4498         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4499         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4500         method.
4501         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4502         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4503         method instead of plt_entry_size.
4504         (Output_data_plt_i386::plt_entry_size)
4505         (Output_data_plt_i386::plt_eh_frame_fde_size)
4506         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4507         (Output_data_plt_i386_standard): ... here, new class.
4508         (Output_data_plt_i386_exec): New class.
4509         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4510         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4511         (Output_data_plt_i386::exec_plt_entry): Move to ...
4512         (Output_data_plt_i386_exec::plt_entry): ... here.
4513         (Output_data_plt_i386_dyn): New class.
4514         (Output_data_plt_i386::first_plt_entry): Move to ...
4515         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4516         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4517         (Output_data_plt_i386_dyn::plt_entry): ... here.
4518         (Target_i386::Target_i386): Take optional argument for the Target_info
4519         pointer to use.
4520         (Target_i386::do_make_data_plt): New virtual method.
4521         (Target_i386::make_data_plt): New method to call it.
4522         (Target_i386::make_plt_section): Use that.
4523         Call this->plt_->add_eh_frame method here.
4524         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4525         rather than plt_entry_size variable.
4526         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4527         (Output_data_plt_i386::address_for_local): Likewise.
4528         (Output_data_plt_i386::do_write): Likewise.
4529         Move guts of PLT filling to...
4530         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4531         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4532         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4533         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4534
4535 2012-05-01  Cary Coutant  <ccoutant@google.com>
4536
4537         * dwarf_reader.cc (Dwarf_die::read_attributes)
4538         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4539         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4540         * reduced_debug_output.cc
4541         (Output_reduced_debug_info_section::get_die_end): Remove
4542         DW_FORM_GNU_ref_index.  Add default case.
4543
4544 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4545
4546         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4547         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4548         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4549         DW_AT_high_pc as offset from DW_AT_low_pc.
4550
4551         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4552         * testsuite/Makefile.in: Regenerate.
4553         * testsuite/gdb_index_test_3.c: New test source file.
4554         * testsuite/gdb_index_test_3.sh: New test source file.
4555
4556 2012-04-25  Ian Lance Taylor  <iant@google.com>
4557
4558         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4559         pointer.
4560         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4561         as a class, not a struct.
4562         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4563         (Target_arm::apply_cortex_a8_workaround): Likewise.
4564         * gc.h: Declare Reloc_types as a struct, not a class.
4565         * object.h: Declare Symbols_data as a struct.
4566         * reloc.h: Declare Read_relocs_data as a struct.
4567         * target.h: Declare Relocate_info as a struct.
4568
4569 2012-04-24  David S. Miller  <davem@davemloft.net>
4570
4571         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4572         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4573         and R_SPARC_WPLT30.
4574
4575 2012-04-24  Cary Coutant  <ccoutant@google.com>
4576
4577         * incremental-dump.cc (find_input_containing_global): Replace
4578         magic number with symbolic constant.
4579         (dump_incremental_inputs): Update version number.
4580         * incremental.cc (Output_section_incremental_inputs): Update version
4581         number; import symbolic constants from Incremental_inputs_reader.
4582         (Incremental_inputs::create_data_sections): Align relocations
4583         section correctly for 64-bit targets.
4584         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4585         constants; add padding.
4586         (Output_section_incremental_inputs::write_header): Add assert for
4587         header_size.
4588         (Output_section_incremental_inputs::write_input_files): Add assert
4589         for input_entry_size.
4590         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4591         add assert for object_info_size, input_section_entry_size,
4592         global_sym_entry_size.
4593         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4594         for data structure sizes; use them.
4595         (Incremental_input_entry_reader): Import symbolic constants from
4596         Incremental_inputs_reader; use them.
4597
4598 2012-04-23  David S. Miller  <davem@davemloft.net>
4599
4600         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4601         and elf_flags_set_.
4602         (Target_sparc::Target_sparc): Initialize new fields.
4603         (Target_sparc::do_make_elf_object): New function.
4604         (Target_sparc::do_adjust_elf_header): New function.
4605
4606 2012-04-23  Cary Coutant  <ccoutant@google.com>
4607
4608         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4609         CU range table of gdb index.
4610
4611 2012-04-20  David S. Miller  <davem@davemloft.net>
4612
4613         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4614         instead of false.
4615
4616 2012-04-16  David S. Miller  <davem@davemloft.net>
4617
4618         * sparc.cc (Target_sparc::got_address): New function.
4619         (Sparc_relocate_functions::gdop_hix22): New function.
4620         (Sparc_relocate_functions::gdop_lox10): New function.
4621         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4622         relocs.
4623         (Target_sparc::Scan::local): Likewise if the global symbol is not
4624         preemptible and is not IFUNC.
4625         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4626         transformations for local and non-preemptible non-IFUNC global
4627         symbols.
4628
4629         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4630         writing out 64-bit part of ranges.
4631
4632         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4633         -fpic and -fpie respectively.
4634         * Makefile.in: Regenerate.
4635
4636         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4637         (Target_sparc::Target_sparc): Initialize new field.
4638         (Target_sparc::do_plt_section_for_global): New function.
4639         (Target_sparc::do_plt_section_for_local): New function.
4640         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4641         (Target_sparc::make_plt_section): New function, broken out of
4642         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4643         (Target_sparc::make_plt_entry): Call make_plt_section.
4644         (Target_sparc::make_local_ifunc_plt_entry): New function.
4645         (Target_sparc::rela_ifunc_section): New function.
4646         (Target_sparc::plt_section): Remove const.
4647         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4648         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4649         and ifunc_count_ fields.
4650         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4651         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4652         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4653         (Output_data_plt_sparc::rela_ifunc): New function.
4654         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4655         (Output_data_plt_sparc::has_ifunc_section): New function.
4656         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4657         (Output_data_plt_sparc::address_for_global): New function.
4658         (Output_data_plt_sparc::address_for_local): New function.
4659         (Output_data_plt_sparc::plt_index_to_offset): New function.
4660         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4661         and entry_count.
4662         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4663         entry_count.
4664         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4665         R_SPARC_JMP_IREL to switch.
4666         (Target_sparc::Scan::check_non_pic): Likewise.
4667         (Target_sparc::Scan::local): Handle IFUNC symbols.
4668         (Target_sparc::Scan::local): Likewise.
4669         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4670         and plt_address_for_local.
4671         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4672         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4673
4674         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4675         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4676         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4677         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4678         global relocs too.
4679         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4680         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4681         calls.
4682         * sparc.cc (Target_sparc::Scan::global): Likewise.
4683         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4684
4685 2012-04-16  Cary Coutant  <ccoutant@google.com>
4686
4687         * archive.cc (Library_base::should_include_member): Check for
4688         --export-dynamic-symbol.
4689         * options.h (class General_options): Add --export-dynamic-symbol.
4690         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4691         --export-dynamic-symbol.
4692         (Symbol_table::gc_mark_undef_symbols): Likewise.
4693         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4694
4695 2012-04-12  David S. Miller  <davem@davemloft.net>
4696
4697         * sparc.cc (Reloc::wdisp10): New relocation method.
4698         (Reloc::h34): Likewise.
4699         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4700         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4701         R_SPARC_WDISP10.
4702         (Target_sparc::Scan::local): Likewise.
4703         (Target_sparc::Scan::global): Likewise.
4704         (Target_sparc::Relocate::relocate): Likewise.
4705
4706 2012-04-09  Cary Coutant  <ccoutant@google.com>
4707
4708         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4709         low_pc == 0.
4710
4711 2012-04-06  Ian Lance Taylor  <iant@google.com>
4712
4713         * timer.cc: #include <unistd.h>.
4714
4715 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4716
4717         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4718         * config.in: Regenerate.
4719         * configure: Regenerate.
4720
4721 2012-04-05  Nick Clifton  <nickc@redhat.com>
4722
4723         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4724         (AM_LC_MESSAGES): Add.
4725         * aclocal.m4: Regenerate.
4726         * config.in: Regenerate.
4727         * configure: Regenerate.
4728
4729 2012-03-21  Cary Coutant  <ccoutant@google.com>
4730
4731         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4732         * Makefile.in: Regenerate.
4733         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4734         (Sized_elf_reloc_mapper::symbol_section): New function.
4735         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4736         (make_elf_reloc_mapper): New function.
4737         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4738         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4739         (Dwarf_abbrev_table::do_get_abbrev): New function.
4740         (Dwarf_ranges_table::read_ranges_table): New function.
4741         (Dwarf_ranges_table::read_range_list): New function.
4742         (Dwarf_pubnames_table::read_section): New function.
4743         (Dwarf_pubnames_table::read_header): New function.
4744         (Dwarf_pubnames_table::next_name): New function.
4745         (Dwarf_die::Dwarf_die): New function.
4746         (Dwarf_die::read_attributes): New function.
4747         (Dwarf_die::skip_attributes): New function.
4748         (Dwarf_die::set_name): New function.
4749         (Dwarf_die::set_linkage_name): New function.
4750         (Dwarf_die::attribute): New function.
4751         (Dwarf_die::string_attribute): New function.
4752         (Dwarf_die::int_attribute): New function.
4753         (Dwarf_die::uint_attribute): New function.
4754         (Dwarf_die::ref_attribute): New function.
4755         (Dwarf_die::child_offset): New function.
4756         (Dwarf_die::sibling_offset): New function.
4757         (Dwarf_info_reader::check_buffer): New function.
4758         (Dwarf_info_reader::parse): New function.
4759         (Dwarf_info_reader::do_parse): New function.
4760         (Dwarf_info_reader::do_read_string_table): New function.
4761         (Dwarf_info_reader::lookup_reloc): New function.
4762         (Dwarf_info_reader::get_string): New function.
4763         (Dwarf_info_reader::visit_compilation_unit): New function.
4764         (Dwarf_info_reader::visit_type_unit): New function.
4765         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4766         Sized_elf_reloc_mapper.
4767         (Sized_dwarf_line_info::symbol_section): Remove function.
4768         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4769         (Sized_dwarf_line_info::read_line_mappings): Remove object
4770         parameter, adjust callers.
4771         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4772         * dwarf_reader.h: Include <sys/types.h>.
4773         (class Track_relocs): Remove forward declaration.
4774         (class Elf_reloc_mapper): New class.
4775         (class Sized_elf_reloc_mapper): New class.
4776         (class Dwarf_abbrev_table): New class.
4777         (class Dwarf_range_list): New class.
4778         (class Dwarf_ranges_table): New class.
4779         (class Dwarf_pubnames_table): New class.
4780         (class Dwarf_die): New class.
4781         (class Dwarf_info_reader): New class.
4782         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4783         (Sized_dwarf_line_info::symbol_section): Remove member function.
4784         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4785         base class.
4786         * gdb-index.cc: New source file.
4787         * gdb-index.h: New source file.
4788         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4789         and .debug_types sections, call Layout::add_to_gdb_index.
4790         (Sized_relobj_incr::do_section_name): Implement.
4791         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4792         return type; Implement.
4793         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4794         return type.
4795         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4796         parameter list and return type.
4797         (Sized_incr_dynobj::do_section_contents): Likewise.
4798         * layout.cc: Include gdb-index.h.
4799         (Layout::Layout): Initialize gdb_index_data_.
4800         (Layout::init_fixed_output_section): Check for .gdb_index section.
4801         (Layout::add_to_gdb_index): New function. Instantiate.
4802         * layout.h: Add forward declaration for class Gdb_index.
4803         (Layout::add_to_gdb_index): New member function.
4804         (Layout::gdb_index_data_): New data member.
4805         * main.cc: Include gdb-index.h.
4806         (main): Print statistics for gdb index.
4807         * object.cc (Object::section_contents): Move code into
4808         do_section_contents.
4809         (need_decompressed_section): Check for sections needed when building
4810         gdb index.
4811         (build_compressed_section_map): Likewise.
4812         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4813         gdb index.
4814         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4815         sections; call Layout::add_to_gdb_index.
4816         (Sized_relobj_file::do_decompressed_section_contents): Call
4817         do_section_contents directly.
4818         * object.h (Object::do_section_contents): Adjust parameter list and
4819         return type.
4820         (Object::do_decompressed_section_contents): Call do_section_contents
4821         directly.
4822         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4823         return type.
4824         * options.h (class General_options): Add --gdb-index option.
4825         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4826         list and return type.
4827         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4828         * reloc.h (Track_relocs::checkpoint): New function.
4829         (Track_relocs::reset): New function.
4830
4831         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4832         New test cases.
4833         * testsuite/Makefile.in: Regenerate.
4834         * testsuite/gdb_index_test.cc: New test source file.
4835         * testsuite/gdb_index_test_1.sh: New test source file.
4836         * testsuite/gdb_index_test_2.sh: New test source file.
4837
4838 2012-03-19  Doug Kwan  <dougkwan@google.com>
4839
4840         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4841         (Target_arm::do_finalize_sections): Remove code which defines
4842         __exidx_start and __exidx_end.  Make symbol table parameter
4843         anonymous as it is not used.
4844         * gold.cc (queue_middle_tasks): Call target hook to define any
4845         target-specific symbols.
4846         * target.h (Target::define_standard_symbols): New method.
4847         (Target::do_define_standard_symbols): Same.
4848         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4849         * testsuite/Makefile.in: Regenerate.
4850         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4851         and __exidx_end.
4852         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4853         relocations are generated for __exidx_start and __exidx_end.
4854
4855 2012-03-16  Doug Kwan  <dougkwan@google.com>
4856
4857         * testsuite/Makefile.am: Disable test initpri3b.
4858         * testsuite/Makefile.in: Regenerate.
4859
4860 2012-03-15  Doug Kwan  <dougkwan@google.com>
4861
4862         * arm.cc (Target_arm::got_section): Make .got section read-only
4863         if -z now is given.
4864
4865 2012-03-15  Ian Lance Taylor  <iant@google.com>
4866
4867         PR gold/13850
4868         * layout.cc (Layout::make_output_section): Correctly mark
4869         SHT_INIT_ARRAY, et. al., as relro.
4870
4871 2012-03-14  Doug Kwan  <dougkwan@google.com>
4872
4873         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4874         dynamic relocations for protected symbols in shared objects.
4875
4876 2012-03-13  Ian Lance Taylor  <iant@google.com>
4877
4878         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4879         keep the larger alignment.
4880
4881 2012-03-12  Cary Coutant  <ccoutant@google.com>
4882
4883         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4884         handling of DW_LNE_define_file.
4885
4886 2012-03-12  Cary Coutant  <ccoutant@google.com>
4887
4888         * reduced_debug_output.cc
4889         (Output_reduced_debug_info_section::get_die_end): Add new FORM
4890         codes to switch.
4891
4892 2012-02-29  Cary Coutant  <ccoutant@google.com>
4893
4894         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4895
4896 2012-02-29  Cary Coutant  <ccoutant@google.com>
4897
4898         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4899         Call Object::decompressed_section_contents.
4900         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4901         New dtor.
4902         (Sized_dwarf_line_info::buffer_start_): New data member.
4903         * merge.cc (Output_merge_data::do_add_input_section): Call
4904         Object::decompressed_section_contents.
4905         (Output_merge_string::do_add_input_section): Likewise.
4906         * object.cc (need_decompressed_section): New function.
4907         (build_compressed_section_map): Decompress sections needed later.
4908         (Sized_relobj_file::do_decompressed_section_contents): New function.
4909         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4910         * object.h (Object::decompressed_section_contents): New function.
4911         (Object::discard_decompressed_sections): New function.
4912         (Object::do_decompressed_section_contents): New function.
4913         (Object::do_discard_decompressed_sections): New function.
4914         (Compressed_section_info): New type.
4915         (Compressed_section_map): Include decompressed section contents.
4916         (Sized_relobj_file::do_decompressed_section_contents): New function.
4917         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4918
4919 2012-02-16  Cary Coutant  <ccoutant@google.com>
4920
4921         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4922         * testsuite/Makefile.in: Regenerate.
4923
4924 2012-02-14  Cary Coutant  <ccoutant@google.com>
4925
4926         * options.cc (General_options::finalize): Disallow -pie and -static.
4927
4928 2012-02-03  Doug Kwan  <dougkwan@google.com>
4929
4930         * arm.cc (Arm_relocate_functions::abs8,
4931         Arm_relocate_functions::abs16): Use
4932         Bits::has_signed_unsigned_overflow32.
4933         (Arm_relocate_functions::thm_abs8): Correct range of
4934         overflow check.
4935         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4936         in assertions.
4937
4938 2012-02-02  Doug Kwan  <dougkwan@google.com>
4939
4940         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4941         position independent outputs, not just shared objects.
4942
4943 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
4944
4945         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4946         * configure: Regenerated.
4947
4948 2012-01-27  Ian Lance Taylor  <iant@google.com>
4949
4950         * reloc.h (Bits): New class with static functions, copied from
4951         namespace utils in arm.cc.
4952         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
4953         instead.
4954
4955 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4956
4957         * incremental.cc (write_info_blocks): Correct relocation offset.
4958
4959 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4960
4961         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4962         (Relocate::tls_gd_to_le): Likewise.
4963
4964 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4965
4966         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4967
4968 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4969
4970         * configure.ac: Check if -mcmodel=medium works.
4971         * configure: Regenerated.
4972
4973 2012-01-24  Cary Coutant  <ccoutant@google.com>
4974
4975         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4976         definition and ...
4977         (read_unsigned_LEB_128_x): ... this new function.
4978         (read_signed_LEB_128): Replaced with inline definition and ...
4979         (read_signed_LEB_128_x): ... this new function.
4980         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
4981         (read_unsigned_LEB_128): Add inline definition.
4982         (read_signed_LEB_128_x): New function.
4983         (read_signed_LEB_128): Add inline definition.
4984         * testsuite/Makefile.am (leb128_unittest): New unit test.
4985         * testsuite/Makefile.in: Regenerate.
4986         * testsuite/leb128_unittest.cc: New unit test.
4987
4988 2012-01-23  Ian Lance Taylor  <iant@google.com>
4989
4990         PR gold/13617
4991         * i386.cc (Target_i386::do_code_fill): When using a jmp
4992         instruction, pad with nop instructions.
4993         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4994
4995 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
4996
4997         * x86_64.cc (gc_process_relocs): Add typename on types used in
4998         template.
4999         (scan_relocs): Likewise.
5000         (relocate_section): Likewise.
5001         (apply_relocation): Likewise.
5002
5003 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5004
5005         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5006         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5007         under x32.
5008
5009 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5010
5011         * x86_64.cc: Initial support for x32.
5012
5013 2012-01-03  Cary Coutant  <ccoutant@google.com>
5014
5015         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5016         Use abstract base class for GOT.
5017         * gold/output.h (class Output_data_got_base): New abstract base class.
5018         (class Output_data_got): Derive from new base class, adjust ctors.
5019         (Output_data_got::reserve_slot): Make virtual; rename to
5020         do_reserve_slot; Adjust callers.
5021         * gold/target.h (Sized_target::init_got_plt_for_update): Return
5022         pointer to abstract base class.
5023         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5024
5025 2011-12-18  Ian Lance Taylor  <iant@google.com>
5026
5027         * object.h (Relobj::local_symbol_value): New function.
5028         (Relobj::local_plt_offset): New function.
5029         (Relobj::local_has_got_offset): New function.
5030         (Relobj::local_got_offset): New function.
5031         (Relobj::set_local_got_offset): New function.
5032         (Relobj::do_local_symbol_value): New pure virtual function.
5033         (Relobj::do_local_plt_offset): Likewise.
5034         (Relobj::do_local_has_got_offset): Likewise.
5035         (Relobj::do_local_got_offset): Likewise.
5036         (Relobj::do_set_local_got_offset): Likewise.
5037         (Sized_relobj::do_local_has_got_offset): Rename from
5038         local_has_got_offset.
5039         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5040         (Sized_relobj::do_set_local_got_offset): Rename from
5041         set_local_got_offset.
5042         (Sized_relobj_file::do_local_plt_offset): Rename from
5043         local_plt_offset.
5044         (Sized_relobj_file::do_local_symbol_value): New function.
5045         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5046         local_plt_offset.
5047         * output.cc (Output_data_got::Got_entry::write): Change object to
5048         Relobj.  Use local_symbol_value.
5049         (Output_data_got::add_global_with_rel): Change rel_dyn to
5050         Output_data_reloc_generic*.  Use add_global_generic.
5051         (Output_data_got::add_global_with_rela): Remove.  Change all
5052         callers to use add_global_with_rel.
5053         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5054         Output_data_reloc_generic*.  Use add_global_generic.
5055         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5056         callers to use add_global_pair_with_rel.
5057         (Output_data_got::add_local): Change object to Relobj*.
5058         (Output_data_got::add_local_plt): Likewise.
5059         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5060         change rel_dyn to Output_data_reloc_generic*.  Use
5061         add_local_generic.
5062         (Output_data_got::add_local_with_rela): Remove.  Change all
5063         callers to use all_local_with_rel.
5064         (Output_data_got::add_local_pair_with_rel): Change object to
5065         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5066         add_output_section_generic.
5067         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5068         callers to use add_local_pair_with_rel.
5069         (Output_data_got::reserve_local): Change object to Relobj*.
5070         * output.h: (class Output_data_reloc_generic): Add pure virtual
5071         declarations for add_global_generic, add_local_generic,
5072         add_output_section_generic.
5073         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5074         functions for Output_data_reloc_generic.  Update declarations for
5075         changes listed in output.cc.
5076         (class Output_data_got): Change template parameter to got_size.
5077         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5078         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5079         function.
5080         (Sized_relobj_incr::do_local_plt_offset): New function.
5081         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5082         add_global_generic.
5083
5084 2011-12-17  Cary Coutant  <ccoutant@google.com>
5085
5086         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5087         * resolve.cc (Symbol_table::resolve): Likewise.
5088         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5089         arrays.
5090         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5091
5092 2011-12-16  Ian Lance Taylor  <iant@google.com>
5093
5094         * output.h (Output_data_reloc_generic::add): Only call
5095         add_dynamic_reloc if this is a dynamic reloc section.
5096
5097 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5098
5099         PR gold/13505
5100         * target-reloc.h (apply_relocation): Replace <64, false> with
5101         <size, big_endian>.
5102
5103 2011-11-25  Nick Clifton  <nickc@redhat.com>
5104
5105         * po/it.po: New Italian translation.
5106
5107 2011-11-17  Sterling Augustine  <saugustine@google.com>
5108
5109         * script.cc (script_include_directive): Implement.
5110         (read_script_file): New local variables name and search_path. Update
5111         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5112         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5113         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5114
5115 2011-11-11  Sterling Augustine  <saugustine@google.com>
5116
5117         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5118         (file_or_sections_cmd): Likewise.
5119
5120 2011-11-11  Doug Kwan  <dougkwan@google.com>
5121
5122         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5123         if --just-symbols is given.
5124
5125 2011-11-10  Doug Kwan  <dougkwan@google.com>
5126
5127         PR gold/13362
5128         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5129         when processing data relocs.
5130         * reloc.h (Relocate_functions::rel_unaligned): New method.
5131         (Relocate_functions::pcrel_unaligned): Ditto.
5132         (Relocate_functions::rel32_unaligned): Ditto.
5133         (Relocate_functions::pcrel32_unaligned): Ditto.
5134
5135 2011-11-09  Doug Kwan  <dougkwan@google.com>
5136
5137         PR gold/13362
5138         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5139         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5140         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5141         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5142         (Relocate_functions::rel_unaligned): New.
5143         (Relocate_functions::rel32_unaligned): New.
5144         * target-reloc.h (relocate_for_relocatable): Add code to handle
5145         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5146         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5147         arm_unaligned_reloc_r): New targets.
5148         * testsuite/Makefile.in: Regenerate.
5149         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5150         linking.
5151
5152 2011-11-02  Ian Lance Taylor  <iant@google.com>
5153
5154         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5155         NATIVE_LINKER.
5156         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5157         * options.cc (General_options::finalize): Use library search path
5158         from configure script if specified.  If not native and no sysroot,
5159         only search TOOLLIBDIR.
5160         * options.h (Search_directory::Search_directory): Change name to
5161         const std::string&.
5162         (General_options::add_to_library_path_with_sysroot): Change arg to
5163         const std::string&.
5164         * configure, Makefile.in, config.in: Rebuild.
5165
5166 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5167
5168         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5169         we are working around the ARM1176 Erratum.
5170         * options.h (General_options::fix_arm1176): Add option.
5171         * testsuite/Makefile.am: Add testcases, and keep current ones
5172         working.
5173         * testsuite/Makefile.in: Regenerate.
5174         * testsuite/arm_fix_1176.s: New file.
5175         * testsuite/arm_fix_1176.sh: Likewise.
5176
5177 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5178
5179         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5180         may_use_blx_.
5181         (Target_arm::may_use_blx): Remove method.
5182         (Target_arm::set_may_use_blx): Likewise.
5183         (Target_arm::may_use_v4t_interworking): New method.
5184         (Target_arm::may_use_v5t_interworking): Likewise.
5185         (Target_arm::may_use_blx_): Remove member variable.
5186         (Arm_relocate_functions::arm_branch_common): Check for v5T
5187         interworking.
5188         (Arm_relocate_functions::thumb_branch_common): Likewise.
5189         (Reloc_stub::stub_type_for_reloc): Likewise.
5190         (Target_arm::do_finalize_sections): Correct interworking checks.
5191         * testsuite/Makefile.am: Add new tests.
5192         * testsuite/Makefile.in: Regenerate.
5193         * testsuite/arm_farcall_arm_arm.s: New test.
5194         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5195         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5196         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5197         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5198         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5199         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5200         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5201
5202 2011-10-31  Cary Coutant  <ccoutant@google.com>
5203
5204         PR gold/13023
5205         * expression.cc (Expression::eval_with_dot): Add
5206         is_section_dot_assignment parameter.
5207         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5208         absolute and assigning to dot within a section.
5209         * script-sections.cc
5210         (Output_section_element_assignment::set_section_addresses): Pass
5211         dot_section to set_if_absolute.
5212         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5213         as is_section_dot_assignment flag to eval_with_dot.
5214         (Output_section_element_dot_assignment::set_section_addresses):
5215         Likewise.
5216         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5217         parameter.  Also set value if relative to dot_section; set the
5218         symbol's output_section.
5219         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5220         parameter.  Adjust all callers.
5221         (Expression::eval_maybe_dot): Likewise.
5222         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5223         Adjust all callers.
5224         * testsuite/script_test_2.t: Test assignment of an absolute value
5225         to dot within an output section element.
5226
5227 2011-10-31  Cary Coutant  <ccoutant@google.com>
5228
5229         * options.h (class General_options): Add --[no-]gnu-unique options.
5230         * symtab.cc (Symbol_table::sized_write_globals): Convert
5231         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5232
5233 2011-10-31  Cary Coutant  <ccoutant@google.com>
5234
5235         PR gold/13359
5236         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5237         unnecessary assertion.
5238         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5239
5240 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5241
5242         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5243         gc_mark_symbol.
5244         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5245         gc_mark_symbol.
5246         Change to just keep the section associated with symbol.
5247         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5248         they are externally visible and --export-dynamic is turned on.
5249         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5250
5251 2011-10-19  Ian Lance Taylor  <iant@google.com>
5252
5253         PR gold/13163
5254         * script-sections.cc
5255         (Output_section_element_dot_assignment::needs_output_section): New
5256         function.
5257
5258 2011-10-19  Ian Lance Taylor  <iant@google.com>
5259
5260         PR gold/13204
5261         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5262         --section-start option was seen.
5263         * options.h (General_options::any_section_start): New function.
5264
5265 2011-10-18  David S. Miller  <davem@davemloft.net>
5266
5267         PR binutils/13301
5268         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5269         member to track relocation locations that have moved during TLS
5270         reloc optimizations.
5271         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5272         (Target_sparc::Relocate::relocate): Adjust view down by 4
5273         bytes if it matches reloc_adjust_addr_.
5274         (Target_sparc::Relocate::relocate_tls): Always move the
5275         __tls_get_addr call delay slot instruction forward 4 bytes when
5276         performing relaxation.
5277
5278 2011-10-18  Cary Coutant  <ccoutant@google.com>
5279
5280         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5281         (Output_file::map_no_anonymous): Check for non-zero
5282         return code from posix_fallocate.
5283
5284 2011-10-17  Cary Coutant  <ccoutant@google.com>
5285
5286         PR gold/13245
5287         * plugin.cc (is_visible_from_outside): Check for symbols
5288         referenced from dynamic objects.
5289         * resolve.cc (Symbol_table::resolve): Don't count references
5290         from dynamic objects as references from real ELF files.
5291         * testsuite/plugin_test_2.sh: Adjust expected result.
5292
5293 2011-10-17  Cary Coutant  <ccoutant@google.com>
5294
5295         * gold.cc: Include timer.h.
5296         (queue_middle_tasks): Stamp time.
5297         (queue_final_tasks): Likewise.
5298         * main.cc (main): Store timer in parameters.  Print timers
5299         for each pass.
5300         * parameters.cc (Parameters::Parameters): Initialize timer_.
5301         (Parameters::set_timer): New function.
5302         (set_parameters_timer): New function.
5303         * parameters.h (Parameters::set_timer): New function.
5304         (Parameters::timer): New function.
5305         (Parameters::timer_): New data member.
5306         (set_parameters_timer): New function.
5307         * timer.cc (Timer::stamp): New function.
5308         (Timer::get_pass_time): New function.
5309         * timer.h (Timer::stamp): New function.
5310         (Timer::get_pass_time): New function.
5311         (Timer::pass_times_): New data member.
5312
5313 2011-10-17  Cary Coutant  <ccoutant@google.com>
5314
5315         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5316         task for members of lib groups.
5317
5318 2011-10-17  Cary Coutant  <ccoutant@google.com>
5319
5320         PR gold/13288
5321         * fileread.cc (File_read::find_view): Add assert.
5322         (File_read::make_view): Move bounds check (replace with assert)...
5323         (File_read::find_or_make_view): ... to here.
5324
5325 2011-10-12  Cary Coutant  <ccoutant@google.com>
5326
5327         * output.cc (Output_file::open_base_file): Handle case where
5328         ::read returns less than requested size.
5329
5330 2011-10-10  Cary Coutant  <ccoutant@google.com>
5331
5332         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5333         Initialize defined_count_.
5334         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5335         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5336         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5337         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5338         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5339         * incremental.h (Sized_relobj_incr::defined_count_): New data
5340         member.
5341         (Sized_incr_dynobj::defined_count_): New data member.
5342         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5343         Return zeroes instead of internal error.
5344
5345 2011-10-10  Cary Coutant  <ccoutant@google.com>
5346
5347         PR gold/13249
5348         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5349         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5350         * output.h (class Output_reloc): Add use_plt_offset flag.
5351         (Output_reloc::type_): Adjust size of bit field.
5352         (Output_reloc::use_plt_offset_): New bit field.
5353         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5354         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5355         flag.  Adjust all callers.
5356         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5357         creating RELATIVE relocations.
5358
5359 2011-10-10  Nick Clifton  <nickc@redhat.com>
5360
5361         * po/es.po: Updated Spanish translation.
5362         * po/fi.po: Updated Finnish translation.
5363
5364 2011-10-03   Diego Novillo  <dnovillo@google.com>
5365
5366         * options.cc (parse_uint): Fix dereference of RETVAL.
5367
5368 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5369
5370         * layout.h (section_order_map_): New member.
5371         (get_section_order_map): New member function.
5372         * output.cc (Output_section::add_input_section): Check for patterns
5373         only when --section-ordering-file is specified.
5374         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5375         output_sections have been formed.
5376         * layout.cc (Layout_Layout): Initialize section_order_map_.
5377         * plugin.cc (update_section_order): Store order in order_map. Do not
5378         update the order.
5379         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5380         * testsuite/Makefile.in: Regenerate.
5381         * testsuite/plugin_section_order.c: New file.
5382         * testsuite/plugin_final_layout.cc: New file.
5383         * testsuite/plugin_final_layout.sh: New file.
5384
5385 2011-09-29  Cary Coutant  <ccoutant@google.com>
5386
5387         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5388         Check for NULL.
5389         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5390         symbols during incremental update.
5391         (Symbol_table::add_from_dynobj): Likewise.
5392
5393 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5394             Ian Lance Taylor  <iant@google.com>
5395
5396         * symtab.cc (Symbol_table::define_special_symbol): Always
5397         canonicalize version string.
5398
5399 2011-09-26  Cary Coutant  <ccoutant@google.com>
5400
5401         * gold.cc (queue_initial_tasks): Move option checks ...
5402         * options.cc (General_options::finalize): ... to here. Disable
5403         some options; make others fatal.
5404
5405 2011-09-26  Cary Coutant  <ccoutant@google.com>
5406
5407         gcc PR lto/47247
5408         * plugin.cc (get_symbols_v2): New function.
5409         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5410         (is_referenced_from_outside): New function.
5411         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5412         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5413         (get_symbols): Pass version parameter.
5414         (get_symbols_v2): New function.
5415         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5416         parameter.
5417         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5418         (onload): Add LDPT_GET_SYMBOLS_V2.
5419         (all_symbols_read_hook): Use get_symbols_v2; check for
5420         LDPR_PREVAILING_DEF_IRONLY_EXP.
5421         * testsuite/plugin_test_3.sh: Update expected results.
5422
5423 2011-09-23  Simon Baldwin  <simonb@google.com>
5424
5425         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5426         configuration options.
5427         * configure: Regenerate.
5428         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5429         * Makefile.in: Regenerate.
5430         * testsuite/Makefile.in: Regenerate.
5431
5432 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5433
5434         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5435
5436 2011-09-19  Cary Coutant  <ccoutant@google.com>
5437
5438         * incremental.cc (can_incremental_update): Fix typo in comment.
5439         * incremental.h (can_incremental_update): Likewise.
5440
5441 2011-09-18  Cary Coutant  <ccoutant@google.com>
5442
5443         * incremental.cc (can_incremental_update): New function.
5444         * incremental.h (can_incremental_update): New function.
5445         * layout.cc (Layout::init_fixed_output_section): Call it.
5446         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5447         * object.cc (Sized_relobj_file::do_layout): Call
5448         can_incremental_update.
5449
5450 2011-09-13  Cary Coutant  <ccoutant@google.com>
5451
5452         * configure.ac: Check for glibc support for gnu_indirect_function
5453         support with static linking, setting automake conditional
5454         IFUNC_STATIC.
5455         * Makefile.in: Regenerate.
5456         * configure: Regenerate.
5457
5458         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5459         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5460         for IFUNC_STATIC.
5461         * testsuite/Makefile.in: Regenerate.
5462
5463 2011-09-13  Cary Coutant  <ccoutant@google.com>
5464
5465         * incremental.cc (Sized_relobj_incr::do_layout): Call
5466         report_comdat_group for kept comdat sections.
5467         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5468         * testsuite/Makefile.in: Regenerate.
5469         * testsuite/incr_comdat_test_1.cc: New source file.
5470         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5471         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5472         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5473
5474 2011-09-13  Ian Lance Taylor  <iant@google.com>
5475
5476         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5477         variable external_symbols_offset.
5478
5479 2011-09-12  Ian Lance Taylor  <iant@google.com>
5480
5481         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5482         triggered if object has no symbols.
5483
5484 2011-09-09  David S. Miller  <davem@davemloft.net>
5485
5486         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5487         (Output_fill_debug_line::do_write): Likewise.
5488
5489 2011-08-29  Cary Coutant  <ccoutant@google.com>
5490
5491         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5492         casts to match formatting specs.
5493         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5494
5495 2011-08-26  Cary Coutant  <ccoutant@google.com>
5496
5497         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5498         remaining hole size when allocating.
5499         (Layout::make_output_section): Set fill methods for debug sections.
5500         * layout.h (Free_list::Free_list_node): Move from private to
5501         public.
5502         (Free_list::set_min_hole_size): New function.
5503         (Free_list::begin, Free_list::end): New functions.
5504         (Free_list::min_hole_): New data member.
5505         * output.cc: Include dwarf.h.
5506         (Output_fill_debug_info::do_minimum_hole_size): New function.
5507         (Output_fill_debug_info::do_write): New function.
5508         (Output_fill_debug_line::do_minimum_hole_size): New function.
5509         (Output_fill_debug_line::do_write): New function.
5510         (Output_section::Output_section): Initialize new data member.
5511         (Output_section::set_final_data_size): Ensure patch space is larger
5512         than minimum hole size.
5513         (Output_section::do_write): Fill holes in debug sections.
5514         * output.h (Output_fill): New class.
5515         (Output_fill_debug_info): New class.
5516         (Output_fill_debug_line): New class.
5517         (Output_section::set_free_space_fill): New function.
5518         (Output_section::free_space_fill_): New data member.
5519         * testsuite/Makefile.am (incremental_test_3): Add
5520         --incremental-patch option.
5521         (incremental_test_4): Likewise.
5522         (incremental_test_5): Likewise.
5523         (incremental_test_6): Likewise.
5524         (incremental_copy_test): Likewise.
5525         (incremental_common_test_1): Likewise.
5526         * testsuite/Makefile.in: Regenerate.
5527
5528 2011-08-26  Nick Clifton  <nickc@redhat.com>
5529
5530         * po/es.po: Updated Spanish translation.
5531
5532 2011-08-01  Cary Coutant  <ccoutant@google.com>
5533
5534         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5535         * gold/testsuite/Makefile.in: Regenerate.
5536         * gold/testsuite/justsyms_exec.c: New source file.
5537         * gold/testsuite/justsyms_lib.c: New source file.
5538
5539 2011-08-01  Cary Coutant  <ccoutant@google.com>
5540
5541         * layout.cc (Layout::set_segment_offsets): Don't realign text
5542         segment if -Ttext was specified.
5543         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5544         file type.
5545         * object.h (Sized_relobj_file::e_type): New function.
5546         (Sized_relobj_file::e_type_): New data member.
5547         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5548         base address for ET_EXEC files.
5549         * target.cc (Target::do_make_elf_object_implementation): Allow
5550         ET_EXEC files with --just-symbols option.
5551
5552 2011-07-28  Cary Coutant  <ccoutant@google.com>
5553
5554         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5555         Add thread_number parameter.
5556         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5557         * workqueue-threads.cc
5558         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5559         current thread if its thread number is greater than desired thread
5560         count.
5561         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5562         Add thread_number parameter.
5563         (Workqueue::should_cancel_thread): Likewise.
5564         (Workqueue::find_runnable_or_wait): Pass thread_number to
5565         should_cancel_thread.
5566         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5567         parameter.
5568
5569 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5570
5571         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5572         only after checking if it cannot be forced local.
5573         * symtab.h (is_externally_visible): Check if the symbol is not forced
5574         local.
5575
5576 2011-07-15  Ian Lance Taylor  <iant@google.com>
5577
5578         * options.h (class General_options): Add --print-output-format.
5579         Move -EL next to -EB, for  better --help output.
5580         * target-select.cc: Include <cstdio>, "options.h", and
5581         "parameters.h".
5582         (Target_selector::do_target_bfd_name): New function.
5583         (print_output_format): New function.
5584         * target-select.h (class Target_selector): Update declarations.
5585         (Target_selector::target_bfd_name): New function.
5586         (print_output_format): Declare.
5587         * main.cc: Include "target-select.h".
5588         (main): Handle --print-output-format.
5589         * gold.cc: Include "target-select.h".
5590         (queue_initial_tasks): Handle --print-output-format when there are
5591         no input files.
5592         * parameters.cc (parameters_force_valid_target): Give a better
5593         error message if -EB/-EL does not match target.
5594         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5595         function.
5596
5597 2011-07-15  Ian Lance Taylor  <iant@google.com>
5598
5599         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5600         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5601         (Output_data_plt_i386::do_write): Write address of .dynamic
5602         section to first entry in .got.plt section.
5603         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5604         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5605         Initialize layout_.
5606         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5607         section to first entry in .got.plt section.
5608         * layout.h (Layout::dynamic_section): New function.
5609
5610 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5611
5612         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5613         to claim_file call.
5614         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5615         input_section_position_, and input_section_glob_.
5616         (read_layout_from_file): Call function section_ordering_specified.
5617         * layout.h (is_section_ordering_specified): New function.
5618         (section_ordering_specified): New function.
5619         (section_ordering_specified_): New boolean member.
5620         * main.cc(main): Call load_plugins after layout object is defined.
5621         * output.cc (Output_section::add_input_section): Use
5622         function section_ordering_specified to check if section ordering is
5623         needed.
5624         * output.cc (Output_section::add_relaxed_input_section): Use
5625         function section_ordering_specified to check if section ordering is
5626         needed.
5627         (Output_section::update_section_layout): New function.
5628         (Output_section::sort_attached_input_sections): Check if input section
5629         must be reordered.
5630         * output.h (Output_section::update_section_layout): New function.
5631         * plugin.cc (get_section_count): New function.
5632         (get_section_type): New function.
5633         (get_section_name): New function.
5634         (get_section_contents): New function.
5635         (update_section_order): New function.
5636         (allow_section_ordering): New function.
5637         (Plugin::load): Add the new interfaces to the transfer vector.
5638         (Plugin_manager::load_plugins): New parameter.
5639         (Plugin_manager::all_symbols_read): New parameter.
5640         (Plugin_manager::claim_file): New parameter. Save the elf object for
5641         unclaimed objects.
5642         (Plugin_manager::get_elf_object): New function.
5643         (Plugin_manager::get_view): Change to directly use the bool to check
5644         if get_view is called from claim_file_hook.
5645         * plugin.h (input_objects): New function
5646         (Plugin__manager::load_plugins): New parameter.
5647         (Plugin_manager::claim_file): New parameter.
5648         (Plugin_manager::get_elf_object): New function.
5649         (Plugin_manager::in_claim_file_handler): New function.
5650         (Plugin_manager::in_claim_file_handler_): New member.
5651         (layout): New function.
5652         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5653         handler with an extra parameter. Make the elf object before calling
5654         claim_file handler.
5655         * testsuite/plugin_test.c (get_section_count): New function pointer.
5656         (get_section_type): New function pointer.
5657         (get_section_name): New function pointer.
5658         (get_section_contents): New function pointer.
5659         (update_section_order): New function pointer.
5660         (allow_section_ordering): New function pointer.
5661         (onload): Check if the new interfaces exist.
5662
5663 2011-07-13  Ian Lance Taylor  <iant@google.com>
5664
5665         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5666         relro section.
5667         * x86_64.cc (Target_x86_64::got_section): Likewise.
5668         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5669         (relro_now_test_SOURCES): New variable.
5670         (relro_now_test_DEPENDENCIES): New variable.
5671         (relro_now_test_LDFLAGS): New variable.
5672         (relro_now_test_LDADD): New variable.
5673         (relro_now_test.so): New target.
5674         * testsuite/Makefile.in: Rebuild.
5675
5676 2011-07-12  Ian Lance Taylor  <iant@google.com>
5677
5678         PR gold/12980
5679         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5680         GLOB_DAT relocation rather than a RELATIVE relocation for a
5681         protected symbol when creating a shared library.
5682         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5683         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5684         * testsuite/protected_main_1.cc (main): Test that protected
5685         function has same address.
5686
5687 2011-07-11  Ian Lance Taylor  <iant@google.com>
5688
5689         PR gold/12979
5690         * options.h (class General_options): Add -Bgroup.
5691         * options.cc (General_options::finalize): If -Bgroup is set,
5692         default to --unresolved-symbols=report-all.
5693         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5694         * target-reloc.h (issue_undefined_symbol_error): Handle
5695         --unresolved-symbols=report-all.
5696
5697 2011-07-08  Ian Lance Taylor  <iant@google.com>
5698
5699         PR gold/11985
5700         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5701         if linker script discards key sections.
5702         (Layout::create_dynamic_symtab): Likewise.
5703         (Layout::assign_local_dynsym_offsets): Likewise.
5704         (Layout::sized_create_version_sections): Likewise.
5705         (Layout::create_interp): Likewise.
5706         (Layout::finish_dynamic_section): Likewise.
5707         (Layout::set_dynamic_symbol_size): Likewise.
5708
5709 2011-07-08  Ian Lance Taylor  <iant@google.com>
5710
5711         PR gold/12386
5712         * options.h (class General_options): Add --unresolved-symbols.
5713         * target-reloc.h (issue_undefined_symbol_error): Check
5714         --unresolved-symbols.  Add comments.
5715
5716 2011-07-08  Ian Lance Taylor  <iant@google.com>
5717
5718         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5719         expression more complex.
5720
5721 2011-07-08  Ian Lance Taylor  <iant@google.com>
5722
5723         PR gold/11317
5724         * target-reloc.h (issue_undefined_symbol_error): New inline
5725         function, broken out of relocate_section.
5726         (relocate_section): Call issue_undefined_symbol_error.
5727         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5728         there is no TLS segment if we are about to issue an undefined
5729         symbol error.
5730         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5731
5732 2011-07-08  Ian Lance Taylor  <iant@google.com>
5733
5734         PR gold/12279
5735         * resolve.cc (Symbol_table::should_override): Add fromtype
5736         parameter.  Change all callers.  Give error when linking together
5737         TLS and non-TLS symbol.
5738         (Symbol_table::should_override_with_special): Add fromtype
5739         parameter.  Change all callers.
5740         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5741         there is no TLS segment if we have reported some errors.
5742         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5743
5744 2011-07-08  Ian Lance Taylor  <iant@google.com>
5745
5746         PR gold/12372
5747         * target.h (Target::plt_address_for_global): New function.
5748         (Target::plt_address_for_local): New function.
5749         (Target::plt_section_for_global): Remove.
5750         (Target::plt_section_for_local): Remove.
5751         (Target::do_plt_address_for_global): New virtual function.
5752         (Target::do_plt_address_for_local): New virtual function.
5753         (Target::do_plt_section_for_global): Remove.
5754         (Target::do_plt_section_for_local): Remove.
5755         (Target::register_global_plt_entry): Add Symbol_table and Layout
5756         parameters.
5757         * output.cc (Output_data_got::Got_entry::write): Use
5758         plt_address_for_global and plt_address_for_local.
5759         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5760         address of output section.
5761         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5762         got_irelative_, and irelative_count_ fields.  Update
5763         declarations.
5764         (Output_data_plt_i386::has_irelative_section): New function.
5765         (Output_data_plt_i386::entry_count): Add irelative_count_.
5766         (Output_data_plt_i386::set_final_data_size): Likewise.
5767         (class Target_i386): Add got_irelative_ and rel_irelative_
5768         fields.  Update declarations.
5769         (Target_i386::Target_i386): Initialize new fields.
5770         (Target_i386::do_plt_address_for_global): New function replacing
5771         do_plt_section_for_global.
5772         (Target_i386::do_plt_address_for_local): New function replacing
5773         do_plt_section_for_local.
5774         (Target_i386::got_section): Create got_irelative_.
5775         (Target_i386::rel_irelative_section): New function.
5776         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5777         fields.  Don't define __rel_iplt_{start,end}.
5778         (Output_data_plt_i386::add_entry): Add symtab and layout
5779         parameters.  Change all callers.  Use different PLT and GOT for
5780         IFUNC symbols.
5781         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5782         layout parameters.  Change all callers.  Use different PLT and
5783         GOT.
5784         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5785         (Output_data_plt_i386::rel_irelative): New function.
5786         (Output_data_plt_i386::address_for_global): New function.
5787         (Output_data_plt_i386::address_for_local): New function.
5788         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5789         IRELATIVE GOT when changing IFUNC GOT entries.
5790         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5791         reloc.
5792         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5793         if we didn't create an IRELATIVE GOT.
5794         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5795         plt_address_for_local.
5796         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5797         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5798         got_irelative_, and irelative_count_ fields.  Update
5799         declarations.
5800         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5801         Initialize new fields.  Remove symtab parameter.  Change all
5802         callers.
5803         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5804         irelative_count_.
5805         (Output_data_plt_x86_64::has_irelative_section): New function.
5806         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5807         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5808         fields.  Update declarations.
5809         (Target_x86_64::Target_x86_64): Initialize new fields.
5810         (Target_x86_64::do_plt_address_for_global): New function replacing
5811         do_plt_section_for_global.
5812         (Target_x86_64::do_plt_address_for_local): New function replacing
5813         do_plt_section_for_local.
5814         (Target_x86_64::got_section): Create got_irelative_.
5815         (Target_x86_64::rela_irelative_section): New function.
5816         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5817         all callers.  Don't create __rel_iplt_{start,end}.
5818         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5819         parameters.  Change all callers.  Use different PLT and GOT for
5820         IFUNC symbols.
5821         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5822         layout parameters.  Change all callers.  Use different PLT and
5823         GOT.
5824         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5825         parameters.  Change all callers.  Use different PLT and GOT for
5826         IFUNC symbols.
5827         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5828         (Output_data_plt_x86_64::rela_irelative): New function.
5829         (Output_data_plt_x86_64::address_for_global): New function.
5830         (Output_data_plt_x86_64::address_for_local): New function.
5831         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5832         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5833         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5834         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5835         parameters.
5836         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5837         reloc.
5838         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5839         symbols if we didn't create an IRELATIVE GOT.
5840         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5841         plt_address_for_local.
5842         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5843         * testsuite/ifuncvar1.c: New test file.
5844         * testsuite/ifuncvar2.c: New test file.
5845         * testsuite/ifuncvar3.c: New test file.
5846         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5847         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5848         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5849         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5850         * testsuite/Makefile.in: Rebuild.
5851
5852 2011-07-07  Cary Coutant  <ccoutant@google.com>
5853
5854         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5855         (two_file_test_1_ndebug.o): Likewise.
5856         (two_file_test_1b_ndebug.o): Likewise.
5857         (two_file_test_2_ndebug.o): Likewise.
5858         (two_file_test_main_ndebug.o): Likewise.
5859         (incremental_test_2): Link with no-debug versions.
5860
5861 2011-07-06  Cary Coutant  <ccoutant@google.com>
5862
5863         * gold/incremental.cc
5864         (Output_section_incremental_inputs::write_info_blocks): Check for
5865         hidden and internal symbols.
5866
5867 2011-07-06  Cary Coutant  <ccoutant@google.com>
5868
5869         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5870         Check disposition for startup file.
5871         (Incremental_inputs::report_command_line): Ignore
5872         --incremental-startup-unchanged option.
5873         * options.cc (General_options::parse_incremental_startup_unchanged):
5874         New function.
5875         (General_options::General_options): Initialize new data member.
5876         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5877         (General_options): Add --incremental-startup-unchanged option.
5878         (General_options::incremental_startup_disposition): New function.
5879         (General_options::incremental_startup_disposition_): New data member.
5880
5881 2011-07-06  Cary Coutant  <ccoutant@google.com>
5882
5883         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5884         input file index to Script_info ctor.
5885         (Sized_incremental_binary::do_file_has_changed): Find the
5886         command-line argument for files named in scripts.
5887         * incremental.h (Script_info::Script_info): New ctor
5888         with input file index.
5889         (Script_info::input_file_index): New function.
5890         (Script_info::input_file_index_): New data member.
5891         (Incremental_binary::get_library): Add const.
5892         (Incremental_binary::get_script_info): Add const.
5893         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5894         * testsuite/Makefile.am (incremental_test_5): New test case.
5895         (incremental_test_6): New test case.
5896         * testsuite/Makefile.in: Regenerate.
5897
5898 2011-07-06  Cary Coutant  <ccoutant@google.com>
5899
5900         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5901         debug output when command lines differ.
5902
5903 2011-07-06  Cary Coutant  <ccoutant@google.com>
5904
5905         * incremental.cc (Incremental_inputs::report_command_line): Ignore
5906         --incremental-patch option.
5907         * layout.cc (Free_list::allocate): Extend allocation beyond original
5908         end if enabled.
5909         (Layout::make_output_section): Mark sections that should get
5910         patch space.
5911         * options.cc (parse_percent): New function.
5912         * options.h (parse_percent): New function.
5913         (DEFINE_percent): New macro.
5914         (General_options): Add --incremental-patch option.
5915         * output.cc (Output_section::Output_section): Initialize new data
5916         members.
5917         (Output_section::add_input_section): Print section name when out
5918         of patch space.
5919         (Output_section::add_output_section_data): Likewise.
5920         (Output_section::set_final_data_size): Add patch space when
5921         doing --incremental-full.
5922         (Output_section::do_reset_address_and_file_offset): Remove patch
5923         space.
5924         (Output_segment::set_section_list_addresses): Print debug output
5925         only if --incremental-update.
5926         * output.h (Output_section::set_is_patch_space_allowed): New function.
5927         (Output_section::is_patch_space_allowed_): New data member.
5928         (Output_section::patch_space_): New data member.
5929         * parameters.cc (Parameters::incremental_full): New function.
5930         * parameters.h (Parameters::incremental_full): New function
5931         * testsuite/Makefile.am (incremental_test_2): Add test for
5932         --incremental-patch option.
5933         * testsuite/Makefile.in: Regenerate.
5934         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5935         (t18): Remove function body.
5936
5937 2011-07-05  Doug Kwan  <dougkwan@google.com>
5938
5939         PR gold/12771
5940         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5941         Arm_Address type for relocation result.
5942         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
5943         overflow check.
5944         (Arm_relocate_functions::abs32): Use unaligned access.
5945         (Arm_relocate_functions::rel32): Ditto.
5946         (Arm_relocate_functions::prel31): Ditto.
5947         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5948         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5949         static data relocations.
5950         * testsuite/Makefile.in: Regnerate.
5951         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5952
5953 2011-07-05  Ian Lance Taylor  <iant@google.com>
5954
5955         PR gold/12392
5956         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5957         symbols if necessary.
5958         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5959
5960 2011-07-05  Ian Lance Taylor  <iant@google.com>
5961
5962         PR gold/12952
5963         * resolve.cc (Symbol::override_base_with_special): Simply override
5964         version with special symbol version, ignoring previous version.
5965
5966 2011-07-05  Ian Lance Taylor  <iant@google.com>
5967
5968         * object.cc (Sized_relobj_file::include_section_group): Add
5969         information to comment about signature location.
5970
5971 2011-07-02  Ian Lance Taylor  <iant@google.com>
5972
5973         PR gold/12957
5974         * options.h (class General_options): Add -f and -F.
5975         * options.cc (General_options::finalize): Fatal error if -f/-F
5976         are used without -shared.
5977         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5978
5979 2011-07-02  Ian Lance Taylor  <iant@google.com>
5980
5981         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5982
5983 2011-07-01  Ian Lance Taylor  <iant@google.com>
5984
5985         PR gold/12525
5986         PR gold/12952
5987         * resolve.cc (Symbol::override_base_with_special): Don't override
5988         the version if the overriding symbol has a different name.
5989         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
5990         all callers.  If we give an error about an undefined version,
5991         define the base version if necessary.
5992         * dynobj.h (class Versions): Update declaration.
5993         * testsuite/weak_alias_test_5.cc: New file.
5994         * testsuite/weak_alias_test.script: New file.
5995         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5996         and versioned_alias have the right value, and call t2.
5997         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5998         weak_alias_test_5.so.
5999         (weak_alias_test_LDADD): Likewise.
6000         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6001         * testsuite/Makefile.in: Rebuild.
6002
6003 2011-07-01  Ian Lance Taylor  <iant@google.com>
6004
6005         PR gold/12525
6006         * options.h (class General_options): Support -z notext.
6007         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6008         -Wl,-z,notext.
6009         (two_file_shared_nonpic.so): Likewise.
6010         (two_file_shared_mixed.so): Likewise.
6011         (two_file_shared_mixed_1.so): Likewise.
6012         (weak_undef_lib_nonpic.so): Likewise.
6013         (alt/weak_undef_lib_nonpic.so): Likewise.
6014         (tls_test_shared_nonpic.so): Likewise.
6015         * testsuite/Makefile.in: Rebuild.
6016
6017 2011-07-01  Ian Lance Taylor  <iant@google.com>
6018
6019         PR gold/12525
6020         * configure.ac: Test whether static linking works, setting
6021         the automake conditional HAVE_STATIC.
6022         * testsuite/Makefile.am: Disable tests using -static if
6023         HAVE_STATIC is not true.
6024         * configure, testsuite/Makefile.in: Rebuild.
6025
6026 2011-07-01  Ian Lance Taylor  <iant@google.com>
6027
6028         PR gold/12525
6029         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6030         Assert if we see DW_EH_PE_indirect.
6031         * target.h (Target::ehframe_datarel_base): New function.
6032         (Target::do_ehframe_datarel_base): New target function.
6033         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6034         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6035         function.
6036
6037 2011-07-01  Ian Lance Taylor  <iant@google.com>
6038
6039         PR gold/12571
6040         * options.h (class General_options): Add
6041         --ld-generated-unwind-info.
6042         * ehframe.cc (Fde::write): Add address parameter.  Change all
6043         callers.  If associated with PLT, fill in address and size.
6044         (Cie::set_output_offset): Only add merge mapping if there is an
6045         object.
6046         (Cie::write): Add address parameter.  Change all callers.
6047         (Eh_frame::add_ehframe_for_plt): New function.
6048         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6049         input_offset_ fields into union u_, with new plt field.
6050         (Fde::Fde): Adjust for new union field.
6051         (Fde::Fde) [Output_data version]: New constructor.
6052         (Fde::add_mapping): Only add merge mapping if there is an object.
6053         (class Cie): Update declarations.
6054         (class Eh_frame): Declare add_ehframe_for_plt.
6055         * layout.cc (Layout::layout_eh_frame): Break out code into
6056         make_eh_frame_section, and call it.
6057         (Layout::make_eh_frame_section): New function.
6058         (Layout::add_eh_frame_for_plt): New function.
6059         * layout.h (class Layout): Update declarations.
6060         * merge.cc (Merge_map::add_mapping): Add assertion.
6061         * i386.cc: Include "dwarf.h".
6062         (class Output_data_plt_i386): Make first_plt_entry,
6063         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6064         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6065         and plt_eh_frame_fde.
6066         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6067         boundary.  Call add_eh_frame_for_plt if appropriate.
6068         * x86_64.cc: Include "dwarf.h".
6069         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6070         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6071         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6072         and plt_eh_frame_fde.
6073         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6074         appropriate.
6075
6076 2011-06-29  Ian Lance Taylor  <iant@google.com>
6077
6078         PR gold/12629
6079         * object.cc (Sized_relobj_file::layout_section): Change shdr
6080         parameter to be const.
6081         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6082         out of do_layout.
6083         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6084         appropriate.  Call layout_eh_frame_section.
6085         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6086         sections.
6087         * object.h (class Sized_relobj_file): Update declarations.
6088
6089 2011-06-29  Ian Lance Taylor  <iant@google.com>
6090
6091         PR gold/12652
6092         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6093         modifier.
6094         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6095
6096 2011-06-29  Ian Lance Taylor  <iant@google.com>
6097
6098         PR gold/12675
6099         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6100         SHT_X86_64_UNWIND.
6101         * layout.cc (Layout::layout_eh_frame): Likewise.
6102
6103 2011-06-29  Ian Lance Taylor  <iant@google.com>
6104
6105         PR gold/12695
6106         * layout.cc (Layout::symtab_section_shndx): New function.
6107         * layout.h (class Layout): Declare symtab_section_shndx.
6108         * output.cc (Output_section::write_header): Call it.
6109
6110 2011-06-29  Ian Lance Taylor  <iant@google.com>
6111
6112         PR gold/12818
6113         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6114         symbols which are not used in a relocation.
6115
6116 2011-06-28  Ian Lance Taylor  <iant@google.com>
6117
6118         PR gold/12898
6119         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6120         script create indistinguishable segments.
6121         (Layout::set_segment_offsets): Use stable_sort when sorting
6122         segments.  Pass this to Compare_segments constructor.
6123         * layout.h (class Layout): Make segment_precedes non-static.
6124         (class Compare_segments): Change from struct to class.  Add
6125         layout_ field.  Add constructor.
6126         * script-sections.cc
6127         (Script_sections::attach_sections_using_phdrs_clause): Rename
6128         local orphan to is_orphan.  Don't report failure to put empty
6129         section in segment.  On attachment failure, report name of
6130         section, and attach to first PT_LOAD segment.
6131
6132 2011-06-28  Ian Lance Taylor  <iant@google.com>
6133
6134         PR gold/12934
6135         * target-select.cc (Target_selector::Target_selector): Add
6136         emulation parameter.  Change all callers.
6137         (select_target_by_bfd_name): Rename from select_target_by_name.
6138         Change all callers.
6139         (select_target_by_emulation): New function.
6140         (supported_emulation_names): New function.
6141         * target-select.h (class Target_selector): Add emulation_ field.
6142         Update declarations.
6143         (Target_selector::recognize_by_bfd_name): Rename from
6144         recognize_by_name.  Change all callers.
6145         (Target_selector::supported_bfd_names): Rename from
6146         supported_names.  Change all callers.
6147         (Target_selector::recognize_by_emulation): New function.
6148         (Target_selector::supported_emulations): New function.
6149         (Target_selector::emulation): New function.
6150         (Target_selector::do_recognize_by_bfd_name): Rename from
6151         do_recognize_by_name.  Change all callers.
6152         (Target_selector::do_supported_bfd_names): Rename from
6153         do_supported_names.  Change all callers.
6154         (Target_selector::do_recognize_by_emulation): New function.
6155         (Target_selector::do_supported_emulations): New function.
6156         (select_target_by_bfd_name): Change name in declaration.
6157         (select_target_by_emulation): Declare.
6158         (supported_emulation_names): Declare.
6159         * parameters.cc (parameters_force_valid_target): Try to find
6160         target based on emulation from -m option.
6161         * options.h (class General_options): Change doc string for -m.
6162         * options.cc (help): Print emulations.
6163         (General_options::parse_V): Likewise.
6164         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6165         Add emulation parameter.  Change all callers.
6166
6167 2011-06-28  Ian Lance Taylor  <iant@google.com>
6168
6169         * target.h (class Target): Add osabi_ field.
6170         (Target::osabi): New function.
6171         (Target::set_osabi): New function.
6172         (Target::Target): Initialize osabi_.
6173         (Target::do_adjust_elf_header): Make pure virtual.
6174         (Sized_target::do_adjust_elf_header): Declare.
6175         * target.cc (Sized_target::do_adjust_elf_header): New function.
6176         (class Sized_target): Instantiate all versions.
6177         * freebsd.h (class Target_freebsd): Remove.
6178         (Target_selector_freebsd::do_recognize): Call set_osabi on
6179         Target.
6180         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6181         (Target_selector_freebsd::set_osabi): Remove.
6182         * i386.cc (class Target_i386): Inherit from Sized_target rather
6183         than Target_freebsd.
6184         * x86_64.cc (class Target_x86_64): Likewise.
6185
6186 2011-06-28  Ian Lance Taylor  <iant@google.com>
6187
6188         * target.h (Target::can_check_for_function_pointers): Rewrite.
6189         Make non-virtual.
6190         (Target::can_icf_inline_merge_sections): Likewise.
6191         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6192         (Target::Target_info): Add can_icf_inline_merge_sections field.
6193         (Target::do_can_check_for_function_pointers): New virtual
6194         function.
6195         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6196         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6197         from can_check_for_function_pointers, move in file.
6198         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6199         section_may_have_icf_unsafe_poineters, move in file.
6200         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6201         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6202         Rename from can_check_for_function_pointers, move in file.
6203         (Target_i386::can_icf_inline_merge_sections): Remove.
6204         (Target_i386::i386_info): Initialize
6205         can_icf_inline_merge_sections.
6206         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6207         Initialize can_icf_inline_merge_sections.
6208         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6209         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6210         Rename from can_check_for_function_pointers, move in file.
6211         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6212         (Target_x86_64::x86_64_info): Initialize
6213         can_icf_inline_merge_sections.
6214         * testsuite/testfile.cc (Target_test::test_target_info):
6215         Likewise.
6216         * icf.cc (get_section_contents): Correct formatting.
6217
6218 2011-06-27  Ian Lance Taylor  <iant@google.com>
6219
6220         * symtab.cc (Symbol::versioned_name): New function.
6221         (Symbol_table::add_to_final_symtab): Use versioned_name when
6222         appropriate.
6223         (Symbol_table::sized_write_symbol): Likewise.
6224         * symtab.h (class Symbol): Declare versioned_name.
6225         * stringpool.h (class Stringpool_template): Add variant of add
6226         which takes a std::basic_string.
6227         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6228         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6229         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6230         (ver_test_12.o): New target.
6231         * testsuite/Makefile.in: Rebuild.
6232
6233 2011-06-27  Doug Kwan  <dougkwan@google.com>
6234
6235         * arm.cc (Arm_relocate_functions::thm_jump8,
6236         Arm_relocate_functions::thm_jump11): Use a wider signed
6237         type to compute offset.
6238         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6239         arm_thm_jump8.
6240         * testsuite/Makefile.in: Regenerate.
6241         * testsuite/arm_branch_in_range.sh: Check test results of
6242         arm_thm_jump11 and arm_thm_jump8.
6243         * testsuite/arm_thm_jump11.s: New test source file.
6244         * testsuite/arm_thm_jump11.t: New linker script.
6245         * testsuite/arm_thm_jump8.s: New test source file.
6246         * testsuite/arm_thm_jump8.t: New linker script.
6247
6248 2011-06-24  Ian Lance Taylor  <iant@google.com>
6249
6250         * layout.cc: Include "object.h".
6251         (ctors_sections_in_init_array): New static variable.
6252         (Layout::is_ctors_in_init_array): New function.
6253         (Layout::layout): Add entry to ctors_sections_in_init_array if
6254         appropriate.
6255         * layout.h (class Layout): Declare is_ctors_in_init_array.
6256         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6257         is_ctors_reverse_view is set.
6258         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6259         all callers.  Set is_ctors_reverse_view field of View_size.
6260         (Sized_relobj_file::reverse_words): New function.
6261         * object.h (Sized_relobj_file::View_size): Add
6262         is_ctors_reverse_view field.
6263         (class Sized_relobj_file): Update declarations.
6264         * testsuite/initpri3.c: New test.
6265         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6266         initpri3b.
6267         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6268         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6269         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6270         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6271         * testsuite/Makefile.in: Rebuild.
6272
6273 2011-06-24  Cary Coutant  <ccoutant@google.com>
6274
6275         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6276         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6277         (debug_msg_cdebug.err): New targets.
6278         * testsuite/Makefile.in: Regenerate.
6279         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6280         Fix checks for link with shared library.
6281
6282 2011-06-24  Doug Kwan  <dougkwan@google.com>
6283
6284         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6285         skip empty text sections.
6286         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6287
6288 2011-06-22  Ian Lance Taylor  <iant@google.com>
6289
6290         PR gold/12910
6291         * options.h (class General_options): Add --ctors-in-init-array.
6292         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6293         friends as SHT_PROGBITS for merging sections.
6294         (Layout::layout): Remove special handling of .init_array and
6295         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6296         and .dtors if ctors_in_init_array.
6297         (Layout::make_output_section): Force correct section types for
6298         .init_array and friends.  Don't sort if doing relocatable link,
6299         Don't sort .ctors and .dtors if ctors_in_init_array.
6300         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6301         (Layout::output_section_name): Add relobj parameter.  Change all
6302         callers.  Handle .ctors. and .dtors. in code rather than table.
6303         Handle .ctors and .dtors if ctors_in_init_array.
6304         (Layout::match_file_name): New function, moved from output.cc.
6305         * layout.h (class Layout): Update declarations.
6306         * output.cc: Include "layout.h".
6307         (Input_section_sort_entry::get_priority): New function.
6308         (Input_section_sort_entry::match_file_name): Just call
6309         Layout::match_file_name.
6310         (Output_section::Input_section_sort_init_fini_compare::operator()):
6311         Handle .ctors and .dtors.  Sort by explicit priority rather than
6312         by name.
6313         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6314         * testsuite/initpri2.c: New test.
6315         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6316         (check_PROGRAMS): Add initpri2.
6317         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6318         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6319         * configure, testsuite/Makefile.in: Rebuild.
6320
6321 2011-06-19  Ian Lance Taylor  <iant@google.com>
6322
6323         PR gold/12880
6324         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6325         .interp section to a PT_INTERP segment even if we have seen a
6326         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6327         clause in a linker script.
6328         (Layout::finalize): Don't create a .interp section if we've
6329         already create a PT_INTERP segment.
6330         (Layout::create_interp): Always call choose_output_section (revert
6331         patch of 2011-06-17).  Don't create PT_INTERP segment.
6332         * script-sections.cc
6333         (Script_sections::create_note_and_tls_segments): Add a .interp
6334         section to a PT_INTERP segment even if we have seen a
6335         --dynamic-linker option.
6336
6337 2011-06-18  Ian Lance Taylor  <iant@google.com>
6338
6339         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6340         merely because a non-PT_LOAD segment has a dynamic reloc.
6341
6342 2011-06-18  Ian Lance Taylor  <iant@google.com>
6343
6344         * layout.cc (Layout::finish_dynamic_section): Don't create
6345         DT_FLAGS entry if not needed.
6346
6347 2011-06-18  Ian Lance Taylor  <iant@google.com>
6348
6349         PR gold/12745
6350         * layout.cc (Layout::layout_eh_frame): Correct handling of
6351         writable .eh_frame section.
6352
6353 2011-06-17  Ian Lance Taylor  <iant@google.com>
6354
6355         PR gold/12893
6356         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6357         symbol is redefined with the exact same object and value.
6358
6359 2011-06-17  Ian Lance Taylor  <iant@google.com>
6360
6361         PR gold/12880
6362         * layout.h (class Layout): Add interp_segment_ field.
6363         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6364         (Layout::attach_allocated_section_to_segment): If making shared
6365         library, put .interp section in PT_INTERP segment.
6366         (Layout::finalize): Also call create_interp if -dynamic-linker
6367         option was used.
6368         (Layout::create_interp): Assert that there is no PT_INTERP
6369         segment.  If not using a SECTIONS clause, use make_output_section.
6370         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6371         * script-sections.cc
6372         (Script_sections::create_note_and_tls_segments): If making shared
6373         library, put .interp section in PT_INTERP segment.
6374
6375 2011-06-17  Ian Lance Taylor  <iant@google.com>
6376
6377         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6378         when making a shared library.
6379
6380 2011-06-17  Ian Lance Taylor  <iant@google.com>
6381
6382         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6383         parameter.  Change all callers.  Don't issue warning about PC32
6384         against locally defined symbol.
6385
6386 2011-06-16  Ian Lance Taylor  <iant@google.com>
6387
6388         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6389         occurs in same object.
6390
6391 2011-06-14  Alan Modra  <amodra@gmail.com>
6392
6393         * po/POTFILES.in: Regenerate.
6394
6395 2011-06-09  Ian Lance Taylor  <iant@google.com>
6396
6397         * script-sections.cc
6398         (Orphan_output_section::set_section_addresses): For a relocatable
6399         link set address to 0.
6400
6401 2011-06-09  Cary Coutant  <ccoutant@google.com>
6402
6403         PR gold/12804
6404         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6405         used with --compress-debug-sections.
6406         * gold/object.cc (Sized_relobj_file::do_layout): Report
6407         uncompressed size of compressed input sections.
6408
6409 2011-06-08  Cary Coutant  <ccoutant@google.com>
6410
6411         PR gold/12804
6412         * testsuite/two_file_test_2_v1.cc: Change initialization of
6413         v2 to keep it in .data.
6414
6415 2011-06-07  Cary Coutant  <ccoutant@google.com>
6416
6417         * common.cc (Symbol_table::do_allocate_commons_list): Call
6418         gold_fallback.
6419         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6420         (Errors::fallback): New function.
6421         (gold_fallback): New function.
6422         * errors.h (Errors::fallback): New function.
6423         * gold.cc (gold_exit): Change status parameter to enum; adjust
6424         all callers.
6425         (queue_initial_tasks): Call gold_fallback.
6426         * gold.h: Include cstdlib.
6427         (Exit_status): New enum type.
6428         (gold_exit): Change status parameter to enum.
6429         (gold_fallback): New function.
6430         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6431         (Layout::create_symtab_sections): Likewise.
6432         (Layout::create_shdrs): Likewise.
6433         * main.cc (main): Adjust call to gold_exit.
6434         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6435         (Output_data_got::add_got_entry_pair): Likewise.
6436         (Output_section::add_input_section): Likewise.
6437         (Output_section::add_output_section_data): Likewise.
6438         (Output_segment::set_section_list_addresses): Likewise.
6439         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6440
6441 2011-06-07  Cary Coutant  <ccoutant@google.com>
6442
6443         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6444         for incremental links.
6445         * output.cc (Output_segment::set_section_list_addresses): Remove
6446         FIXME and test for TLS or BSS.
6447
6448 2011-06-07  Cary Coutant  <ccoutant@google.com>
6449
6450         * testsuite/Makefile.am: Add incremental_copy_test,
6451         incremental_common_test_1.
6452         * testsuite/Makefile.in: Regenerate.
6453         * testsuite/common_test_1_v1.c: New source file.
6454         * testsuite/common_test_1_v2.c: New source file.
6455         * testsuite/copy_test_v1.cc: New source file.
6456
6457 2011-06-07  Cary Coutant  <ccoutant@google.com>
6458
6459         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6460         update, allocate common from bss section's free list.
6461         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6462         linker-defined symbols.
6463         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6464         Skip GOT and PLT entries that are no longer referenced.
6465         (Output_section_incremental_inputs::write_info_blocks): Mark
6466         linker-defined symbols.
6467         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6468         * output.cc (Output_section::allocate): New function.
6469         * output.h (Output_section::allocate): New function.
6470         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6471         linker-defined symbols.
6472         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6473         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6474         (Symbol::init_base_output_data): Likewise.
6475         (Symbol::init_base_output_segment): Likewise.
6476         (Symbol::init_base_constant): Likewise.
6477         (Sized_symbol::init_output_data): Likewise.
6478         (Sized_symbol::init_output_segment): Likewise.
6479         (Sized_symbol::init_constant): Likewise.
6480         (Symbol_table::do_define_in_output_data): Likewise.
6481         (Symbol_table::do_define_in_output_segment): Likewise.
6482         (Symbol_table::do_define_as_constant): Likewise.
6483         * symtab.h (Symbol::is_predefined): New function.
6484         (Symbol::init_base_output_data): Add is_predefined parameter.
6485         (Symbol::init_base_output_segment): Likewise.
6486         (Symbol::init_base_constant): Likewise.
6487         (Symbol::is_predefined_): New data member.
6488         (Sized_symbol::init_output_data): Add is_predefined parameter.
6489         (Sized_symbol::init_output_segment): Likewise.
6490         (Sized_symbol::init_constant): Likewise.
6491         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6492
6493 2011-06-07  Cary Coutant  <ccoutant@google.com>
6494
6495         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6496         instead of emit_copy_reloc.
6497         (Copy_relocs::emit_copy_reloc): Refactor.
6498         (Copy_relocs::make_copy_reloc): New function.
6499         (Copy_relocs::add_copy_reloc): Remove.
6500         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6501         section.
6502         (Copy_relocs::make_copy_reloc): New function.
6503         (Copy_relocs::add_copy_reloc): Remove.
6504         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6505         unchanged input files.
6506         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6507         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6508         Reserve BSS space for COPY relocations.
6509         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6510         (Output_section_incremental_inputs::write_info_blocks): Record
6511         whether a symbol is copied from a shared object.
6512         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6513         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6514         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6515         (Incremental_input_entry_reader::get_output_symbol_index): Add
6516         is_copy parameter.
6517         (Incremental_binary::emit_copy_relocs): New function.
6518         (Incremental_binary::do_emit_copy_relocs): New function.
6519         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6520         new data member.
6521         (Sized_incremental_binary::add_copy_reloc): New function.
6522         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6523         (Sized_incremental_binary::Copy_reloc): New struct.
6524         (Sized_incremental_binary::Copy_relocs): New typedef.
6525         (Sized_incremental_binary::copy_relocs_): New data member.
6526         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6527         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6528         * target.h (Sized_target::emit_copy_reloc): New function.
6529         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6530
6531 2011-06-02  Cary Coutant  <ccoutant@google.com>
6532
6533         PR gold/12163
6534         * gold/archive.cc (Archive::Archive): Initialize new data member.
6535         (Archive::include_all_members): Return if archive has already been
6536         included.
6537         * gold/archive.h (Archive::include_all_members_): New data member.
6538
6539 2011-06-02  Nick Clifton  <nickc@redhat.com>
6540
6541         * dynobj.h: Fix spelling mistake in comment.
6542         * output.cc: Likewise.
6543
6544 2011-05-31  Doug Kwan  <dougkwan@google.com>
6545             Asier Llano
6546
6547         PR gold/12826
6548         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6549         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6550         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6551         redundant arm_exidx_test.so.
6552         * testsuite/Makefile.in: Regenerate.
6553         (check_SCRIPTS): Add pr12826.sh
6554         (check_DATA): Add pr12826.stdout
6555         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6556         * testsuite/pr12826.sh: New file.
6557         * testsuite/pr12826_1.s: Ditto.
6558         * testsuite/pr12826_1.s: Ditto.
6559
6560 2011-05-30  Ian Lance Taylor  <iant@google.com>
6561
6562         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6563         sections.
6564
6565 2011-05-29  Ian Lance Taylor  <iant@google.com>
6566
6567         PR gold/12804
6568         * testsuite/Makefile.am: Use different file name for two_file_test
6569         temporary file for each incremental test.
6570         * testsuite/Makefile.in: Rebuild.
6571
6572 2011-05-29  Ian Lance Taylor  <iant@google.com>
6573
6574         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6575         binary input file is empty.
6576
6577 2011-05-27  Ian Lance Taylor  <iant@google.com>
6578
6579         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6580         (ver_test_9.so): Likewise.
6581         * testsuite/Makefile.in: Rebuild.
6582
6583 2011-05-26 Cary Coutant  <ccoutant@google.com>
6584
6585         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6586         * incremental.cc (Incremental_inputs::report_input_section): Fix
6587         comment, indentation.
6588         (Incremental_inputs::report_comdat_group): New function.
6589         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6590         of data for incremental input file entry.
6591         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6592         group count, COMDAT group signatures.
6593         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6594         an unchanged input file.
6595         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6596         Initialize new data member.
6597         (Incremental_object_entry::add_comdat_group): New function.
6598         (Incremental_object_entry::get_comdat_group_count): New function.
6599         (Incremental_object_entry::get_comdat_signature_key): New function.
6600         (Incremental_object_entry::groups_): New data member.
6601         (Incremental_inputs::report_comdat_group): New function.
6602         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6603         data for incremental input file entry.
6604         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6605         (Incremental_input_entry_reader::get_input_section): Adjust size of
6606         data for incremental input file entry.
6607         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6608         (Incremental_input_entry_reader::get_comdat_group_signature): New
6609         function.
6610         * object.cc (Sized_relobj::include_section_group): Report kept
6611         COMDAT groups for incremental links.
6612
6613 2011-05-24  David Meyer  <pdox@google.com>
6614
6615         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6616         with name parameter.  Add found_name parameter.
6617         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6618         * dirsearch.h (class Dirsearch): Update declaration.
6619
6620 2011-05-24  Ian Lance Taylor  <iant@google.com>
6621
6622         * archive.cc (Library_base::should_include_member): Pull in object
6623         from archive if it defines the entry symbol.
6624         * parameters.cc (Parameters::entry): New function.
6625         * parameters.h (class Parameters): Declare entry.
6626         * output.h (class Output_file_header): Remove entry_ field.
6627         * output.cc (Output_file_header::Output_file_header): Remove entry
6628         parameter.  Change all callers.
6629         (Output_file_header::entry): Use parameters->entry.
6630         * gold.cc (queue_middle_tasks): Likewise.
6631         * plugin.cc (Plugin_hook::run): Likewise.
6632
6633 2011-05-24 Cary Coutant  <ccoutant@google.com>
6634
6635         * gold.cc (queue_initial_tasks): Pass incremental base filename
6636         to Output_file::open_base_file; don't print error message.
6637         * incremental-dump.cc (main): Adjust call to
6638         Output_file::open_for_modification.
6639         * incremental-dump.cc (main): Likewise.
6640         * incremental.cc (Incremental_inputs::report_command_line):
6641         Ignore --incremental-base option when comparing command lines.
6642         Ignore parameter when given as separate argument.
6643         * options.h (class General_options): Add --incremental-base.
6644         * output.cc (Output_file::Output_file):
6645         (Output_file::open_base_file): Add base_name and writable parameters;
6646         read base file into new file; print error message here.
6647         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6648         callers.
6649         * output.h (Output_file::open_for_modification): Rename to...
6650         (Output_file::open_base_file): ...this; add base_name and
6651         writable parameters; adjust all callers.
6652         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6653         callers.
6654         * testsuite/Makefile.am (incremental_test_4): Test
6655         --incremental-base.
6656         * testsuite/Makefile.in: Regenerate.
6657
6658 2011-05-24 Cary Coutant  <ccoutant@google.com>
6659
6660         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6661         incremental_test_4.
6662         * testsuite/Makefile.in: Regenerate.
6663         * testsuite/two_file_test_1_v1.cc: New test source file.
6664         * testsuite/two_file_test_1b_v1.cc: New test source file.
6665         * testsuite/two_file_test_2_v1.cc: New test source file.
6666
6667 2011-05-24 Cary Coutant  <ccoutant@google.com>
6668
6669         * dynobj.h (Dynobj::do_dynobj): New function.
6670         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6671         flag and soname for shared objects.
6672         * incremental.cc (Incremental_inputs::report_object): Make
6673         either Incremental_object_entry or Incremental_dynobj_entry; add
6674         soname to string table.
6675         (Incremental_inputs::report_input_section): Add assertion.
6676         (Output_section_incremental_inputs::set_final_data_size): Adjust
6677         type of input file entry for shared libraries; adjust size of
6678         shared library info entry.
6679         (Output_section_incremental_inputs::write_input_files): Write
6680         as_needed flag for shared libraries.
6681         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6682         of input file entry for shared libraries; write soname.
6683         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6684         soname from incremental info.
6685         * incremental.h (enum Incremental_input_flags): Add
6686         INCREMENTAL_INPUT_AS_NEEDED.
6687         (Incremental_input_entry::Incremental_input_entry): Initialize new
6688         data member.
6689         (Incremental_input_entry::set_as_needed): New function.
6690         (Incremental_input_entry::as_needed): New function.
6691         (Incremental_input_entry::do_dynobj_entry): New function.
6692         (Incremental_input_entry::as_needed_): New data member.
6693         (Incremental_object_entry::Incremental_object_entry): Don't check
6694         for shared library.
6695         (Incremental_object_entry::do_type): Likewise.
6696         (class Incremental_dynobj_entry): New class.
6697         (Incremental_input_entry_reader::as_needed): New function.
6698         (Incremental_input_entry_reader::get_soname): New function.
6699         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6700         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6701         size of shared library info entry.
6702         * layout.cc (Layout::finish_dynamic_section): Don't test for
6703         incremental link when adding DT_NEEDED entries.
6704         * object.h (Object::Object): Initialize new data member.
6705         (Object::dynobj): New function.
6706         (Object::set_as_needed): New function.
6707         (Object::as_needed): New function.
6708         (Object::do_dynobj): New function.
6709         (Object::as_needed_): New data member.
6710
6711 2011-05-24 Cary Coutant  <ccoutant@google.com>
6712
6713         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6714         info; adjust display of GOT entries.
6715         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6716         vector of input objects; remove file_status_.
6717         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6718         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6719         got_plt reader; call target hooks to reserve GOT entries.
6720         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6721         of input file info header and GOT info entry.
6722         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6723         relocation info.
6724         (Got_plt_view_info::got_descriptor): Remove.
6725         (Got_plt_view_info::sym_index): New data member.
6726         (Got_plt_view_info::input_index): New data member.
6727         (Local_got_offset_visitor::visit): Write input file index.
6728         (Global_got_offset_visitor::visit): Write 0 for input file index.
6729         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6730         with sym_index and input_index.
6731         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6732         incremental info GOT entry; replace got_descriptor with input_index.
6733         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6734         map from input file index to object.
6735         (Sized_relobj_incr::do_layout): Replace direct data member reference
6736         with accessor function.
6737         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6738         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6739         Adjust size of input file info header.
6740         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6741         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6742         (Incremental_input_entry_reader::get_input_section): Adjust size of
6743         input file info header.
6744         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6745         of incremental info GOT entry.
6746         (Incremental_got_plt_reader::get_got_desc): Remove.
6747         (Incremental_got_plt_reader::get_got_symndx): New function.
6748         (Incremental_got_plt_reader::get_got_input_index): New function.
6749         (Sized_incremental_binary::Sized_incremental_binary): Remove
6750         file_status_; add input_objects_.
6751         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6752         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6753         (Sized_incremental_binary::file_is_unchanged): Remove.
6754         (Sized_incremental_binary::set_input_object): New function.
6755         (Sized_incremental_binary::input_object): New function.
6756         (Sized_incremental_binary::file_status_): Remove.
6757         (Sized_incremental_binary::input_objects_): New data member.
6758         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6759         references.
6760         (Sized_relobj_incr::invalid_address): Move to base class.
6761         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6762         class.
6763         (Sized_relobj_incr::do_output_section_offset): Likewise.
6764         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6765         (Sized_relobj_incr::section_offsets_): Likewise.
6766         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6767         function.
6768         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6769         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6770         with accessor function.
6771         (Sized_relobj_file::do_layout): Likewise.
6772         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6773         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6774         (Sized_relobj_file::compute_final_local_value): Replace refs to
6775         section_offsets_ with accessor function.
6776         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6777         * object.h (Relobj::Relobj): Initialize new data members.
6778         (Relobj::add_dyn_reloc): New function.
6779         (Relobj::first_dyn_reloc): New function.
6780         (Relobj::dyn_reloc_count): New function.
6781         (Relobj::first_dyn_reloc_): New data member.
6782         (Relobj::dyn_reloc_count_): New data member.
6783         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6784         references.
6785         (Sized_relobj::Address): New typedef.
6786         (Sized_relobj::invalid_address): Move here from child class.
6787         (Sized_relobj::Sized_relobj): Initialize new data members.
6788         (Sized_relobj::sized_relobj): New function.
6789         (Sized_relobj::is_output_section_offset_invalid): Move here from
6790         child class.
6791         (Sized_relobj::get_output_section_offset): Likewise.
6792         (Sized_relobj::local_has_got_offset): Likewise.
6793         (Sized_relobj::local_got_offset): Likewise.
6794         (Sized_relobj::set_local_got_offset): Likewise.
6795         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6796         (Sized_relobj::clear_got_offsets): New function.
6797         (Sized_relobj::section_offsets): Move here from child class.
6798         (Sized_relobj::do_output_section_offset): Likewise.
6799         (Sized_relobj::do_set_section_offset): Likewise.
6800         (Sized_relobj::Local_got_offsets): Likewise.
6801         (Sized_relobj::local_got_offsets_): Likewise.
6802         (Sized_relobj::section_offsets_): Likewise.
6803         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6804         references.
6805         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6806         class.
6807         (Sized_relobj_file::sized_relobj): New function
6808         (Sized_relobj_file::local_has_got_offset): Move to base class.
6809         (Sized_relobj_file::local_got_offset): Likewise.
6810         (Sized_relobj_file::set_local_got_offset): Likewise.
6811         (Sized_relobj_file::get_output_section_offset): Likewise.
6812         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6813         (Sized_relobj_file::do_output_section_offset): Likewise.
6814         (Sized_relobj_file::do_set_section_offset): Likewise.
6815         (Sized_relobj_file::Local_got_offsets): Likewise.
6816         (Sized_relobj_file::local_got_offsets_): Likewise.
6817         (Sized_relobj_file::section_offsets_): Likewise.
6818         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6819         (all constructors).
6820         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6821         (Output_reloc::get_symbol_index): Likewise.
6822         (Output_reloc::local_section_offset): Likewise.
6823         (Output_reloc::get_address): Likewise.
6824         (Output_reloc::symbol_value): Likewise.
6825         (Output_data_got::reserve_slot): Move to class definition.
6826         (Output_data_got::reserve_local): New function.
6827         (Output_data_got::reserve_slot_for_global): Remove.
6828         (Output_data_got::reserve_global): New function.
6829         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6830         (all constructors, two instantiations).
6831         (Output_reloc::get_relobj): New function (two instantiations).
6832         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6833         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6834         (Output_data_reloc::add_global): Adjust type of relobj.
6835         (Output_data_reloc::add_global_relative): Likewise.
6836         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6837         (Output_data_reloc::add_local): Likewise.
6838         (Output_data_reloc::add_local_relative): Likewise.
6839         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6840         (Output_data_reloc::add_local_section): Likewise.
6841         (Output_data_reloc::add_output_section): Likewise.
6842         (Output_data_reloc::add_absolute): Likewise.
6843         (Output_data_reloc::add_target_specific): Likewise.
6844         (Output_data_got::reserve_slot): Move definition here.
6845         (Output_data_got::reserve_local): New function.
6846         (Output_data_got::reserve_global): New function.
6847         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6848         section_offsets_ with accessor function.
6849         (Sized_relobj_file::write_sections): Likewise.
6850         (Sized_relobj_file::do_relocate_sections): Likewise.
6851         * target.h (Sized_target::reserve_local_got_entry): New function.
6852         (Sized_target::reserve_global_got_entry): New function.
6853         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6854         (Target_x86_64::reserve_global_got_entry): New function.
6855         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6856
6857 2011-05-23 Cary Coutant  <ccoutant@google.com>
6858
6859         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6860         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6861         bit when checking got_type.
6862         * incremental.cc (Sized_incremental_binary::setup_readers):
6863         Store symbol table and string table locations; initialize bit vector
6864         of file status flags.
6865         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6866         unchanged files.
6867         (Sized_incremental_binary::do_process_got_plt): New function.
6868         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6869         (Output_section_incremental_inputs::set_final_data_size): Record
6870         file index for each input file.
6871         (Output_section_incremental_inputs::write_got_plt): Store file index
6872         instead of input entry offset for each GOT entry.
6873         * incremental.h
6874         (Incremental_input_entry::Incremental_input_entry): Initialize new
6875         data member.
6876         (Incremental_input_entry::set_offset): Store file index.
6877         (Incremental_input_entry::get_file_index): New function.
6878         (Incremental_input_entry::file_index_): New data member.
6879         (Incremental_binary::process_got_plt): New function.
6880         (Incremental_binary::do_process_got_plt): New function.
6881         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6882         data members.
6883         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6884         (Sized_incremental_binary::set_file_is_unchanged): New function.
6885         (Sized_incremental_binary::file_is_unchanged): New function.
6886         (Sized_incremental_binary::do_process_got_plt): New function.
6887         (Sized_incremental_binary::file_status_): New data member.
6888         (Sized_incremental_binary::main_symtab_loc_): New data member.
6889         (Sized_incremental_binary::main_strtab_loc_): New data member.
6890         * output.cc (Output_data_got::Got_entry::write): Add case
6891         RESERVED_CODE.
6892         (Output_data_got::add_global): Call add_got_entry.
6893         (Output_data_got::add_global_plt): Likewise.
6894         (Output_data_got::add_global_with_rel): Likewise.
6895         (Output_data_got::add_global_with_rela): Likewise.
6896         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6897         (Output_data_got::add_global_pair_with_rela): Likewise.
6898         (Output_data_got::add_local): Call add_got_entry.
6899         (Output_data_got::add_local_plt): Likewise.
6900         (Output_data_got::add_local_with_rel): Likewise.
6901         (Output_data_got::add_local_with_rela): Likewise.
6902         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6903         (Output_data_got::add_local_pair_with_rela): Likewise.
6904         (Output_data_got::reserve_slot): New function.
6905         (Output_data_got::reserve_slot_for_global): New function.
6906         (Output_data_got::add_got_entry): New function.
6907         (Output_data_got::add_got_entry_pair): New function.
6908         (Output_section::add_output_section_data): Edit FIXME.
6909         * output.h
6910         (Output_section_data_build::Output_section_data_build): New
6911         constructor with size parameter.
6912         (Output_data_space::Output_data_space): Likewise.
6913         (Output_data_got::Output_data_got): Initialize new data member; new
6914         constructor with size parameter.
6915         (Output_data_got::add_constant): Call add_got_entry.
6916         (Output_data_got::reserve_slot): New function.
6917         (Output_data_got::reserve_slot_for_global): New function.
6918         (class Output_data_got::Got_entry): Add RESERVED_CODE.
6919         (Output_data_got::add_got_entry): New function.
6920         (Output_data_got::add_got_entry_pair): New function.
6921         (Output_data_got::free_list_): New data member.
6922         * target.h (Sized_target::init_got_plt_for_update): New function.
6923         (Sized_target::register_global_plt_entry): New function.
6924         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6925         Initialize new data member; call init; add constructor with PLT count.
6926         (Output_data_plt_x86_64::init): New function.
6927         (Output_data_plt_x86_64::add_relocation): New function.
6928         (Output_data_plt_x86_64::reserve_slot): New function.
6929         (Output_data_plt_x86_64::free_list_): New data member.
6930         (Target_x86_64::init_got_plt_for_update): New function.
6931         (Target_x86_64::register_global_plt_entry): New function.
6932         (Output_data_plt_x86_64::add_entry): Allocate from free list for
6933         incremental updates.
6934         (Output_data_plt_x86_64::add_relocation): New function.
6935         * testsuite/object_unittest.cc (Object_test): Set default options.
6936
6937 2011-05-16  Ian Lance Taylor  <iant@google.com>
6938
6939         * options.h (class General_options): Make -i a synonym for -r.
6940
6941 2011-05-16  Ian Lance Taylor  <iant@google.com>
6942
6943         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6944
6945 2011-05-10 Cary Coutant  <ccoutant@google.com>
6946
6947         * object.cc (Sized_relobj::do_count_local_symbols): Check for
6948         strip_all (-s).
6949
6950 2011-05-06  Ian Lance Taylor  <iant@google.com>
6951
6952         * layout.cc (Layout::layout): If the output section flags change,
6953         update the ordering.
6954
6955 2011-04-25 Cary Coutant  <ccoutant@google.com>
6956
6957         * incremental-dump.cc (dump_incremental_inputs): Print local
6958         symbol info for each input file.
6959         * incremental.cc
6960         (Output_section_incremental_inputs::set_final_data_size): Add local
6961         symbol info to input file entries in incremental info.
6962         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6963         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6964         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6965         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6966         implementation.
6967         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6968         (Sized_incr_relobj::do_relocate): Write the local symbols.
6969         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6970         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6971         Adjust size of input file header.
6972         (Incremental_inputs_reader::get_local_symbol_offset): New function.
6973         (Incremental_inputs_reader::get_local_symbol_count): New function.
6974         (Incremental_inputs_reader::get_input_section): Adjust size of input
6975         file header.
6976         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6977         (Sized_incr_relobj::This): New typedef.
6978         (Sized_incr_relobj::sym_size): New const data member.
6979         (Sized_incr_relobj::Local_symbol): New struct.
6980         (Sized_incr_relobj::do_output_local_symbol_count): New function.
6981         (Sized_incr_relobj::do_local_symbol_offset): New function.
6982         (Sized_incr_relobj::local_symbol_count_): New data member.
6983         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6984         (Sized_incr_relobj::local_symbol_index_): New data member.
6985         (Sized_incr_relobj::local_symbol_offset_): New data member.
6986         (Sized_incr_relobj::local_dynsym_offset_): New data member.
6987         (Sized_incr_relobj::local_symbols_): New data member.
6988         * object.h (Relobj::output_local_symbol_count): New function.
6989         (Relobj::local_symbol_offset): New function.
6990         (Relobj::do_output_local_symbol_count): New function.
6991         (Relobj::do_local_symbol_offset): New function.
6992         (Sized_relobj::do_output_local_symbol_count): New function.
6993         (Sized_relobj::do_local_symbol_offset): New function.
6994
6995 2011-04-22  Vladimir Simonov  <sv@sw.ru>
6996
6997         * descriptors.cc (set_close_on_exec): New function.
6998         (Descriptors::open): Use set_close_on_exec.
6999         * output.cc (S_ISLNK): Define if not defined.
7000
7001 2011-04-22 Cary Coutant  <ccoutant@google.com>
7002
7003         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7004         global symbol map.
7005         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7006         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7007         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7008         relocations.
7009         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7010         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7011         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7012         * incremental.h
7013         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7014         function.
7015         (Incremental_binary::apply_incremental_relocs): New function.
7016         (Incremental_binary::do_apply_incremental_relocs): New function.
7017         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7018         data member.
7019         (Sized_incremental_binary::add_global_symbol): New function.
7020         (Sized_incremental_binary::global_symbol): New function.
7021         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7022         (Sized_incremental_binary::symbol_map_): New data member.
7023         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7024         * target.h (Sized_target::apply_relocation): New function.
7025         * target-reloc.h (apply_relocation): New function.
7026         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7027
7028 2011-04-22  Doug Kwan  <dougkwan@google.com>
7029
7030         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7031         flag of a SHT_ARM_EXIDX section.
7032         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7033         * testsuite/Makefile.in: Regenerate.
7034         * testsuite/arm_exidx_test.s: New file.
7035         * testsuite/arm_exidx_test.sh: Same.
7036
7037 2011-04-20 Cary Coutant  <ccoutant@google.com>
7038
7039         PR gold/12689
7040         * archive.h (Incremental_archive_entry::Archive_member):
7041         Initialize arg_serial_ (second constructor).
7042
7043 2011-04-17  Ian Lance Taylor  <iant@google.com>
7044
7045         * object.cc (Relocate_info::location): Simplify location string.
7046         * errors.cc (Errors::error_at_location): Don't print program
7047         name.
7048         (Errors::warning_at_location): Likewise.
7049         (Errors::undefined_symbol): Likewise.
7050         * testsuite/debug_msg.sh: Update accordingly.
7051
7052 2011-04-14 Cary Coutant  <ccoutant@google.com>
7053
7054         * gold/layout.cc (Layout::symtab_section_offset): New function.
7055         * gold/layout.h (Layout::symtab_section_offset): New function.
7056         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7057
7058 2011-04-12  Ian Lance Taylor  <iant@google.com>
7059
7060         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7061         with MREMAP_MAYMOVE.
7062         * output.h (class Output_file): Add map_is_allocated_ field.
7063         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7064         not available, provide stubs.  If mremap is not available, #define
7065         it to gold_mremap.
7066         (MREMAP_MAYMOVE): Define if not defined.
7067         (Output_file::Output_file): Initialize map_is_allocated_.
7068         (Output_file::resize): Check map_is_allocated_.
7069         (Output_file::map_anonymous): If mmap fails, use malloc.
7070         (Output_file::unmap): Don't do anything for an anonymous map.
7071         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7072         is not available, provide stubs.
7073         (File_read::View::~View): Use free rather than delete[].
7074         (File_read::make_view): Use malloc rather than new[].  If mmap
7075         fails, use malloc.
7076         (File_read::find_or_make_view): Use malloc rather than new[].
7077         * gold.h: Remove HAVE_REMAP code.
7078         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7079         exists.  Rename mremap to gold_mremap.  If mmap is not available
7080         don't do anything.
7081         * configure, config.in: Rebuild.
7082
7083 2011-04-11  Ian Lance Taylor  <iant@google.com>
7084
7085         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7086         initialize local variable v.
7087
7088 2011-04-11  Cary Coutant  <ccoutant@google.com>
7089
7090         * archive.cc (Archive::include_member): Adjust call to
7091         report_object.
7092         (Add_archive_symbols::run): Track argument serial numbers.
7093         (Lib_group::include_member): Likewise.
7094         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7095         * archive.h (Incremental_archive_entry::Archive_member):
7096         Initialize arg_serial_.
7097         (Archive_member::arg_serial_): New data member.
7098         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7099         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7100         incremental link.
7101         (Sized_dynobj::do_for_all_local_got_entries): New function.
7102         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7103         function.
7104         * fileread.cc (get_mtime): New function.
7105         * fileread.h (get_mtime): New function.
7106         * gold.cc (queue_initial_tasks): Check for incremental update.
7107         (process_incremental_input): New function.
7108         (queue_middle_tasks): Don't force valid target for incremental
7109         update.
7110         * incremental-dump.cc (find_input_containing_global): Adjust
7111         size of symbol info entry.
7112         (dump_incremental_inputs): Dump argument serial number and
7113         in_system_directory flag; bias shndx by 1; print symbol names
7114         when dumping per-file symbol lists; use new symbol info readers.
7115         * incremental.cc
7116         (Output_section_incremental_inputs:update_data_size): New function.
7117         (Sized_incremental_binary::setup_readers): Setup input readers
7118         for each input file; build maps for files added from libraries
7119         and scripts.
7120         (Sized_incremental_binary::check_input_args): New function.
7121         (Sized_incremental_binary::do_check_inputs): Build map of argument
7122         serial numbers to input arguments.
7123         (Sized_incremental_binary::do_file_has_changed): Rename
7124         do_file_is_unchanged to this; compare file modification times.
7125         (Sized_incremental_binary::do_init_layout): New function.
7126         (Sized_incremental_binary::do_reserve_layout): New function.
7127         (Sized_incremental_binary::do_get_input_reader): Remove.
7128         (Sized_incremental_binary::get_symtab_view): New function.
7129         (Incremental_checker::can_incrementally_link_output_file): Remove.
7130         (Incremental_inputs::report_command_line): Exclude --debug options.
7131         (Incremental_inputs::report_archive_begin): Add parameter; track
7132         argument serial numbers; don't put input file entry for archive
7133         before archive members.
7134         (Incremental_inputs::report_archive_end): Put input file entry
7135         for archive after archive members.
7136         (Incremental_inputs::report_object): Add parameter; track argument
7137         serial numbers and in_system_directory flag.
7138         (Incremental_inputs::report_script): Add parameter; track argument
7139         serial numbers.
7140         (Output_section_incremental_inputs::set_final_data_size): Adjust
7141         size of symbol info entry; check for forwarding symbols.
7142         (Output_section_incremental_inputs::write_input_files): Write
7143         in_system_directory flag and argument serial number.
7144         (Output_section_incremental_inputs::write_info_blocks): Map section
7145         indices between incremental info and original input file; store
7146         input section index for each symbol.
7147         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7148         change operator() to visit().
7149         (class Global_got_offset_visitor): Likewise.
7150         (class Global_symbol_visitor_got_plt):
7151         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7152         classes.
7153         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7154         (Sized_incr_relobj::do_read_symbols): New function.
7155         (Sized_incr_relobj::do_layout): New function.
7156         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7157         (Sized_incr_relobj::do_add_symbols): New function.
7158         (Sized_incr_relobj::do_should_include_member): New function.
7159         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7160         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7161         (Sized_incr_relobj::do_section_size): New function.
7162         (Sized_incr_relobj::do_section_name): New function.
7163         (Sized_incr_relobj::do_section_contents): New function.
7164         (Sized_incr_relobj::do_section_flags): New function.
7165         (Sized_incr_relobj::do_section_entsize): New function.
7166         (Sized_incr_relobj::do_section_address): New function.
7167         (Sized_incr_relobj::do_section_type): New function.
7168         (Sized_incr_relobj::do_section_link): New function.
7169         (Sized_incr_relobj::do_section_info): New function.
7170         (Sized_incr_relobj::do_section_addralign): New function.
7171         (Sized_incr_relobj::do_initialize_xindex): New function.
7172         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7173         (Sized_incr_relobj::do_read_relocs): New function.
7174         (Sized_incr_relobj::do_gc_process_relocs): New function.
7175         (Sized_incr_relobj::do_scan_relocs): New function.
7176         (Sized_incr_relobj::do_count_local_symbols): New function.
7177         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7178         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7179         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7180         (Sized_incr_relobj::do_relocate): New function.
7181         (Sized_incr_relobj::do_set_section_offset): New function.
7182         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7183         (Sized_incr_dynobj::do_read_symbols): New function.
7184         (Sized_incr_dynobj::do_layout): New function.
7185         (Sized_incr_dynobj::do_add_symbols): New function.
7186         (Sized_incr_dynobj::do_should_include_member): New function.
7187         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7188         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7189         (Sized_incr_dynobj::do_section_size): New function.
7190         (Sized_incr_dynobj::do_section_name): New function.
7191         (Sized_incr_dynobj::do_section_contents): New function.
7192         (Sized_incr_dynobj::do_section_flags): New function.
7193         (Sized_incr_dynobj::do_section_entsize): New function.
7194         (Sized_incr_dynobj::do_section_address): New function.
7195         (Sized_incr_dynobj::do_section_type): New function.
7196         (Sized_incr_dynobj::do_section_link): New function.
7197         (Sized_incr_dynobj::do_section_info): New function.
7198         (Sized_incr_dynobj::do_section_addralign): New function.
7199         (Sized_incr_dynobj::do_initialize_xindex): New function.
7200         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7201         (make_sized_incremental_object): New function.
7202         (Incremental_library::copy_unused_symbols): New function.
7203         (Incremental_library::do_for_all_unused_symbols): New function.
7204         * incremental.h (enum Incremental_input_flags): New type.
7205         (class Incremental_checker): Remove.
7206         (Incremental_input_entry::Incremental_input_entry): Add argument
7207         serial number.
7208         (Incremental_input_entry::arg_serial): New function.
7209         (Incremental_input_entry::set_is_in_system_directory): New function.
7210         (Incremental_input_entry::is_in_system_directory): New function.
7211         (Incremental_input_entry::arg_serial_): New data member.
7212         (Incremental_input_entry::is_in_system_directory_): New data member.
7213         (class Script_info): Move here from script.h.
7214         (Script_info::Script_info): Add filename parameter.
7215         (Script_info::filename): New function.
7216         (Script_info::filename_): New data member.
7217         (Incremental_script_entry::Incremental_script_entry): Add argument
7218         serial number.
7219         (Incremental_object_entry::Incremental_object_entry): Likewise.
7220         (Incremental_object_entry::add_input_section): Build list of input
7221         sections with map to original shndx.
7222         (Incremental_object_entry::get_input_section_index): New function.
7223         (Incremental_object_entry::shndx_): New data member.
7224         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7225         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7226         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7227         serial number.
7228         (Incremental_inputs::report_archive_begin): Likewise.
7229         (Incremental_inputs::report_object): Likewise.
7230         (Incremental_inputs::report_script): Likewise.
7231         (class Incremental_global_symbol_reader): New class.
7232         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7233         and store flags and input file type.
7234         (Incremental_input_entry_reader::arg_serial): New function.
7235         (Incremental_input_entry_reader::type): Extract type from flags.
7236         (Incremental_input_entry_reader::is_in_system_directory): New function.
7237         (Incremental_input_entry_reader::get_input_section_count): Call
7238         accessor function for type.
7239         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7240         function for type; adjust size of global symbol entry.
7241         (Incremental_input_entry_reader::get_global_symbol_count): Call
7242         accessor function for type.
7243         (Incremental_input_entry_reader::get_object_count): Likewise.
7244         (Incremental_input_entry_reader::get_object_offset): Likewise.
7245         (Incremental_input_entry_reader::get_member_count): Likewise.
7246         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7247         (Incremental_input_entry_reader::get_member_offset): Likewise.
7248         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7249         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7250         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7251         (Incremental_input_entry_reader::get_global_symbol_reader): New
7252         function.
7253         (Incremental_input_entry_reader::get_output_symbol_index): New
7254         function.
7255         (Incremental_input_entry_reader::type_): Remove.
7256         (Incremental_input_entry_reader::flags_): New data member.
7257         (Incremental_inputs_reader::input_file_offset): New function.
7258         (Incremental_inputs_reader::input_file_index): New function.
7259         (Incremental_inputs_reader::input_file): Call input_file_offset.
7260         (Incremental_inputs_reader::input_file_at_offset): New function.
7261         (Incremental_relocs_reader::get_r_type): Reformat.
7262         (Incremental_relocs_reader::get_r_shndx): Reformat.
7263         (Incremental_relocs_reader::get_r_offset): Reformat.
7264         (Incremental_relocs_reader::data): New function.
7265         (Incremental_binary::Incremental_binary): Initialize new data members.
7266         (Incremental_binary::check_inputs): Add cmdline parameter.
7267         (Incremental_binary::file_is_unchanged): Remove.
7268         (Input_reader::arg_serial): New function.
7269         (Input_reader::get_unused_symbol_count): New function.
7270         (Input_reader::get_unused_symbol): New function.
7271         (Input_reader::do_arg_serial): New function.
7272         (Input_reader::do_get_unused_symbol_count): New function.
7273         (Input_reader::do_get_unused_symbol): New function.
7274         (Incremental_binary::input_file_count): New function.
7275         (Incremental_binary::get_input_reader): Change signature to use
7276         index instead of filename.
7277         (Incremental_binary::file_has_changed): New function.
7278         (Incremental_binary::get_input_argument): New function.
7279         (Incremental_binary::get_library): New function.
7280         (Incremental_binary::get_script_info): New function.
7281         (Incremental_binary::init_layout): New function.
7282         (Incremental_binary::reserve_layout): New function.
7283         (Incremental_binary::output_file): New function.
7284         (Incremental_binary::do_check_inputs): New function.
7285         (Incremental_binary::do_file_is_unchanged): Remove.
7286         (Incremental_binary::do_file_has_changed): New function.
7287         (Incremental_binary::do_init_layout): New function.
7288         (Incremental_binary::do_reserve_layout): New function.
7289         (Incremental_binary::do_input_file_count): New function.
7290         (Incremental_binary::do_get_input_reader): Change signature.
7291         (Incremental_binary::input_args_map_): New data member.
7292         (Incremental_binary::library_map_): New data member.
7293         (Incremental_binary::script_map_): New data member.
7294         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7295         new data members.
7296         (Sized_incremental_binary::output_section): New function.
7297         (Sized_incremental_binary::inputs_reader): Add const.
7298         (Sized_incremental_binary::symtab_reader): Add const.
7299         (Sized_incremental_binary::relocs_reader): Add const.
7300         (Sized_incremental_binary::got_plt_reader): Add const.
7301         (Sized_incremental_binary::get_symtab_view): New function.
7302         (Sized_incremental_binary::Inputs_reader): New typedef.
7303         (Sized_incremental_binary::Input_entry_reader): New typedef.
7304         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7305         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7306         (Sized_incremental_binary::do_file_has_changed): New function.
7307         (Sized_incremental_binary::do_init_layout): New function.
7308         (Sized_incremental_binary::do_reserve_layout): New function.
7309         (Sized_input_reader::Inputs_reader): Remove.
7310         (Sized_input_reader::Input_entry_reader): Remove.
7311         (Sized_input_reader::do_arg_serial): New function.
7312         (Sized_input_reader::do_get_unused_symbol_count): New function.
7313         (Sized_input_reader::do_get_unused_symbol): New function.
7314         (Sized_incremental_binary::do_input_file_count): New function.
7315         (Sized_incremental_binary::do_get_input_reader): Change signature;
7316         use index instead of filename.
7317         (Sized_incremental_binary::section_map_): New data member.
7318         (Sized_incremental_binary::input_entry_readers_): New data member.
7319         (class Sized_incr_relobj): New class.
7320         (class Sized_incr_dynobj): New class.
7321         (make_sized_incremental_object): New function.
7322         (class Incremental_library): New class.
7323         * layout.cc (Free_list::num_lists): New static data member.
7324         (Free_list::num_nodes): New static data member.
7325         (Free_list::num_removes): New static data member.
7326         (Free_list::num_remove_visits): New static data member.
7327         (Free_list::num_allocates): New static data member.
7328         (Free_list::num_allocate_visits): New static data member.
7329         (Free_list::init): New function.
7330         (Free_list::remove): New function.
7331         (Free_list::allocate): New function.
7332         (Free_list::dump): New function.
7333         (Free_list::print_stats): New function.
7334         (Layout_task_runner::run): Resize output file for incremental updates.
7335         (Layout::Layout): Initialize new data members.
7336         (Layout::set_incremental_base): New function.
7337         (Layout::init_fixed_output_section): New function.
7338         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7339         incremental updates.
7340         (Layout::create_gold_note): Do not create gold note section for
7341         incremental updates.
7342         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7343         for incremental updates.
7344         (Layout::set_section_offsets): For incremental updates, allocate space
7345         from free list.
7346         (Layout::create_symtab_sections): Layout with offsets relative to
7347         start of section; for incremental updates, allocate space from free
7348         list.
7349         (Layout::create_shdrs): For incremental updates, allocate space from
7350         free list.
7351         (Layout::finish_dynamic_section): For incremental updates, do not
7352         check --as-needed (fixed in subsequent patch).
7353         * layout.h (class Free_list): New class.
7354         (Layout::set_incremental_base): New function.
7355         (Layout::incremental_base): New function.
7356         (Layout::init_fixed_output_section): New function.
7357         (Layout::allocate): New function.
7358         (Layout::incremental_base_): New data member.
7359         (Layout::free_list_): New data member.
7360         * main.cc (main): Print Free_list statistics.
7361         * object.cc (Relobj::finalize_incremental_relocs): Add
7362         clear_counts parameter; clear counts only when clear_counts is set.
7363         (Sized_relobj::Sized_relobj): Initialize new base class.
7364         (Sized_relobj::do_layout): Don't report special sections.
7365         (Sized_relobj::do_for_all_local_got_entries): New function.
7366         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7367         symtab_off to all symbol table offsets.
7368         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7369         * object.h (class Got_offset_list): Move to top of file.
7370         (Object::Object): Allow case where input_file == NULL.
7371         (Object::~Object): Likewise.
7372         (Object::input_file): Assert that input_file != NULL.
7373         (Object::lock): Allow case where input_file == NULL.
7374         (Object::unlock): Likewise.
7375         (Object::is_locked): Likewise.
7376         (Object::token): Likewise.
7377         (Object::release): Likewise.
7378         (Object::is_incremental): New function.
7379         (Object::get_mtime): New function.
7380         (Object::for_all_local_got_entries): New function.
7381         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7382         (Object::set_is_in_system_directory): New function.
7383         (Object::is_in_system_directory): New function.
7384         (Object::do_is_incremental): New function.
7385         (Object::do_get_mtime): New function.
7386         (Object::do_for_all_local_got_entries): New function.
7387         (Object::is_in_system_directory_): New data member.
7388         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7389         (class Sized_relobj_base): New class.
7390         (class Sized_relobj): Derive from Sized_relobj_base.
7391         (class Sized_relobj::Symbols): Redeclare from base class.
7392         (class Sized_relobj::local_got_offset_list): Remove.
7393         (class Sized_relobj::Output_sections): Redeclare from base class.
7394         (class Sized_relobj::do_for_all_local_got_entries): New function.
7395         (class Sized_relobj::write_local_symbols): Add offset parameter.
7396         (class Sized_relobj::local_symbol_offset_): Update comment.
7397         (class Sized_relobj::local_dynsym_offset_): Update comment.
7398         * options.cc (Input_arguments::add_file): Remove const.
7399         * options.h (Input_file_argument::Input_file_argument):
7400         Initialize arg_serial_ (all constructors).
7401         (Input_file_argument::set_arg_serial): New function.
7402         (Input_file_argument::arg_serial): New function.
7403         (Input_file_argument::arg_serial_): New data member.
7404         (Input_arguments::Input_arguments): Initialize file_count_.
7405         (Input_arguments::add_file): Remove const.
7406         (Input_arguments::number_of_input_files): New function.
7407         (Input_arguments::file_count_): New data member.
7408         (Command_line::number_of_input_files): Call
7409         Input_arguments::number_of_input_files.
7410         * output.cc (Output_segment_headers::Output_segment_headers):
7411         Set current size.
7412         (Output_section::Input_section::current_data_size): New function.
7413         (Output_section::Output_section): Initialize new data members.
7414         (Output_section::add_input_section): Don't do merge sections for
7415         an incremental link; allocate space from free list for an
7416         incremental update.
7417         (Output_section::add_output_section_data): Allocate space from
7418         free list for an incremental update.
7419         (Output_section::update_data_size): New function.
7420         (Output_section::set_fixed_layout): New function.
7421         (Output_section::reserve): New function.
7422         (Output_segment::set_section_addresses): Remove const.
7423         (Output_segment::set_section_list_addresses): Remove const; allocate
7424         space from free list for an incremental update.
7425         (Output_segment::set_offset): Adjust size of RELRO segment for an
7426         incremental update.
7427         * output.h (Output_data::current_data_size): Move here from
7428         child classes.
7429         (Output_data::pre_finalize_data_size): New function.
7430         (Output_data::update_data_size): New function.
7431         (Output_section_headers::update_data_size): new function.
7432         (Output_section_data_build::current_data_size): Move to Output_data.
7433         (Output_data_strtab::update_data_size): New function.
7434         (Output_section::current_data_size): Move to Output_data.
7435         (Output_section::set_fixed_layout): New function.
7436         (Output_section::has_fixed_layout): New function.
7437         (Output_section::reserve): New function.
7438         (Output_section::update_data_size): New function.
7439         (Output_section::has_fixed_layout_): New data member.
7440         (Output_section::free_list_): New data member.
7441         (Output_segment::set_section_addresses): Remove const.
7442         (Output_segment::set_section_list_addresses): Remove const.
7443         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7444         New function.
7445         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7446         New function.
7447         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7448         parameter when calling Add_symbols constructor; store argument
7449         serial number for members of a lib group.
7450         (Add_symbols::locks): Allow case where token == NULL.
7451         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7452         (Read_member::~Read_member): New function.
7453         (Read_member::is_runnable): New function.
7454         (Read_member::locks): New function.
7455         (Read_member::run): New function.
7456         (Check_script::~Check_script): New function.
7457         (Check_script::is_runnable): New function.
7458         (Check_script::locks): New function.
7459         (Check_script::run): New function.
7460         (Check_library::~Check_library): New function.
7461         (Check_library::is_runnable): New function.
7462         (Check_library::locks): New function.
7463         (Check_library::run): New function.
7464         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7465         (Add_symbols::library_): New data member.
7466         (class Read_member): New class.
7467         (class Check_script): New class.
7468         (class Check_library): New class.
7469         * reloc.cc (Read_relocs::is_runnable): Allow case where
7470         token == NULL.
7471         (Read_relocs::locks): Likewise.
7472         (Scan_relocs::locks): Likewise.
7473         (Relocate_task::locks): Likewise.
7474         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7475         to clear counters.
7476         (Sized_relobj::incremental_relocs_scan): Fix comment.
7477         (Sized_relobj::do_relocate): Pass output file offset to
7478         write_local_symbols.
7479         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7480         from class declaration.
7481         * script.cc (read_input_script): Allocate Script_info; pass
7482         argument serial number to report_script.
7483         * script.h (class Script_info): Move to incremental.h.
7484         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7485         * symtab.h (Symbol_table::add_from_incrobj): New function.
7486         (Symbol_table::set_file_offset): New function.
7487
7488 2011-04-05  Cary Coutant  <ccoutant@google.com>
7489
7490         * incremental-dump.cc (dump_incremental_inputs): Change signature
7491         to take a Sized_incremental_binary; change caller.  Use readers
7492         in Sized_incremental_binary.
7493         * incremental.cc
7494         (Sized_incremental_binary::find_incremental_inputs_sections):
7495         Rename do_find_incremental_inputs_sections to this.
7496         (Sized_incremental_binary::setup_readers): New function.
7497         (Sized_incremental_binary::do_check_inputs): Check
7498         has_incremental_info_ flag; move setup code to setup_readers;
7499         use input readers.
7500         (Sized_incremental_binary::do_file_is_unchanged): New function.
7501         (Sized_incremental_binary::do_get_input_reader): New function.
7502         * incremental.h (class Incremental_binary): Move to end of file.
7503         (Incremental_binary::file_is_unchanged): New function.
7504         (Incremental_binary::do_file_is_unchanged): New function.
7505         (Incremental_binary::Input_reader): New class.
7506         (Incremental_binary::get_input_reader): New function.
7507         (class Sized_incremental_binary): Move to end of file.
7508         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7509         input section reader classes.
7510         (Sized_incremental_binary::has_incremental_info): New function.
7511         (Sized_incremental_binary::inputs_reader): New function.
7512         (Sized_incremental_binary::symtab_reader): New function.
7513         (Sized_incremental_binary::relocs_reader): New function.
7514         (Sized_incremental_binary::got_plt_reader): New function.
7515         (Sized_incremental_binary::do_file_is_unchanged): New function.
7516         (Sized_incremental_binary::Sized_input_reader): New class.
7517         (Sized_incremental_binary::get_input_reader): New function.
7518         (Sized_incremental_binary::find_incremental_inputs_sections):
7519         Rename do_find_incremental_inputs_sections to this.
7520         (Sized_incremental_binary::setup_readers): New function.
7521         (Sized_incremental_binary::has_incremental_info_): New data member.
7522         (Sized_incremental_binary::inputs_reader_): New data member.
7523         (Sized_incremental_binary::symtab_reader_): New data member.
7524         (Sized_incremental_binary::relocs_reader_): New data member.
7525         (Sized_incremental_binary::got_plt_reader_): New data member.
7526         (Sized_incremental_binary::current_input_file_): New data member.
7527
7528 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7529
7530         PR gold/12640
7531         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7532         violation.
7533
7534 2011-03-30  Cary Coutant  <ccoutant@google.com>
7535
7536         * archive.cc (Archive::include_member): Adjust call to report_object.
7537         (Add_archive_symbols::run): Add script_info to call to
7538         report_archive_begin.
7539         (Lib_group::include_member): Adjust call to report_object.
7540         (Add_lib_group_symbols::run): Adjust call to report_object.
7541         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7542         blocks.  Add object count for script input files.
7543         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7544         script_info parameter; change all callers.
7545         (Incremental_inputs::report_object): Add script_info parameter;
7546         change all callers.
7547         (Incremental_inputs::report_script): Store backpointer to
7548         incremental info entry.
7549         (Output_section_incremental_inputs::set_final_data_size): Record
7550         additional information for scripts.
7551         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7552         * incremental.h (Incremental_script_entry::add_object): New function.
7553         (Incremental_script_entry::get_object_count): New function.
7554         (Incremental_script_entry::get_object): New function.
7555         (Incremental_script_entry::objects_): New data member; adjust
7556         constructor.
7557         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7558         (Incremental_inputs::report_object): Add script_info parameter.
7559         (Incremental_inputs_reader::get_object_count): New function.
7560         (Incremental_inputs_reader::get_object_offset): New function.
7561         * options.cc (Input_arguments::add_file): Return reference to
7562         new input argument.
7563         * options.h (Input_argument::set_script_info): New function.
7564         (Input_argument::script_info): New function.
7565         (Input_argument::script_info_): New data member; adjust all
7566         constructors.
7567         (Input_file_group::add_file): Return reference to new input argument.
7568         (Input_file_lib::add_file): Likewise.
7569         (Input_arguments::add_file): Likewise.
7570         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7571         * script.cc (Parser_closure::Parser_closure): Add script_info
7572         parameter; adjust all callers.
7573         (Parser_closure::script_info): New function.
7574         (Parser_closure::script_info_): New data member.
7575         (read_input_script): Report scripts earlier to incremental info.
7576         (script_add_file): Set script_info in Input_argument.
7577         (script_add_library): Likewise.
7578         * script.h (Script_options::Script_info): Rewrite class.
7579
7580 2011-03-29  Cary Coutant  <ccoutant@google.com>
7581
7582         * archive.cc (Library_base::should_include_member): Move
7583         method here from class Archive.
7584         (Archive::Archive): Initialize base class.
7585         (Archive::should_include_member): Move to base class.
7586         (Archive::do_for_all_unused_symbols): New function.
7587         (Add_archive_symbols::run): Remove redundant access to
7588         incremental_inputs.
7589         (Lib_group::Lib_group): Initialize base class.
7590         (Lib_group::do_filename): New function.
7591         (Lib_group::include_member): Pass pointer to Lib_group to
7592         report_object.
7593         (Lib_group::do_for_all_unused_symbols): New function.
7594         (Add_lib_group_symbols::run): Report archive information for
7595         incremental links.
7596         * archive.h (class Library_base): New base class.
7597         (class Archive): Derive from Library_base.
7598         (Archive::filename): Move to base class.
7599         (Archive::set_incremental_info): Likewise.
7600         (Archive::incremental_info): Likewise.
7601         (Archive::Should_include): Likewise.
7602         (Archive::should_include_member): Likewise.
7603         (Archive::Armap_entry): Remove.
7604         (Archive::Unused_symbol_iterator): Remove.
7605         (Archive::unused_symbols_begin): Remove.
7606         (Archive::unused_symbols_end): Remove.
7607         (Archive::do_filename): New function.
7608         (Archive::do_get_mtime): New function.
7609         (Archive::do_for_all_unused_symbols): New function.
7610         (Archive::task_): Move to base class.
7611         (Archive::incremental_info_): Likewise.
7612         (class Lib_group): Derive from Library_base.
7613         (Lib_group::do_filename): New function.
7614         (Lib_group::do_get_mtime): New function.
7615         (Lib_group::do_for_all_unused_symbols): New function.
7616         (Lib_group::task_): Move to base class.
7617         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7618         function.
7619         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7620         function.
7621         * incremental.cc (Incremental_inputs::report_archive_begin):
7622         Use Library_base; call library's get_mtime; add incremental inputs
7623         entry before members.
7624         (class Unused_symbol_visitor): New class.
7625         (Incremental_inputs::report_archive_end): Use Library_base; use
7626         visitor class to record unused symbols; don't add incremental inputs
7627         entry after members.
7628         (Incremental_inputs::report_object): Use Library_base.
7629         * incremental.h
7630         (Incremental_archive_entry::Incremental_archive_entry): Remove
7631         unused Archive parameter.
7632         (Incremental_inputs::report_archive_begin): Use Library_base.
7633         (Incremental_inputs::report_archive_end): Likewise.
7634         (Incremental_inputs::report_object): Likewise.
7635         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7636         function.
7637         * object.h (Object::for_all_global_symbols): New function.
7638         (Object::do_for_all_global_symbols): New function.
7639         (Sized_relobj::do_for_all_global_symbols): New function.
7640         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7641         function.
7642         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7643         function.
7644
7645 2011-03-27  Ian Lance Taylor  <iant@google.com>
7646
7647         * archive.cc (Archive::interpret_header): Return -1 if something
7648         goes wrong.  Change callers accordingly.
7649
7650 2011-03-25  Cary Coutant  <ccoutant@google.com>
7651
7652         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7653         * testsuite/Makefile.in: Regenerate.
7654
7655 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7656
7657         * plugin.cc (get_view): New.
7658         (Plugin::load): Pass get_view to the plugin.
7659         (Plugin_manager::get_view): New.
7660
7661 2011-03-21  Ian Lance Taylor  <iant@google.com>
7662
7663         * testsuite/final_layout.sh: Rewrite to not use dc.
7664         * testsuite/relro_test.sh: Fail if dc is not present.
7665
7666 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7667
7668         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7669         Change == to -eq.
7670         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7671         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7672         Change == to -eq.
7673         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7674         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7675
7676 2011-03-14  Ian Lance Taylor  <iant@google.com>
7677
7678         * script-sections.cc (Sort_output_sections::script_compare):
7679         Rename from is_before, change return type.
7680         (Sort_output_sections::operator()): Adjust accordingly.
7681
7682 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7683
7684         PR gold/12572
7685         * testsuite/odr_violation2.cc: Add comment to make all error line
7686         numbers double digits.
7687         * testsuite/debug_msg.sh: Adjust expected errors.
7688
7689 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7690
7691         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7692         but mark earlier ones as non-canonical
7693         (offset_to_iterator): Update search target and example
7694         (do_addr2line): Return extra lines in a vector*
7695         (format_file_lineno): Extract from do_addr2line
7696         (one_addr2line): Add vector* out-param
7697         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7698         when a lineno entry appeared last for its instruction
7699         (Dwarf_line_info): Add vector* out-param
7700         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7701         * symtab.cc (Odr_violation_compare): Include the lineno in the
7702         comparison again.
7703         (linenos_from_loc): New. Combine the canonical line for an
7704         address with its other lines.
7705         (True_if_intersect): New. Helper functor to make
7706         std::set_intersection a query.
7707         (detect_odr_violations): Compare sets of lines instead of just
7708         one line for each function. This became less deterministic, but
7709         has fewer false positives.
7710         * symtab.h: Declarations.
7711         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7712         mix an optimized and non-optimized object in the same binary
7713         (odr_violation2.so): Same.
7714         * testsuite/Makefile.in: Regenerate from Makefile.am.
7715         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7716         * testsuite/debug_msg.sh: Update line numbers and add
7717         assertions.
7718         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7719         non-optimized context.
7720         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7721         isn't inlined, and use OdrDerived in an optimized context.
7722         * testsuite/odr_header1.h: Defines OdrDerived, where
7723         optimization will change the
7724         first-instruction-in-the-destructor's file and line number.
7725         * testsuite/odr_header2.h: Defines OdrBase.
7726
7727 2011-03-09  Ian Lance Taylor  <iant@google.com>
7728
7729         * fileread.cc (File_read::clear_views): Don't delete the whole
7730         file view.
7731
7732 2011-03-08  Ian Lance Taylor  <iant@google.com>
7733
7734         PR gold/12525
7735         * fileread.cc: #include <climits>.
7736         (GOLD_IOV_MAX): Define.
7737         (File_read::read_multiple): Limit number of entries by iov_max.
7738         * fileread.h (class File_read): Always set max_readv_entries to
7739         128.
7740
7741 2011-03-07  Ian Lance Taylor  <iant@google.com>
7742
7743         PR gold/12525
7744         * options.h (class General_options): Add -dy and -dn.
7745
7746 2011-03-02  Cary Coutant  <ccoutant@google.com>
7747
7748         * testsuite/script_test_9.t: Add TLS segment.
7749
7750 2011-03-02  Simon Baldwin  <simonb@google.com>
7751
7752         * configure.ac: Add check for gnu_indirect_function support in
7753         the toolchain building binutils.
7754         * configure: Rebuild.
7755
7756 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7757
7758         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7759         plugin only symbols.
7760         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7761         in plugin files as not needed in the symbol table.
7762
7763 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7764
7765         * output.cc (Output_section::add_input_section): Delay fill
7766         generation for section ordering.
7767
7768 2011-02-09  Ian Lance Taylor  <iant@google.com>
7769
7770         PR gold/12316
7771         * object.h (class Sized_relobj): Remove clear_local_symbols.
7772         * reloc.cc (Sized_relobj::do_relocate): Don't call
7773         clear_local_symbols.
7774
7775 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7776
7777         * plugin.cc (is_visible_from_outside): Return true for symbols
7778         in the -u option.
7779
7780 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7781
7782         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7783         filename.
7784
7785 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7786
7787         * icf.h (is_section_foldable_candidate): Change type of parameter
7788         to std::string.
7789         * icf.cc (Icf::find_identical_sections): Change type of local variable
7790         section_name to be std::string.
7791         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7792
7793 2011-01-25  Ian Lance Taylor  <iant@google.com>
7794
7795         * script.cc (script_add_extern): Rewrite to use
7796         add_symbol_reference.
7797
7798 2011-01-25  Doug Kwan  <dougkwan@google.com>
7799
7800         * icf.cc (get_section_contents): Always lock section's object.
7801
7802 2011-01-24  Ian Lance Taylor  <iant@google.com>
7803
7804         * options.h (class General_options): Accept
7805         --no-detect-odr-violations.
7806
7807 2011-01-24  Ian Lance Taylor  <iant@google.com>
7808
7809         * version.cc (version_string): Bump to 1.11.
7810
7811 2011-01-24  Ian Lance Taylor  <iant@google.com>
7812
7813         * plugin.cc (class Plugin_rescan): Define new class.
7814         (Plugin_manager::claim_file): Set any_claimed_.
7815         (Plugin_manager::save_archive): New function.
7816         (Plugin_manager::save_input_group): New function.
7817         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7818         necessary.
7819         (Plugin_manager::new_undefined_symbol): New function.
7820         (Plugin_manager::rescan): New function.
7821         (Plugin_manager::rescannable_defines): New function.
7822         (Plugin_manager::add_input_file): Set any_added_.
7823         * plugin.h (class Plugin_manager): define new fields rescannable_,
7824         undefined_symbols_, any_claimed_, and any_added_.  Declare
7825         Plugin_rescan as friend.  Declare new functions.
7826         (Plugin_manager::Rescannable): Define type.
7827         (Plugin_manager::Rescannable_list): Define type.
7828         (Plugin_manager::Undefined_symbol_list): Define type.
7829         (Plugin_manager::Plugin_manager): Initialize new fields.
7830         * archive.cc (Archive::defines_symbol): New function.
7831         (Add_archive_symbols::run): Pass archive to plugins if any.
7832         * archive.h (class Archive): Declare defines_symbol.
7833         * readsyms.cc (Input_group::~Input_group): New function.
7834         (Finish_group::run): Pass input_group to plugins if any.
7835         * readsyms.h (class Input_group): Declare destructor.
7836         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7837         any.
7838
7839 2011-01-10  Ian Lance Taylor  <iant@google.com>
7840
7841         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7842         section as relro.
7843         (Layout::set_segment_offsets): Reset increase_relro before calling
7844         set_section_addresses a second time.
7845
7846 2011-01-04  Cary Coutant  <ccoutant@google.com>
7847
7848         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7849         sections before NOBITS sections.
7850
7851 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7852
7853         * version.cc (print_version): Update copyright to 2011.
7854
7855 2010-12-23  Cary Coutant  <ccoutant@google.com>
7856
7857         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7858         of OS to this->add.  Add OD parameter to second form of the function.
7859
7860 2010-12-20  Ian Lance Taylor  <iant@google.com>
7861
7862         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7863         second of two consecutive entries with same offset.
7864
7865 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7866
7867         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7868         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7869         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7870         to avoid unneeded links against $(LDADD).
7871         * testsuite/Makefile.in: Regenerate.
7872
7873 2010-12-15  Ian Lance Taylor  <iant@google.com>
7874
7875         PR gold/12324
7876         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7877         for R_X86_64_32 and R_X86_64_PC32.
7878         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7879         ver_matching_def_pic.o.
7880         (ver_matching_def_pic.o): New target.
7881
7882 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7883
7884         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7885         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7886         Move definition before File_read::View member definitions.
7887         (File_read::View::~View): Initialize and hold lock before
7888         updating current_mapped_bytes.
7889
7890 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7891
7892         * dwarf_reader.cc: Remove outdated comment.
7893         * gold-threads.cc: Fix typo in error message.
7894         * archive.cc: Fix typos in comments.
7895         * archive.h: Likewise.
7896         * arm-reloc-property.cc: Likewise.
7897         * arm-reloc-property.h: Likewise.
7898         * arm-reloc.def: Likewise.
7899         * arm.cc: Likewise.
7900         * attributes.h: Likewise.
7901         * cref.cc: Likewise.
7902         * ehframe.cc: Likewise.
7903         * fileread.h: Likewise.
7904         * gold.h: Likewise.
7905         * i386.cc: Likewise.
7906         * icf.cc: Likewise.
7907         * incremental.h: Likewise.
7908         * int_encoding.cc: Likewise.
7909         * layout.h: Likewise.
7910         * main.cc: Likewise.
7911         * merge.h: Likewise.
7912         * object.cc: Likewise.
7913         * object.h: Likewise.
7914         * options.cc: Likewise.
7915         * readsyms.cc: Likewise.
7916         * reduced_debug_output.cc: Likewise.
7917         * reloc.cc: Likewise.
7918         * script-sections.cc: Likewise.
7919         * sparc.cc: Likewise.
7920         * symtab.h: Likewise.
7921         * target-reloc.h: Likewise.
7922         * target.cc: Likewise.
7923         * target.h: Likewise.
7924         * timer.cc: Likewise.
7925         * timer.h: Likewise.
7926         * x86_64.cc: Likewise.
7927
7928 2010-12-09  Cary Coutant  <ccoutant@google.com>
7929
7930         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7931         stack.
7932         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7933         parameter; change all callers.
7934         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7935         * options.h (warn_execstack): New option.
7936
7937 2010-12-07  Doug Kwan  <dougkwan@google.com>
7938
7939         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7940         like function call relocations.
7941
7942 2010-12-07  Ian Lance Taylor  <iant@google.com>
7943
7944         * archive.cc (Archive::get_elf_object_for_member): Permit
7945         punconfigured to be NULL.
7946         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7947         (Archive::include_member): Pass NULL to get_elf_object_for_member
7948         if we searched for the archive and this is the first included
7949         object.
7950
7951 2010-12-01  Ian Lance Taylor  <iant@google.com>
7952
7953         * dwarf_reader.h (class Sized_dwarf_line_info): Add
7954         track_relocs_type_ field.
7955         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7956         Set track_relocs_type_.
7957         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7958         contents when using RELA relocs.
7959         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7960         reloc_map_.
7961         * reloc.cc (Track_relocs::next_addend): New function.
7962         * reloc.h (class Track_relocs): Declare next_addend.
7963
7964 2010-12-01  Ian Lance Taylor  <iant@google.com>
7965
7966         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7967         virtual destructor.
7968
7969 2010-12-01  Ian Lance Taylor  <iant@google.com>
7970
7971         * README: Update compilers known to work and fail.
7972
7973 2010-11-23  Matthias Klose  <doko@ubuntu.com>
7974
7975         * configure.in: For --enable-gold, handle value `default' instead of
7976         `both*'.  Always install ld as ld.bfd, install as ld if gold is
7977         not the default.
7978         * configure: Regenerate.
7979
7980 2010-11-18  Doug Kwan  <dougkwan@google.com>
7981
7982         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7983         and right_alignment to be zero.  Store result alignment only if it is
7984         greater than existing alignment.
7985
7986 2010-11-16  Cary Coutant  <ccoutant@google.com>
7987
7988         PR gold/12220
7989         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7990         Check for ".zdebug_line".
7991
7992 2010-11-16  Doug Kwan  <dougkwan@google.com>
7993             Cary Coutant  <ccoutant@google.com>
7994
7995         * output.h (Output_segment::set_section_addresses): Pass increase_relro
7996         by reference; adjust all callers.
7997         * output.cc (Output_segment::set_section_addresses): Adjust references
7998         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7999         list is empty.
8000         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8001         end at page boundary.
8002
8003 2010-11-16  Cary Coutant  <ccoutant@google.com>
8004
8005         PR gold/12220
8006         * layout.cc (Layout::choose_output_section): Transform names of
8007         compressed sections even when using a script with a SECTIONS clause.
8008         (Layout::output_section_name): Remove code to transform
8009         compressed debug section names.
8010         * output.cc (Output_section::add_input_section): Use uncompressed
8011         section size when tracking input sections.
8012
8013 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8014
8015         * symtab.h (Symbol::NON_PIC_REF): Remove.
8016         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8017         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8018         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8019         (Symbol::use_plt_offset): Take a flags argument and pass it
8020         directly to needs_dynamic_reloc.  Restrict check for undefined
8021         weak symbols to function calls.
8022         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8023         (Target_arm::Scan::global): Use it.
8024         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8025         (Target_arm::Relocate::relocate): Likewise.
8026         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8027         parameter with an r_type parameter.  Use get_reference_flags
8028         to get the flags.
8029         (Target_arm::Relocate::relocate): Update accordingly.
8030         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8031         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8032         (Target_i386::Scan::global): Likewise.
8033         (Target_i386::Relocate::relocate): Likewise.
8034         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8035         parameter with an r_type parameter.  Use get_reference_flags
8036         to get the flags.
8037         (Target_i386::Relocate::relocate): Update accordingly.
8038         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8039         (Target_powerpc::Scan::global): Use it.
8040         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8041         (Target_powerpc::Relocate::relocate): Likewise.
8042         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8043         (Target_sparc::Scan::global): Use it.
8044         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8045         (Target_sparc::Relocate::relocate): Likewise.
8046         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8047         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8048         (Target_x86_64::Scan::global): Likewise.
8049         (Target_x86_64::Relocate::relocate): Likewise.
8050
8051 2010-11-08  Doug Kwan  <dougkwan@google.com>
8052             Cary Coutant  <ccoutant@google.com>
8053
8054         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8055         (Arm_exidx_merge_section::section_contents_): New data member.
8056         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8057         (Arm_input_section::~Arm_input_section): De-allocate memory.
8058         (Arm_input_section::original_contents_): New data member.
8059         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8060         in parameters instead of calling Object::section_contents without
8061         locking.
8062         (Arm_output_section::group_section): New parameter TASK.  Pass it
8063         to callees that need locking objects.
8064         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8065         to lock EXIDX input sections.  Fix a formatting issue.  Call
8066         Arm_exidx_merged_section::build_contents to create merged section
8067         contents.
8068         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8069         to lock object of stub table owner.
8070         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8071         TEXT_SIZE to initialize data member TEXT_SIZE_.
8072         (Arm_exidx_input_section::addralign): Fix typo in comment.
8073         (Arm_exidx_input_section::text_size): New method.
8074         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8075         that require locking objects.  Lock objects before scanning for stubs
8076         and updating local symbols.
8077         (Arm_input_section<big_endian>::init): Copy contents of original
8078         input section.
8079         (Arm_input_section<big_endian>::do_write): Use saved contents of
8080         original input section instead of calling Object::section_contents
8081         without locking.
8082         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8083         size without calling Object::section_size().
8084         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8085         for size.  Allocate a buffer for merged EXIDX entries.
8086         (Arm_exidx_merged_section::build_contents): New method.
8087         (Arm_exidx_merged_section::do_write): Move merge section contents
8088         building code to Arm_exidx_merged_section::build_contetns.  Write
8089         out contetns in buffer instead of building it on the fly.
8090         (Arm_relobj::make_exidx_input_section): Also pass text section size
8091         to Arm_exidx_input_section constructor.
8092         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8093         (Arm_dynobj::do_read_symbols): Fix memory leak.
8094         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8095         * target.h: (class Task): Add forward declaration.
8096         (Target::relax): Add new parameter TASK and pass it to
8097         Target::do_relax().
8098         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8099
8100 2010-11-05  Cary Coutant  <ccoutant@google.com>
8101
8102         PR gold/10708
8103         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8104         object when reading from the file.
8105         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8106         second layout pass.
8107         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8108         when reading section contents.
8109         (get_section_contents): Likewise.
8110         (icf::find_identical_sections): Likewise.
8111         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8112         object when reading from the file.
8113         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8114         the object when doing deferred section layout.
8115
8116 2010-11-03  Nick Clifton  <nickc@redhat.com>
8117
8118         PR gold/12001
8119         * script.h (class Symbol_assignment: name): New member.  Returns
8120         the name of the symbol.
8121         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8122         Returns true if the given symbol name is on the list of
8123         assignments wating to be processed.
8124         * archive.cc (should_incldue_member): If the symbol is undefined,
8125         check to see if it is on the list of symbols pending assignment.
8126
8127 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8128
8129         * script-sections.cc (Script_sections::find_memory_region): Check
8130         for a NULL output section pointer.
8131
8132 2010-10-29  Doug Kwan  <dougkwan@google.com>
8133
8134         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8135         Output_section::add_relaxed_input_section.
8136         * output.cc (Output_section::add_relaxed_input_section): Add new
8137         arguments LAYOUT and NAME.  Set section order index.
8138         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8139         Copy section order index.
8140         * output.h (Output_section::add_relaxed_input_section): Add new
8141         arguments LAYOUT and NAME.
8142
8143 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8144
8145         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8146         NATIVE_OR_CROSS_LINKER.
8147         * testsuite/Makefile.in: Regenerate.
8148
8149 2010-10-20  Doug Kwan  <dougkwan@google.com>
8150
8151         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8152         without SHF_LINK_ORDER flags.
8153         * layout.cc (Layout::choose_output_section): Do not filter
8154         SHF_LINK_ORDER flag in a relocatable link.
8155
8156 2010-10-17  Cary Coutant  <ccoutant@google.com>
8157
8158         * output.h (Output_segment::set_section_addresses): Change function
8159         signature.  Update all callers.
8160         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8161         sections.
8162         (Output_segment::set_section_addresses): Align after last TLS
8163         section.  Add padding before last relro section instead of after.
8164
8165 2010-10-17  Doug Kwan  <dougkwan@google.com>
8166
8167         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8168         GOT output section to be writable.
8169
8170 2010-10-14  Cary Coutant  <ccoutant@google.com>
8171
8172         * debug.h (DEBUG_INCREMENTAL): New flag.
8173         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8174         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8175         mode.
8176         * incremental.cc (report_command_line): Ignore all forms of
8177         --incremental.
8178         * layout.cc (Layout::Layout): Check parameters for incremental link
8179         mode.
8180         * options.cc (General_options::parse_incremental): New function.
8181         (General_options::parse_no_incremental): New function.
8182         (General_options::parse_incremental_full): New function.
8183         (General_options::parse_incremental_update): New function.
8184         (General_options::incremental_mode_): New data member.
8185         (General_options::finalize): Check incremental_mode_.
8186         * options.h (General_options): Update help text for --incremental.
8187         Add --no-incremental, --incremental-full, --incremental-update.
8188         (General_options::Incremental_mode): New enum type.
8189         (General_options::incremental_mode): New function.
8190         (General_options::incremental_mode_): New data member.
8191         * parameters.cc (Parameters::incremental_mode_): New data member.
8192         (Parameters::set_options): Set incremental_mode_.
8193         (Parameters::set_incremental_full): New function.
8194         (Parameters::incremental): New function.
8195         (Parameters::incremental_update): New function.
8196         (set_parameters_incremental_full): New function.
8197         * parameters.h (Parameters::set_incremental_full): New function.
8198         (Parameters::incremental): New function.
8199         (Parameters::incremental_update): New function.
8200         (Parameters::incremental_mode_): New data member.
8201         (set_parameters_incremental_full): New function.
8202         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8203         incremental link mode.
8204         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8205         (Sized_relobj::do_relocate_sections): Likewise.
8206         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8207         option.
8208         * testsuite/Makefile.in: Regenerate.
8209         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8210
8211 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8212
8213         * script-sections.h (class Script_sections): Make
8214         Sections_elements typedef public.
8215         * script-sections.cc (class Sort_output_sections): Add elements_
8216         field.  Add constructor which sets it; change all callers.
8217         (Sort_output_sections::is_before): New function.
8218         (Sort_output_sections::operator()): Call is_before.
8219         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8220         conditional.
8221         * testsuite/script_test_10.sh: New test. Test script section
8222         order.
8223         * testsuite/script_test_10.t: Likewise.
8224         * testsuite/script_test_10.s: Likewise.
8225         * testsuite/Makefile.am: Wrap the cross linker tests and the
8226         common tests into NATIVE_OR_CROSS_LINKER.
8227         (check_SCRIPTS): Add script_test_10.sh.
8228         (check_DATA): Add script_test_10.stdout.
8229         (script_test_10.o, script_test_10): New targets.
8230         (script_test_10.stdout): New target.
8231         * configure, testsuite/Makefile.in: Regenerate.
8232
8233 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8234
8235         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8236         error for the deprecated relocations.
8237         (Target_arm::Scan::global): Likewise.
8238         (Target_arm::Relocate::relocate): Likewise.
8239
8240 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8241
8242         * fileread.cc (Input_file::find_file): Initialize *found_name
8243         and *namep when using the fallback search for case 4.
8244
8245 2010-10-11  Cary Coutant  <ccoutant@google.com>
8246
8247         * options.h (class General_options): Redefine -z lazy as an alias for
8248         the negation of -z now.
8249
8250 2010-10-11  Ian Lance Taylor  <iant@google.com>
8251
8252         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8253         binding.
8254
8255 2010-10-06  Nick Clifton  <nickc@redhat.com>
8256
8257         * script-sections.cc(class Memory_region): Remove
8258         current_lma_offset_ field.  Rename current_vma_offset_ to
8259         current_offset_.  Add last_section_ field.
8260         (Memory_region::get_current_vma_address): Rename to
8261         get_current_address.
8262         (Memory_region::get_current_lma_address): Delete.
8263         (Memory_region::increment_vma_offset): Rename to
8264         increment_offset.
8265         (Memory_region::increment_lma_offset): Delete.
8266         (Memory_region::attributes_compatible): New method.  Returns
8267         true if the provided section is compatible with the region.
8268         (Memory_region::get_last_section): New method.  Returns the last
8269         section to use the region.
8270         (Memory_region::set_last_section): New method.  Stores the last
8271         section to use the region.
8272         (Script_sections::block_in_region): New method.  Returns true if
8273         a block of memory is contained within a region.
8274         (Script_sections::find_memory_region): New method.  Locates a
8275         memory region to be used to set a VMA or LMA address.
8276         (Output_section_definition::set_section_addresses): Add code to
8277         check for addresses set by memory regions.
8278         (Output_segment::set_section_addresses): Remove memory region
8279         walking code.
8280         (Script_sections::create_segment): Add a warning if a header
8281         segment is created outside of any region.
8282         * script-sections.h (class Script_sections): Add prototypes for
8283         find_memory_region and block_in_region methods.
8284         * testsuite/memory_test.s: Use .long instead of .word.
8285         * testsuite/memory_test.t: Add some more output sections.
8286         * testsuite/memory_test.sh: Update expected output.
8287
8288 2010-10-02  Doug Kwan  <dougkwan@google.com>
8289
8290         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8291         defintion to symtab.h
8292         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8293         declaration to defintion.
8294
8295 2010-10-01  Nick Clifton  <nickc@redhat.com>
8296
8297         * expression.cc (eval): Replace dummy argument with NULL.
8298         (eval_maybe_dot): Check for a NULL result section pointer.
8299         (Symbol_expression::value): Likewise.
8300         (Dot_expression::value): Likewise.
8301         (BINARY_EXPRESSION): Likewise.
8302         (Max_expression::value): Likewise.
8303         (Min_expression::value): Likewise.
8304         (Absolute_expression::value): Likewise.
8305         (Addr_expression::value_from_output_section): Likewise.
8306         (Loaddddr_expression::value_from_output_section): Likewise.
8307         (Segment_start_expression::value): Likewise.
8308         * script-sections.cc
8309         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8310         argument with NULL.
8311         (Sections_elememt_dot_assignment::set_section_addresses):
8312         Likewise.
8313         (Output_data_expression::do_write_to_buffer): Likewise.
8314         (Output_section_definition::finalize_symbols): Likewise.
8315         (Output_section_definition::set_section_addresses): Likewise.
8316
8317 2010-09-30  Doug Kwan  <dougkwan@google.com>
8318
8319         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8320
8321 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8322
8323         * target.h (Target::can_icf_inline_merge_sections): New virtual
8324         function.
8325         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8326         virtual function.
8327         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8328         virtual function.
8329         * icf.cc (get_section_contents): Inline merge sections only when
8330         target allows it.
8331
8332 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8333
8334         * configure: Regenerate.
8335
8336 2010-09-17  Ian Lance Taylor  <iant@google.com>
8337
8338         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8339         * testsuite/Makefile.am (memory_test.o): New target.
8340         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8341         memory_test.t.
8342         * testsuite/Makefile.in: Rebuild.
8343
8344 2010-09-17  Doug Kwan  <dougkwan@google.com>
8345
8346         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8347         defintion if relocation uses GOT entries of the symbol.
8348         * testsuite/icf_safe_test.sh: Fix test.
8349         * testsuite/icf_safe_so_test.sh: Fix test.
8350
8351 2010-09-16  Cary Coutant  <ccoutant@google.com>
8352
8353         * script_sections.cc (class Memory_region): Remove "NULL" from
8354         vector initializations.
8355
8356 2010-09-15  Cary Coutant  <ccoutant@google.com>
8357
8358         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8359         Resolve forwarding symbols.
8360
8361 2010-09-15  Doug Kwan  <dougkwan@google.com>
8362
8363         * gold/testsuite/script_test_3.t: Add ARM special sections.
8364         * gold/testsuite/script_test_4.t: Same.
8365         * gold/testsuite/script_test_5.t: Same.
8366         * gold/testsuite/script_test_6.t: Same.
8367         * gold/testsuite/script_test_7.t: Same.
8368         * gold/testsuite/script_test_7.t: Same.
8369         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8370
8371 2010-09-14  Cary Coutant  <ccoutant@google.com>
8372
8373         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8374         (Target_x86_64::Relocate::relocate_tls): Replace check for
8375         saw_tls_block_reloc_ with test for executable section.
8376
8377 2010-09-12  Cary Coutant  <ccoutant@google.com>
8378
8379         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8380         position-independent executables to shared libraries need dynamic
8381         relocations.
8382         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8383         position-independent executables.
8384         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8385         * testsuite/Makefile.in: Regenerate.
8386
8387 2010-09-10  Nick Clifton  <nickc@redhat.com>
8388
8389         PR gold/11997
8390         * testsuite/memory_test.t: Discard any sections that are not
8391         needed.
8392
8393 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8394
8395         PR gold/11996
8396         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8397         "This::" to work around a bug in gcc 4.2.
8398
8399         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8400
8401 2010-09-09  Rafael Espindola  <espindola@google.com>
8402
8403         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8404         sections with different PF_X flags in the same segment.
8405         (Layout::find_first_load_seg): Search all segments to find the first
8406         one.
8407         * options.h (rosegment): New.
8408
8409 2010-09-08  Rafael Espindola  <espindola@google.com>
8410
8411         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8412
8413 2010-09-08  Doug Kwan  <dougkwan@google.com>
8414
8415         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8416         (Arm_relobj::do_relocate_sections): Add new parameter for output
8417         file to match the parent.
8418         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8419         of local symbols instead of input values.  Update code to track
8420         changes in gold::relocate_section.
8421         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8422         (Sized_relobj::compute_final_local_value_internal): New methods.
8423         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8424         body into private version of Sized_relobj::compute_final_local_value.
8425         Call the inline method.
8426         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8427         merged symbol value if there is one.
8428         (Symbol_value::has_output_value): New method defintiion.
8429         (Sized_relobj::Compute_final_local_value_status): New enum type.
8430         (Sized_relobj::compute_final_local_value): New methods.
8431         (Sized_relobj::compute_final_local_value_internal): New methods.
8432         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8433         and arm_cortex_a8.sh.
8434         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8435         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8436         New tests.
8437         * Makefile.in: Regenerate.
8438         * testsuite/arm_bl_out_of_range.s: Update test.
8439         * testsuite/thumb_bl_out_of_range.s: Ditto.
8440         * testsuite/thumb_blx_out_of_range.s: Ditto.
8441         * testsuite/arm_branch_out_of_range.sh: New file.
8442         * testsuite/arm_cortex_a8.sh: Ditto.
8443         * testsuite/arm_cortex_a8_b.s: Ditto.
8444         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8445         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8446         * testsuite/arm_cortex_a8_bl.s: Ditto.
8447         * testsuite/arm_cortex_a8_blx.s: Ditto.
8448         * testsuite/arm_cortex_a8_local.s: Ditto.
8449         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8450         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8451
8452 2010-09-08  Rafael Espindola  <espindola@google.com>
8453
8454         * Makefile.am (memory_test.stdout): Run readelf with -W.
8455         * Makefile.in: Regenerate.
8456         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8457         64 bit output.
8458
8459 2010-09-08  Rafael Espindola  <espindola@google.com>
8460
8461         * script-sections.cc (Script_sections::add_memory_region): Convert
8462         field precision to int.
8463         * script.cc (script_set_section_region, script_set_section_region):
8464         Convert field precision to int.
8465
8466 2010-09-08  Rafael Espindola  <espindola@google.com>
8467
8468         * arm.cc (do_finalize_sections): Create the __exidx_start and
8469         __exdix_end symbols even when the section is missing.
8470
8471 2010-09-08  Nick Clifton  <nickc@redhat.com>
8472
8473         * README: Remove claim that MEMORY is not supported.
8474         * expression.cc (script_exp_function_origin)
8475         (script_exp_function_length): Move from here to ...
8476         * script.cc: ... here.
8477         (script_set_section_region, script_add_memory)
8478         (script_parse_memory_attr, script_include_directive): New
8479         functions.
8480         * script-sections.cc
8481         (class Memory_region): New class.
8482         (class Output_section_definition): Add set_memory_region,
8483         set_section_vma, set_section_lma and get_section_name methods.
8484         (class Script_Sections): Add add_memory_region,
8485         find_memory_region, find_memory_region_origin,
8486         find_memory_region_length and set_memory_region methods.
8487         Have set_section_addresses method walk the list of set memory
8488         regions.
8489         Extend the print methos to display memory regions.
8490         * script-sections.h: Add prototypes for new methods.
8491         Add enum for MEMORY region attributes.
8492         * yyscript.y: Add support for parsing MEMORY regions.
8493         * script-c.h: Add prototypes for new functions.
8494         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8495         * testsuite/Makefile.in: Regenerate.
8496         * testsuite/memory_test.sh: New script.
8497         * testsuite/memory_test.s: New assembler source file.
8498         * testsuite/memory_test.t: New linker script.
8499
8500 2010-08-27  Doug Kwan  <dougkwan@google.com>
8501
8502         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8503         reference override an existing dynamic weak reference.
8504         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8505         * testsuite/Makefile.in: Regenerate.
8506         * testsuite/dyn_weak_ref.sh: New file.
8507         * testsuite/dyn_weak_ref_1.c: Ditto.
8508         * testsuite/dyn_weak_ref_2.c: Ditto.
8509
8510 2010-08-27  Ian Lance Taylor  <iant@google.com>
8511
8512         * incremental.h (class Incremental_input_entry): Add virtual
8513         destructor.
8514
8515 2010-08-27  Ian Lance Taylor  <iant@google.com>
8516
8517         * testsuite/start_lib_test_3.c: Mark t3 as used.
8518
8519 2010-08-27  Nick Clifton  <nickc@redhat.com>
8520
8521         * options.cc (version_script): Fix small typo in previous
8522         whitespace tidyup.
8523
8524 2010-08-25  Nick Clifton  <nickc@redhat.com>
8525
8526         * archive.cc: Formatting fixes: Remove whitespace between
8527         typename and following asterisk.  Remove whitespace between
8528         function name and opening parenthesis.
8529         * archive.h: Likewise.
8530         * arm.cc: Likewise.
8531         * attributes.cc: Likewise.
8532         * attributes.h: Likewise.
8533         * common.cc: Likewise.
8534         * copy-relocs.cc: Likewise.
8535         * dirsearch.h: Likewise.
8536         * dynobj.cc: Likewise.
8537         * ehframe.cc: Likewise.
8538         * ehframe.h: Likewise.
8539         * expression.cc: Likewise.
8540         * fileread.cc: Likewise.
8541         * fileread.h: Likewise.
8542         * gc.h: Likewise.
8543         * gold-threads.cc: Likewise.
8544         * gold.cc: Likewise.
8545         * i386.cc: Likewise.
8546         * icf.h: Likewise.
8547         * incremental-dump.cc: Likewise.
8548         * incremental.cc: Likewise.
8549         * layout.cc: Likewise.
8550         * layout.h: Likewise.
8551         * main.cc: Likewise.
8552         * merge.cc: Likewise.
8553         * merge.h: Likewise.
8554         * object.cc: Likewise.
8555         * object.h: Likewise.
8556         * options.cc: Likewise.
8557         * options.h: Likewise.
8558         * output.cc: Likewise.
8559         * output.h: Likewise.
8560         * plugin.cc: Likewise.
8561         * plugin.h: Likewise.
8562         * powerpc.cc: Likewise.
8563         * reloc.cc: Likewise.
8564         * script-c.h: Likewise.
8565         * script-sections.cc: Likewise.
8566         * script.cc: Likewise.
8567         * stringpool.cc: Likewise.
8568         * symtab.cc: Likewise.
8569         * symtab.h: Likewise.
8570         * target.cc: Likewise.
8571         * timer.cc: Likewise.
8572         * timer.h: Likewise.
8573         * version.cc: Likewise.
8574         * x86_64.cc: Likewise.
8575
8576 2010-08-24  Nick Clifton  <nickc@redhat.com>
8577
8578         PR 11899
8579         * layout.cc (segment_precedes): Sort segments by their physical
8580         addresses, if they have been set.
8581
8582 2010-08-23  Cary Coutant  <ccoutant@google.com>
8583
8584         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8585         symbols data.
8586         (Lib_group::include_member): Unlock object after deleting its
8587         symbols data.
8588         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8589         the bug fixed here.
8590
8591 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8592             Cary Coutant  <ccoutant@google.com>
8593
8594         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8595         constructor, and set_blocker.
8596         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8597         readsyms_blocker_.
8598         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8599         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8600         * testsuite/Makefile.am (start_lib_test): New test case.
8601         * testsuite/Makefile.in: Regenerate.
8602         * testsuite/start_lib_test_main.c: New file.
8603         * testsuite/start_lib_test_1.c: New file.
8604         * testsuite/start_lib_test_2.c: New file.
8605         * testsuite/start_lib_test_3.c: New file.
8606
8607 2010-08-19  Ian Lance Taylor  <iant@google.com>
8608
8609         * Makefile.in: Rebuild with automake 1.11.1.
8610         * aclocal.m4: Likewise.
8611         * testsuite/Makefile.in: Likewise.
8612
8613 2010-08-19  Ian Lance Taylor  <iant@google.com>
8614
8615         PR 10893
8616         * i386.cc (class Output_data_plt_i386): Update declarations.
8617         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8618         local_ifuncs_ fields.
8619         (Target_i386::do_plt_section_for_global): New function.
8620         (Target_i386::do_plt_section_for_local): New function.
8621         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8622         parameter; change all callers.  Initialize global_ifuncs_ and
8623         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8624         __rel_iplt_end.
8625         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8626         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8627         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8628         symbols.
8629         (Target_i386::make_plt_section): New function, broken out of
8630         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8631         (Target_i386::make_plt_entry): Call make_plt_section.
8632         (Target_i386::make_local_ifunc_plt_entry): New function.
8633         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8634         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8635         R_386_IRELATIVE to switch.
8636         (Target_i386::Scan::global): Likewise.
8637         (Target_i386::Relocate::relocate): Likewise.
8638         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8639         switch.
8640         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8641         (Target_x86_64::do_plt_section_for_global): New function.
8642         (Target_x86_64::do_plt_section_for_local): New function.
8643         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8644         parameter; change all callers.  If doing a static link define
8645         __rela_iplt_start and __rela_iplt_end.
8646         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8647         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8648         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8649         to point to .plt.
8650         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8651         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8652         switch.
8653         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8654         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8655         R_X86_64_IRELATIVE to switch.
8656         (Target_x86_64::Scan::global): Likewise.
8657         (Target_x86_64::Relocate::relocate): Likewise.
8658         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8659         switch.
8660         * target.h (class Target): Add plt_section_for_global and
8661         plt_section_for_local functions.  Add do_plt_section_for_global
8662         and do_plt_section_for_local virtual functions.
8663         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8664         clarifying comments.
8665         (Symbol::use_plt_offset): Handle IFUNC symbol.
8666         * object.cc (Sized_relobj::Sized_relobj): Initialize
8667         local_plt_offsets_.
8668         (Sized_relobj::local_has_plt_offset): New function.
8669         (Sized_relobj::local_plt_offset): New function.
8670         (Sized_relobj::set_local_plt_offset): New function.
8671         (Sized_relobj::do_count): Handle IFUNC symbol.
8672         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8673         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8674         is_ifunc_symbol functions.
8675         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8676         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8677         local_plt_offsets_ field.
8678         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8679         * output.h (class Output_section_data): Add non-const
8680         output_section function.
8681         (class Output_data_got): Update declarations.
8682         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8683         Add use_plt_offset parameter to global and local constructors.
8684         Change all callers.  Change local_sym_index_ field to 31 bits.
8685         Change GSYM_CODE and CONSTANT_CODE accordingly.
8686         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8687         doing a static link don't set sh_link field.
8688         (Output_data_got::Got_entry::write): Use PLT offset if
8689         appropriate.
8690         (Output_data_got::add_global_plt): New function.
8691         (Output_data_got::add_local_plt): New function.
8692         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8693         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8694         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8695         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8696         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8697         IFUNC conditional.
8698         * testsuite/ifunc-sel.h: New file.
8699         * testsuite/ifuncmain1.c: New file.
8700         * testsuite/ifuncmain1vis.c: New file.
8701         * testsuite/ifuncmod1.c: New file.
8702         * testsuite/ifuncdep2.c: New file.
8703         * testsuite/ifuncmain2.c: New file.
8704         * testsuite/ifuncmain3.c: New file.
8705         * testsuite/ifuncmod3.c: New file.
8706         * testsuite/ifuncmain4.c: New file.
8707         * testsuite/ifuncmain5.c: New file.
8708         * testsuite/ifuncmod5.c: New file.
8709         * testsuite/ifuncmain6pie.c: New file.
8710         * testsuite/ifuncmod6.c: New file.
8711         * testsuite/ifuncmain7.c: New file.
8712         * configure, testsuite/Makefile.in: Rebuild.
8713
8714 2010-08-18  Ian Lance Taylor  <iant@google.com>
8715
8716         * incremental.cc
8717         (Output_section_incremental_inputs::write_input_files): Add cast
8718         to avoid signed/unsigned comparison warning.
8719         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8720
8721 2010-08-12  Cary Coutant  <ccoutant@google.com>
8722
8723         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8724
8725 2010-08-13  Ian Lance Taylor  <iant@google.com>
8726
8727         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8728
8729 2010-08-12  Cary Coutant  <ccoutant@google.com>
8730             Doug Kwan  <dougkwan@google.com>
8731
8732         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8733         defintion overrides non-weak undef, remember that the original undef
8734         is not weak.
8735         * symtab.cc (Symbol_table::sized_write_global): For undef without
8736         an original weak binding, set binding to global in output.
8737         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8738         * testsuite/Makefile.in: Regenerate.
8739         * testsuite/strong_ref_weak_def.sh: New file.
8740         * testsuite/strong_ref_weak_def_1.c: Ditto.
8741         * testsuite/strong_ref_weak_def_2.c: Ditto.
8742
8743 2010-08-12  Cary Coutant  <ccoutant@google.com>
8744
8745         * testsuite/incremental_test.sh: Rewrite.
8746         * testsuite/incremental_test_1.c: Rewrite.
8747         * testsuite/incremental_test_2.c: Rewrite.
8748
8749 2010-08-12  Cary Coutant  <ccoutant@google.com>
8750
8751         * arm.cc (Target_arm::got_size): Add const.
8752         (Target_arm::got_entry_count): New function.
8753         (Target_arm::plt_entry_count): New function.
8754         (Target_arm::first_plt_entry_offset): New function.
8755         (Target_arm::plt_entry_size): New function.
8756         (Output_data_plt_arm::entry_count): New function.
8757         (Output_data_plt_arm::first_plt_entry_offset): New function.
8758         (Output_data_plt_arm::get_plt_entry_size): New function.
8759         * i386.cc (Target_i386::got_size): Add const.
8760         (Target_i386::got_entry_count): New function.
8761         (Target_i386::plt_entry_count): New function.
8762         (Target_i386::first_plt_entry_offset): New function.
8763         (Target_i386::plt_entry_size): New function.
8764         (Output_data_plt_i386::entry_count): New function.
8765         (Output_data_plt_i386::first_plt_entry_offset): New function.
8766         (Output_data_plt_i386::get_plt_entry_size): New function.
8767         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8768         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8769         * incremental.cc: Include target.h.
8770         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8771         parameter.  Adjust all callers.  Find incremental_got_plt section.
8772         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8773         section.
8774         (Output_section_incremental_inputs::set_final_data_size): Calculate
8775         size of incremental_got_plt section.
8776         (Output_section_incremental_inputs::do_write): Write the
8777         incremental_got_plt section.
8778         (Got_plt_view_info): New struct.
8779         (Local_got_offset_visitor): New class.
8780         (Global_got_offset_visitor): New class.
8781         (Global_symbol_visitor_got_plt): New class.
8782         (Output_section_incremental_inputs::write_got_plt): New function.
8783         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8784         Add parameter.  Adjust all callers.
8785         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8786         (Incremental_inputs::got_plt_section): New function.
8787         (Incremental_inputs::got_plt_section_): New data member.
8788         (Incremental_got_plt_reader): New class.
8789         * layout.cc (Layout::create_incremental_info_sections): Add the
8790         incremental_got_plt section.
8791         * object.h (Got_offset_list::get_list): New function.
8792         (Got offset_list::for_all_got_offsets): New function.
8793         (Sized_relobj::local_got_offset_list): New function.
8794         * powerpc.cc (Target_powerpc::got_size): Add const.
8795         (Target_powerpc::got_entry_count): New function.
8796         (Target_powerpc::plt_entry_count): New function.
8797         (Target_powerpc::first_plt_entry_offset): New function.
8798         (Target_powerpc::plt_entry_size): New function.
8799         (Output_data_plt_powerpc::entry_count): New function.
8800         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8801         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8802         * sparc.cc (Target_sparc::got_size): Add const.
8803         (Target_sparc::got_entry_count): New function.
8804         (Target_sparc::plt_entry_count): New function.
8805         (Target_sparc::first_plt_entry_offset): New function.
8806         (Target_sparc::plt_entry_size): New function.
8807         (Output_data_plt_sparc::entry_count): New function.
8808         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8809         (Output_data_plt_sparc::get_plt_entry_size): New function.
8810         * symtab.h (Symbol::got_offset_list): New function.
8811         (Symbol_table::for_all_symbols): New function.
8812         * target.h (Sized_target::got_entry_count): New function.
8813         (Sized_target::plt_entry_count): New function.
8814         (Sized_target::plt_entry_size): New function.
8815         * x86_64.cc (Target_x86_64::got_size): Add const.
8816         (Target_x86_64::got_entry_count): New function.
8817         (Target_x86_64::plt_entry_count): New function.
8818         (Target_x86_64::first_plt_entry_offset): New function.
8819         (Target_x86_64::plt_entry_size): New function.
8820         (Output_data_plt_x86_64::entry_count): New function.
8821         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8822         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8823
8824 2010-08-12  Cary Coutant  <ccoutant@google.com>
8825
8826         * archive.cc: Include incremental.h.
8827         (Archive::Archive): Initialize incremental_info_.
8828         (Archive::include_member): Record archive members in incremental info.
8829         (Add_archive_symbols::run): Record begin and end of an archive in
8830         incremental info.
8831         (Lib_group::include_member): Record objects in incremental info.
8832         * archive.h (Incremental_archive_entry): Forward declaration.
8833         (Archive::set_incremental_info): New member function.
8834         (Archive::incremental_info): New member function.
8835         (Archive::Unused_symbol_iterator): New class.
8836         (Archive::unused_symbols_begin): New member function.
8837         (Archive::unused_symbols_end): New member function.
8838         (Archive::incremental_info_): New data member.
8839         * incremental-dump.cc (find_input_containing_global): New function.
8840         (dump_incremental_inputs): Dump new incremental info sections.
8841         * incremental.cc: Include symtab.h.
8842         (Output_section_incremental_inputs): New class.
8843         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8844         new incremental info sections.
8845         (Sized_incremental_binary::do_check_inputs): Likewise.
8846         (Incremental_inputs::report_archive): Remove.
8847         (Incremental_inputs::report_archive_begin): New function.
8848         (Incremental_inputs::report_archive_end): New function.
8849         (Incremental_inputs::report_object): New function.
8850         (Incremental_inputs::finalize_inputs): Remove.
8851         (Incremental_inputs::report_input_section): New function.
8852         (Incremental_inputs::report_script): Rewrite.
8853         (Incremental_inputs::finalize): Do nothing but finalize string table.
8854         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8855         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8856         (Incremental_inputs::create_data_sections): New function.
8857         (Incremental_inputs::relocs_entsize): New function.
8858         (Output_section_incremental_inputs::set_final_data_size): New function.
8859         (Output_section_incremental_inputs::do_write): New function.
8860         (Output_section_incremental_inputs::write_header): New function.
8861         (Output_section_incremental_inputs::write_input_files): New function.
8862         (Output_section_incremental_inputs::write_info_blocks): New function.
8863         (Output_section_incremental_inputs::write_symtab): New function.
8864         * incremental.h (Incremental_script_entry): Forward declaration.
8865         (Incremental_object_entry): Forward declaration.
8866         (Incremental_archive_entry): Forward declaration.
8867         (Incremental_inputs): Forward declaration.
8868         (Incremental_inputs_header_data): Remove.
8869         (Incremental_inputs_header): Remove.
8870         (Incremental_inputs_header_write): Remove.
8871         (Incremental_inputs_entry_data): Remove.
8872         (Incremental_inputs_entry): Remove.
8873         (Incremental_inputs_entry_write): Remove.
8874         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8875         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8876         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8877         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8878         Likewise.
8879         (Incremental_input_entry): New class.
8880         (Incremental_script_entry): New class.
8881         (Incremental_object_entry): New class.
8882         (Incremental_archive_entry): New class.
8883         (Incremental_inputs::Incremental_inputs): Initialize new data members.
8884         (Incremental_inputs::report_inputs): Remove.
8885         (Incremental_inputs::report_archive): Remove.
8886         (Incremental_inputs::report_archive_begin): New function.
8887         (Incremental_inputs::report_archive_end): New function.
8888         (Incremental_inputs::report_object): Change prototype.
8889         (Incremental_inputs::report_input_section): New function.
8890         (Incremental_inputs::report_script): Change prototype.
8891         (Incremental_inputs::get_reloc_count): New function.
8892         (Incremental_inputs::set_reloc_count): New function.
8893         (Incremental_inputs::create_data_sections): New function.
8894         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8895         (Incremental_inputs::inputs_section): New function.
8896         (Incremental_inputs::symtab_section): New function.
8897         (Incremental_inputs::relocs_section): New function.
8898         (Incremental_inputs::get_stringpool): Add const.
8899         (Incremental_inputs::command_line): Add const.
8900         (Incremental_inputs::inputs): Remove.
8901         (Incremental_inputs::command_line_key): New function.
8902         (Incremental_inputs::input_file_count): New function.
8903         (Incremental_inputs::input_files): New function.
8904         (Incremental_inputs::relocs_entsize): New function.
8905         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8906         (Incremental_inputs::finalize_inputs): Remove.
8907         (Incremental_inputs::Input_info): Remove.
8908         (Incremental_inputs::lock_): Remove.
8909         (Incremental_inputs::inputs_): Change type.
8910         (Incremental_inputs::inputs_map_): Remove.
8911         (Incremental_inputs::current_object_entry_): New data member.
8912         (Incremental_inputs::inputs_section_): New data member.
8913         (Incremental_inputs::symtab_section_): New data member.
8914         (Incremental_inputs::relocs_section_): New data member.
8915         (Incremental_inputs::reloc_count_): New data member.
8916         (Incremental_inputs_reader): New class.
8917         (Incremental_symtab_reader): New class.
8918         (Incremental_relocs_reader): New class.
8919         * layout.cc (Layout::finalize): Move finalization of incremental info
8920         and creation of incremental info sections to follow finalization of
8921         symbol table.  Set offsets for postprocessing sections.
8922         (Layout::create_incremental_info_sections): Call
8923         Incremental_inputs::create_data_sections.  Add incremental symtab
8924         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
8925         sections to layout after input sections.
8926         * layout.h (struct Timespec): Forward declaration.
8927         (Layout::incremental_inputs): Add const.
8928         (Layout::create_incremental_info_sections): Add parameter.
8929         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8930         * object.cc: Include incremental.h.
8931         (Relobj::finalize_incremental_relocs): New function.
8932         (Sized_relobj::do_layout): Record input sections in incremental info.
8933         * object.h (Object::output_section): New function.
8934         (Object::output_section_offset): Moved from Relobj.
8935         (Object::get_incremental_reloc_base): New function.
8936         (Object::get_incremental_reloc_count): New function.
8937         (Object::do_output_section): New function.
8938         (Object::do_output_section_offset): Moved from Relobj.
8939         (Object::do_get_incremental_reloc_base): New function.
8940         (Object::do_get_incremental_reloc_count): New function.
8941         (Object::Object): Initialize new data members.
8942         (Relobj::output_section): Renamed do_output_section and moved to
8943         protected.
8944         (Relobj::output_section_offset): Moved to Object.
8945         (Relobj::do_get_incremental_reloc_base): New function.
8946         (Relobj::do_get_incremental_reloc_count): New function.
8947         (Relobj::allocate_incremental_reloc_counts): New function.
8948         (Relobj::count_incremental_reloc): New function.
8949         (Relobj::finalize_incremental_relocs): New function.
8950         (Relobj::next_incremental_reloc_index): New function.
8951         (Relobj::reloc_counts_): New data member.
8952         (Relobj::reloc_bases_): New data member.
8953         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
8954         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
8955         (Sized_relobj::incremental_relocs_scan): New function.
8956         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8957         (Sized_relobj::incremental_relocs_write): New function.
8958         (Sized_relobj::incremental_relocs_write_reltype): New function.
8959         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8960         incremental link.
8961         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8962         archives and object files elsewhere.
8963         (Add_symbols::run): Report object files here.
8964         (Finish_group::run): Report end of archive at end of group.
8965         * reloc.cc: Include layout.h, incremental.h.
8966         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8967         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8968         (Sized_relobj::incremental_relocs_scan): New function.
8969         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8970         (Sized_relobj::do_relocate_sections): Write incremental relocations.
8971         (Sized_relobj::incremental_relocs_write): New function.
8972         (Sized_relobj::incremental_relocs_write_reltype): New function.
8973         * script.cc (read_input_script): Rewrite test for incremental link.
8974         Change call to Incremental_inputs::report_script.
8975         * symtab.h (Symbol_table::first_global_index): New function.
8976         (Symbol_table::output_count): New function.
8977
8978 2010-08-12  Doug Kwan  <dougkwan@google.com>
8979
8980         * arm.cc (Target_arm::merge_object_attributes): Check command line
8981         options --no-wchar-size-warning and --no-enum-size-warning.
8982         * options.h (General_options): Add ld-compatible options
8983         --no-enum-size-warning and --no-wchar-size-warning.
8984
8985 2010-08-04  Ian Lance Taylor  <iant@google.com>
8986
8987         * x86_64.cc (Target_x86_64::Scan::local): Use
8988         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8989         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8990         (Target_x86_64::Scan::global): Likewise.
8991         (Target_x86_64::Relocate::relocate): Likewise.
8992         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8993         Likewise.
8994
8995 2010-08-03  Cary Coutant  <ccoutant@google.com>
8996
8997         * merge.cc (Output_merge_string::do_add_input_section): Count strings
8998         to reserve space in merged_strings vector. Keep total input size
8999         for stats.
9000         (Output_merge_string::do_print_merge_stats): Print total input size.
9001         * merge.h (Output_merge_string): Add input_size_ field.
9002         * stringpool.cc (Stringpool_template::string_length): Move
9003         implementations out of Stringpool_template class and place in
9004         stringpool.h.
9005         * stringpool.h (string_length): Move out of Stringpool_template.
9006
9007 2010-08-03  Ian Lance Taylor  <iant@google.com>
9008
9009         PR 11712
9010         * layout.cc (relaxation_loop_body): If address of load segment is
9011         set, adjust address to include headers if possible.
9012
9013 2010-08-03  Ian Lance Taylor  <iant@google.com>
9014
9015         * version.cc (version_string): Bump to 1.10.
9016
9017 2010-08-03  Ian Lance Taylor  <iant@google.com>
9018
9019         PR 11805
9020         * layout.h (enum Output_section_order): Define.
9021         (class Layout): Update declarations.
9022         * layout.cc (Layout::get_output_section): Add order parameter.
9023         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9024         is_first_non_relro parameters.  Change all callers.
9025         (Layout::choose_output_section): Likewise.
9026         (Layout::add_output_section_data): Likewise.
9027         (Layout::make_output_section): Likewise.  Set order.
9028         (Layout::default_section_order): New function.
9029         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9030         * output.cc (Output_section::Output_section): Initialize order_.
9031         Don't initialize deleted fields.
9032         (Output_segment::Output_segment): Don't initialize deleted
9033         fields.
9034         (Output_segment::add_output_section_to_load): New function
9035         replacing add_output_section.  Change all callers to call this or
9036         add_output_section_to_nonload.
9037         (Output_segment::add_output_section_to_nonload): New function.
9038         (Output_segment::remove_output_section): Rewrite.
9039         (Output_segment::add_initial_output_data): Likewise.
9040         (Output_segment::has_any_data_sections): Likewise.
9041         (Output_segment::is_first_section_relro): Likewise.
9042         (Output_segment::maximum_alignment): Likewise.
9043         (Output_segment::has_dynamic_reloc): New function replacing
9044         dynamic_reloc_count.  Change all callers.
9045         (Output_segment::has_dynamic_reloc_list): New function replacing
9046         dynamic_reloc_count_list.  Change all callers.
9047         (Output_segment::set_section_addresses): Rewrite.
9048         (Output_segment::set_offset): Rewrite.
9049         (Output_segment::find_first_and_last_list): Remove.
9050         (Output_segment::set_tls_offsets): Rewrite.
9051         (Output_segment::first_section_load_address): Likewise.
9052         (Output_segment::output_section_count): Likewise.
9053         (Output_segment::section_with_lowest_load_address): Likewise.
9054         (Output_segment::write_section_headers): Likewise.
9055         (Output_segment::print_sections_to_map): Likewise.
9056         * output.h (class Output_data): Remove dynamic_reloc_count_
9057         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9058         (Output_data::add_dynamic_reloc): Rewrite.
9059         (Output_data::has_dynamic_reloc): New function.
9060         (Output_data::dynamic_reloc_count): Remove.
9061         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9062         is_last_relro_, is_first_non_relro_, is_interp_,
9063         is_dynamic_linker_section_ fields.  Add order and set_order
9064         functions.  Remove is_relro_local, set_is_relro_local,
9065         is_last_relro, set_is_last_relro, is_first_non_relro,
9066         set_is_first_non_relro functions, is_interp, set_is_interp,
9067         is_dynamic_linker_section, and set_is_dynamic_linker_section
9068         functions.
9069         (class Output_segment): Change Output_data_list from std::list to
9070         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9071         output_bss_ fields.  Update declarations.
9072
9073 2010-08-02  Ian Lance Taylor  <iant@google.com>
9074
9075         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9076         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9077         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9078
9079 2010-08-02  Ian Lance Taylor  <iant@google.com>
9080
9081         PR 11855
9082         * script.cc (Script_options::Script_options): Initialize
9083         symbol_definitions_ and symbol_references_.
9084         (Script_options::add_symbol_assignment): Update
9085         symbol_definitions_ and symbol_references_.
9086         (Script_options::add_symbol_reference): New function.
9087         (script_symbol): New function.
9088         * script.h (class Script_options): Add symbol_definitions_ and
9089         symbol_references_ fields.
9090         (Script_options::referenced_const_iterator): New type.
9091         (Script_options::referenced_begin): New function.
9092         (Script_options::referenced_end): New function.
9093         (Script_options::is_referenced): New function.
9094         (Script_options::any_unreferenced): New function.
9095         * script-c.h (script_symbol): Declare.
9096         * yyscript.y (exp): Call script_symbol.
9097         * symtab.cc: Include "script.h".
9098         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9099         Change all callers.  Check symbols referenced by scripts.
9100         (Symbol_table::add_undefined_symbols_from_command_line): Add
9101         layout parameter.  Change all callers.
9102         (Symbol_table::do_add_undefined_symbols_from_command_line):
9103         Likewise.  Break out loop body.  Check symbols referenced by
9104         scripts.
9105         (Symbol_table::add_undefined_symbol_from_command_line): New
9106         function broken out of
9107         do_add_undefined_symbols_from_command_line.
9108         * symtab.h (class Symbol_table): Update declarations.
9109         * archive.cc: Include "layout.h".
9110         (Archive::should_include_member): Add layout parameter.  Change
9111         all callers.  Check for symbol mentioned in expression.
9112         * archive.h (class Archive): Update declaration.
9113         * object.cc (Sized_relobj::do_should_include_member): Add layout
9114         parameter.
9115         * object.h (Object::should_include_member): Add layout parameter.
9116         Change all callers.
9117         (Object::do_should_include_member): Add layout parameter.
9118         (class Sized_relobj): Update declaration.
9119         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9120         parameter.
9121         * dynobj.h (class Sized_dynobj): Update declaration.
9122         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9123         layout parameter.
9124         * plugin.h (class Sized_pluginobj): Update declaration.
9125
9126 2010-08-02  Ian Lance Taylor  <iant@google.com>
9127
9128         PR 11866
9129         * output.cc (Output_segment::set_offset): Search for the first and
9130         last sections rather than assuming that the list is in order.
9131         (Output_segment::find_first_and_last_list): New function.
9132         * output.h (class Output_segment): Update declarations.
9133         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9134         (relro_strip_test_SOURCES): New variable.
9135         (relro_strip_test_DEPENDENCIES): New variable.
9136         (relro_strip_test_LDFLAGS): New variable.
9137         (relro_strip_test_LDADD): New variable.
9138         (relro_strip_test.so): New target.
9139
9140 2010-08-02  Ian Lance Taylor  <iant@google.com>
9141
9142         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9143         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9144         (Target_i386::got_tlsdesc_section): New function.
9145         (Target_i386::got_section): Create space for GOT entries for
9146         TLSDESC relocations.
9147         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9148         R_386_TLS_GOTDESC.
9149         (Target_i386::Scan::global): Likewise.
9150         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9151         using TLSDESC GOT.
9152         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9153         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9154         (Target_x86_64::got_tlsdesc_section): New function.
9155         (Target_x86_64::got_section): Create space for GOT entries for
9156         TLSDESC relocations.
9157         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9158         R_386_TLS_GOTDESC.
9159         (Target_x86_64::Scan::global): Likewise.
9160         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9161         using TLSDESC GOT.
9162
9163 2010-08-02  Ian Lance Taylor  <iant@google.com>
9164
9165         * testsuite/final_layout.sh: Use dc to convert from hex to
9166         decimal.
9167
9168 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9169
9170         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9171         paramter to the call to gold::gc_process_relocs.
9172         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9173         paramter to the call to gold::gc_process_relocs.
9174         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9175         parameter to the call to gold::gc_process_relocs.
9176         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9177         template parameter to the call to gold::gc_process_relocs.
9178         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9179         paramter to the call to gold::gc_process_relocs.
9180         * gc.h (get_embedded_addend_size): New function.
9181         (gc_process_relocs): Save the size of the reloc for use by ICF.
9182         * icf.cc (get_section_contents): Get the addend from the text section
9183         for SHT_REL relocation sections.
9184         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9185         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9186         * int_encoding.h (read_from_pointer): New overloaded function.
9187         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9188         * testsuite/icf_sht_rel_addend_test.sh: New file.
9189         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9190         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9191
9192 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9193
9194         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9195         * Makefile.in: Regenerate.
9196         * testsuite/Makefile.in: Regenerate.
9197
9198 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9199
9200         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9201         * gold/testsuite/debug_msg.cc: Likewise.
9202         * gold/testsuite/odr_violation1.cc
9203         * gold/testsuite/odr_violation2.cc
9204
9205 2010-07-21  Cary Coutant  <ccoutant@google.com>
9206
9207         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9208         string, and length fields.
9209         (Output_merge_string::Merged_strings_list): New type.
9210         (Output_merge_string::Merged_strings_lists): New typedef.
9211         (Output_merge_string): Replace merged_strings_ with
9212         merged_strings_lists_.
9213         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9214         Merged_strings_list per input object and section.  Don't store pointer
9215         to the string.  Don't store length with each merged string entry.
9216         (Output_merge_string::finalize_merged_data): Loop over list of merged
9217         strings lists.  Recompute length of each merged string.
9218
9219 2010-07-15  Cary Coutant  <ccoutant@google.com>
9220
9221         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9222         here.
9223
9224 2010-07-14  Ian Lance Taylor  <iant@google.com>
9225
9226         * descriptors.cc (Descriptors::open): Report correct name in error
9227         message.
9228
9229 2010-07-13  Doug Kwan  <dougkwan@google.com>
9230
9231         * arm.cc (Arm_input_section::Arm_input_section): For a
9232         SHT_ARM_EXIDX section, always keeps the input sections.
9233         (Arm_input_section::set_exidx_section_link): New method.
9234         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9235         has_errors_ to false.
9236         (Arm_exidx_input_section::has_errors,
9237         Arm_exidx_input_section::set_has_errors): New methods.
9238         (Arm_exidx_input_section::has_errors_): New data member.
9239         (Arm_relobj::get_exidx_shndx_list): New method.
9240         (Arm_output_section::append_text_sections_to_list): Do not skip
9241         section without SHF_EXECINSTR.
9242         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9243         errors.
9244         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9245         section header.  Make error messages more verbose.  Check for
9246         a non-executable section linked to an EXIDX section.
9247         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9248         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9249         check that there is no deferred EXIDX section if we exit early.
9250         Instead of not making an EXIDX section in case of an error, make one
9251         and set the has_errors flag of it.
9252         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9253         in a relocatable link.
9254         (Target_arm::do_relax): Look for the EXIDX output section instead of
9255         assuming that it is called .ARM.exidx.
9256         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9257         section list.  Do not check for SHF_EXECINSTR section flags but
9258         skip any input section with errors.
9259         * output.cc (Output_section::Output_section): Initialize
9260         always_keeps_input_sections_ to false.
9261         (Output_section::add_input_section): Check for
9262         always_keeps_input_sections_.
9263         *  output.h (Output_section::always_keeps_input_sections,
9264         Output_section::set_always_keeps_input_sections): New methods.
9265         (Output_section::always_keeps_input_sections): New data member.
9266
9267 2010-07-13  Rafael Espindola  <espindola@google.com>
9268
9269         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9270         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9271
9272 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9273             Ian Lance Taylor  <iant@google.com>
9274
9275         * output.h (Output_section_lookup_maps::add_merge_section):
9276         Correct check of whether value was inserted.
9277         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9278         (Output_section_lookup_maps::add_relaxed_input_section):
9279         Likewise.
9280         * arm.cc (Target_arm::got_section): Remove used local os.
9281         * i386.cc (Target_i386::got_section): Likewise.
9282         * x86_64.cc (Target_x86_64::got_section): Likewise.
9283         * sparc.cc (Target_sparc::got_section): Likewise.
9284         (Target_sparc::relocate): Remove unused local have_got_offset.
9285         * powerpc.cc (Target_powerpc::relocate): Likewise.
9286
9287 2010-07-13  Ian Lance Taylor  <iant@google.com>
9288
9289         * compressed_output.cc (zlib_decompress): Fix signature in
9290         !HAVE_ZLIB_H case.
9291
9292         * archive.cc (Archive::include_member): Unlock an external member
9293         of a thin archive.  Don't bother to delete an object we know is
9294         NULL.
9295
9296 2010-07-12  Cary Coutant  <ccoutant@google.com>
9297
9298         * compressed_output.cc (zlib_decompress): New function.
9299         (get_uncompressed_size): New function.
9300         (decompress_input_section): New function.
9301         * compressed_output.h (get_uncompressed_size): New function.
9302         (decompress_input_section): New function.
9303         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9304         Handle compressed debug sections.
9305         * layout.cc (is_compressed_debug_section): New function.
9306         (Layout::output_section_name): Map compressed section names to
9307         canonical names.
9308         * layout.h (is_compressed_debug_section): New function.
9309         (is_debug_info_section): Recognize compressed debug sections.
9310         * merge.cc: Include compressed_output.h.
9311         (Output_merge_data::do_add_input_section): Handle compressed
9312         debug sections.
9313         (Output_merge_string::do_add_input_section): Handle compressed
9314         debug sections.
9315         * object.cc: Include compressed_output.h.
9316         (Sized_relobj::Sized_relobj): Initialize new data members.
9317         (build_compressed_section_map): New function.
9318         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9319         * object.h (Object::section_is_compressed): New method.
9320         (Object::do_section_is_compressed): New method.
9321         (Sized_relobj::Compressed_section_map): New type.
9322         (Sized_relobj::do_section_is_compressed): New method.
9323         (Sized_relobj::compressed_sections_): New data member.
9324         * output.cc (Output_section::add_input_section): Handle compressed
9325         debug sections.
9326         * reloc.cc: Include compressed_output.h.
9327         (Sized_relobj::write_sections): Handle compressed debug sections.
9328
9329 2010-07-08  Cary Coutant  <ccoutant@google.com>
9330
9331         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9332         weak when resolving to a dynamic def.
9333         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9334         for weak undef/dynamic def cases. Adjust callers.
9335         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9336         undef_binding_weak_.
9337         (Symbol_table::sized_write_globals): Adjust symbol binding.
9338         (Symbol_table::sized_write_symbol): Add binding parameter.
9339         * symtab.h (Symbol::set_undef_binding): New method.
9340         (Symbol::is_undef_binding_weak): New method.
9341         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9342         (Symbol_table::should_override): Add new parameter.
9343         (Symbol_table::sized_write_symbol): Add new parameter.
9344
9345         * testsuite/weak_undef_file1.cc: Add new test case.
9346         * testsuite/weak_undef_file2.cc: Fix header comment.
9347         * testsuite/weak_undef_test.cc: Add new test case.
9348
9349 2010-06-29  Doug Kwan  <dougkwan@google.com>
9350
9351         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9352         Initialize USE_SYMBOL_.
9353         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9354         definition.
9355         (Arm_reloc_property::uses_symbol_): New data member declaration.
9356         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9357         uses symbol value and symbol is undefined but not weakly undefined.
9358
9359 2010-06-28  Rafael Espindola  <espindola@google.com>
9360
9361         * plugin.cc (Plugin::load): Use dlerror.
9362
9363 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9364
9365         * symtab.cc (detect_odr_violations): When reporting an ODR
9366         violation, report an object where the symbol is defined.
9367
9368 2010-06-25  Doug Kwan  <dougkwan@google.com>
9369
9370         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9371         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9372         definition.
9373         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9374         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9375         target hook to detect function points.
9376         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9377         * icf.h (Icf::check_section_for_function_pointers): Change type of
9378         parameter SECTION_NAME to const reference to std::string.  Use
9379         target hook to determine if section may have unsafe pointers.
9380         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9381         method definition.
9382
9383 2010-06-21  Rafael Espindola  <espindola@google.com>
9384
9385         * fileread.cc (Input_file::find_fie): New
9386         (Input_file::open): Use Input_file::find_fie.
9387         * fileread.h (Input_file::find_fie): New
9388         * plugin.cc (set_extra_library_path): New.
9389         (Plugin::load): Add set_extra_library_path to the transfer vector.
9390         (Plugin_manager::set_extra_library_path): New.
9391         (Plugin_manager::add_input_file): Use the extra search path if set.
9392         (set_extra_library_path(): New.
9393         * plugin.h (Plugin_manager): Add set_extra_library_path and
9394         extra_search_path_.
9395
9396 2010-06-19  Cary Coutant  <ccoutant@google.com>
9397
9398         * layout.cc (gdb_sections): Add .debug_types.
9399         (lines_only_debug_sections): Likewise.
9400
9401 2010-06-18  Rafael Espindola  <espindola@google.com>
9402
9403         * plugin.cc (add_input_file,add_input_library)
9404         (Plugin_manager::add_input_file): Make filename arguments const.
9405         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9406         const.
9407
9408 2010-06-16  Doug Kwan  <dougkwan@google.com>
9409
9410         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9411         .ARM.attributes section if we have not merged any input
9412         attributes sections.
9413
9414 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9415
9416         * arm.cc: Allow combining objects with no EABI version
9417         information.
9418
9419 2010-06-15  Rafael Espindola  <espindola@google.com>
9420
9421         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9422
9423 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9424
9425         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9426         (struct iovec): Correct !HAVE_READV definition.
9427
9428 2010-06-10  Cary Coutant  <ccoutant@google.com>
9429
9430         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9431         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9432         reloc sections.
9433         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9434
9435         PR 11683
9436         * symtab.h (Symbol::is_placeholder): New member function.
9437         * target-reloc.h (relocate_section): Check for placeholder symbols.
9438
9439         * testsuite/Makefile.am (plugin_test_8): New test.
9440         (plugin_test_9): New test.
9441         * testsuite/Makefile.in: Regenerate.
9442
9443 2010-06-09  Nick Clifton  <nickc@redhat.com>
9444
9445         * yyscript.y (input_list_element): Allow strings prefixed with
9446         the '-' character.  Treat these as libraries.
9447         * script.cc (script_add_library): New function.  Adds a library
9448         specified by "-l<name>" found in an input script.
9449         * script-c.h: Add prototype for script_add_library.
9450
9451 2010-06-07  Doug Kwan  <dougkwan@google.com>
9452
9453         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9454         Restrict stub-group size to be within long conditional branch
9455         range when working around cortex-A8 erratum.
9456
9457 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9458
9459         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9460         #ifdef typo.
9461
9462 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9463
9464         PR gold/11658
9465         * output.cc
9466         (Output_section::Input_section_sort_entry::compare_section_ordering):
9467         Change to return non-zero correctly.
9468         (Output_section::Input_section_sort_section_order_index_compare
9469         ::operator()): Change to fix ambiguity in comparisons.
9470
9471 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9472
9473         * gold.h (is_wildcard_string): New function.
9474         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9475         (Layout::layout_eh_frame): Ditto.
9476         (Layout::find_section_order_index): New method.
9477         (Layout::read_layout_from_file): New method.
9478         * layout.h (Layout::find_section_order_index): New method.
9479         (Layout::read_layout_from_file): New method.
9480         (Layout::input_section_position_): New private member.
9481         (Layout::input_section_glob_): New private member.
9482         * main.cc (main): Call read_layout_from_file here.
9483         * options.h (--section-ordering-file): New option.
9484         * output.cc (Output_section::input_section_order_specified_): New
9485         member.
9486         (Output_section::Output_section): Initialize new member.
9487         (Output_section::add_input_section): Add new parameter.
9488         Keep input sections when --section-ordering-file is used.
9489         (Output_section::set_final_data_size): Sort input sections when
9490         section ordering file is specified.
9491         (Output_section::Input_section_sort_entry): Add new parameter.
9492         Check sorting type.
9493         (Output_section::Input_section_sort_entry::compare_section_ordering):
9494         New method.
9495         (Output_section::Input_section_sort_compare::operator()): Change to
9496         consider section_order_index.
9497         (Output_section::Input_section_sort_init_fini_compare::operator()):
9498         Change to consider section_order_index.
9499         (Output_section::Input_section_sort_section_order_index_compare
9500         ::operator()): New method.
9501         (Output_section::sort_attached_input_sections): Change to sort
9502         according to section order when specified.
9503         (Output_section::add_input_section<32, true>): Add new parameter.
9504         (Output_section::add_input_section<64, true>): Add new parameter.
9505         (Output_section::add_input_section<32, false>): Add new parameter.
9506         (Output_section::add_input_section<64, false>): Add new parameter.
9507         * output.h (Output_section::add_input_section): Add new parameter.
9508         (Output_section::input_section_order_specified): New
9509         method.
9510         (Output_section::set_input_section_order_specified): New method.
9511         (Input_section::Input_section): Initialize section_order_index_.
9512         (Input_section::section_order_index): New method.
9513         (Input_section::set_section_order_index): New method.
9514         (Input_section::section_order_index_): New member.
9515         (Input_section::Input_section_sort_section_order_index_compare): New
9516         struct.
9517         (Output_section::input_section_order_specified_): New member.
9518         * script-sections.cc (is_wildcard_string): Delete and move modified
9519         method to gold.h.
9520         (Output_section_element_input::Output_section_element_input): Modify
9521         call to is_wildcard_string.
9522         (Output_section_element_input::Input_section_pattern
9523         ::Input_section_pattern): Ditto.
9524         (Output_section_element_input::Output_section_element_input): Ditto.
9525         * testsuite/Makefile.am (final_layout): New test case.
9526         * testsuite/Makefile.in: Regenerate.
9527         * testsuite/final_layout.cc: New file.
9528         * testsuite/final_layout.sh: New file.
9529
9530 2010-06-01  Rafael Espindola  <espindola@google.com>
9531
9532         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9533
9534 2010-06-01  Rafael Espindola  <espindola@google.com>
9535
9536         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9537         visibility of symbols.
9538
9539 2010-05-27  Doug Kwan  <dougkwan@google.com>
9540
9541         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9542         from start of output section instead of address for a local symbol
9543         in a merged or relaxed section when doing a relocatable link.
9544
9545 2010-05-26  Rafael Espindola  <espindola@google.com>
9546
9547         PR 11604
9548         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9549         adding sections the garbage collector removed.
9550         * gold/testsuite/Makefile.am: Add test.
9551         * gold/testsuite/Makefile.in: Regenerate.
9552         * gold/testsuite/plugin_test_7.sh: New.
9553         * gold/testsuite/plugin_test_7_1.c: New.
9554         * gold/testsuite/plugin_test_7_2.c: New.
9555
9556 2010-05-26  Rafael Espindola  <espindola@google.com>
9557
9558         * script-sections.cc (Output_section_definition::set_section_addresses):
9559         Check for --section-start.
9560
9561 2010-05-26  Doug Kwan  <dougkwan@google.com>
9562
9563         * arm.cc (Arm_scan_relocatable_relocs): New class.
9564         (Target_arm::relocate_special_relocatable): New method.
9565         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9566         (Arm_relocate_functions::thumb_branch_common): Same.
9567         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9568         instead of Default_scan_relocatable_relocs.
9569         * target-reloc.h (relocate_for_relocatable): Let target handle
9570         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9571         * target.h (Sized_target::relocate_special_relocatable): New method.
9572
9573 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9574
9575         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9576
9577 2010-05-23  Doug Kwan  <dougkwan@google.com>
9578
9579         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9580         instead of a cast.
9581         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9582         with a direct branch, not a conditional branch, to a stub.
9583         * merge.cc (Output_merge_base::record_input_section): New method
9584         defintion.
9585         (Output_merge_data::do_add_input_section): Record input section if
9586         keeps-input-sections flag is set.
9587         (Output_merge_string::do_add_input_section): Ditto.
9588         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9589         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9590         INPUT_SECTIONS_.
9591         (Output_merge_base::keeps_input_sections,
9592         Output_merge_base::set_keeps_input_sections,
9593         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9594         method definitions.
9595         (Output_merge_base::Input_sections): New type declaration.
9596         (Output_merge_base::input_sections_begin,
9597         Output_merge_base::input_sections_end,
9598         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9599         (Output_merge_base::bool keeps_input_sections_,
9600         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9601         Output_merge_base::input_sections_): New data members.
9602         (Output_merge_data::do_set_keeps_input_sections): New method
9603         defintion.
9604         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9605         * output.cc (Output_section::Input_section::relobj): Move method
9606         defintion from class declaration to here and handle merge sections.
9607         (Output_section::Input_section::shndx): Ditto.
9608         (Output_section::Output_section): Remove initializations of removed
9609         data members and initialize new data member LOOKUP_MAPS_.
9610         (Output_section::add_input_section): Set keeps-input-sections flag
9611         for a newly created merge output section as appropriate.  Adjust code
9612         to use Output_section_lookup_maps class.
9613         (Output_section::add_relaxed_input_section): Adjst code for lookup
9614         maps code refactoring.
9615         (Output_section::add_merge_input_section): Add a new parameter
9616         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9617         class.  If adding input section to a newly created merge output
9618         section fails, remove the new merge section.
9619         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9620         Adjust code for use of the Output_section_lookup_maps class.
9621         (Output_section::find_merge_section): Ditto.
9622         (Output_section::build_lookup_maps): New method defintion.
9623         (Output_section::find_relaxed_input_section): Adjust code to use
9624         Output_section_lookup_maps class.
9625         (Output_section::get_input_sections): Export merge sections.  Adjust
9626         code to use Output_section_lookup_maps class.
9627         (Output_section:::add_script_input_section): Adjust code to use
9628         Output_section_lookup_maps class.  Update lookup maps for merge
9629         sections also.
9630         (Output_section::discard_states): Use Output_section_lookup_maps.
9631         (Output_section::restore_states): Same.
9632         * output.h (Merge_section_properties): Move class defintion out of
9633         Output_section.
9634         (Output_section_lookup_maps): New class.
9635         (Output_section::Input_section::is_merge_section): New method
9636         defintion.
9637         (Output_section::Input_section::relobj): Move defintion out of class
9638         defintion.  Declare method only.
9639         (Output_section::Input_section::shndx): Ditto.
9640         (Output_section::Input_section::output_merge_base): New method defintion.
9641         (Output_section::Input_section::u2_.pomb): New union field.
9642         (Output_section::Merge_section_by_properties_map,
9643         Output_section::Output_section_data_by_input_section_map,
9644         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9645         Remove types.
9646         (Output_section::add_merge_input_section): Add new parameter
9647         KEEPS_INPUT_SECTIONS.
9648         (Output_section::build_lookup_maps): New method declaration.
9649         (Output_section::merge_section_map_,
9650         Output_section::merge_section_by_properties_map_,
9651         Output_section::relaxed_input_section_map_,
9652         Output_section::is_relaxed_input_section_map_valid_): Remove data
9653         members.
9654         (Output_section::lookup_maps_): New data member.
9655
9656 2010-05-21  Doug Kwan  <dougkwan@google.com>
9657
9658         PR gold/11619
9659         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9660         avoid a compilation error.
9661
9662 2010-05-19  Rafael Espindola  <espindola@google.com>
9663
9664         * script-sections.cc (Output_section_definition::allocate_to_segment):
9665         Update the phdrs_list even when the output section is NULL.
9666         * testsuite/Makefile.am: Add test.
9667         * testsuite/Makefile.in: Regenerate.
9668         * testsuite/script_test_9.cc: New.
9669         * testsuite/script_test_9.sh: New.
9670         * testsuite/script_test_9.t: New.
9671
9672 2010-05-19  Doug Kwan  <dougkwan@google.com>
9673
9674         * arm.cc (Arm_input_section::original_size): New method.
9675         (Arm_input_section::do_addralign): Add a cast.
9676         (Arm_input_section::do_output_offset): Remove static cast.
9677         (Arm_input_section::original_addralign,
9678          Arm_input_section::original_size_): Change type to uint32_t.
9679         (Arm_input_section::init): Add safe casts for section alignment
9680         and size.
9681         (Arm_input_section::set_final_data_size): Do not set address and
9682         offset of stub table.
9683         (Arm_output_section::fix_exidx_coverage): Change use of of
9684         Output_section::Simple_input_section to that of
9685         Output_section::Input_section.
9686         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9687         except for the first pass.
9688         * output.cc (Output_section::get_input_sections): Change type of
9689         input_sections to std::list<Input_section>.
9690         (Output_section::add_script_input_section): Rename from
9691         Output_section::add_simple_input_section.  Change type of SIS
9692         parameter from Simple_input_section to Input_section.
9693         * output.h (Output_section::Simple_input_section): Remove class.
9694         (Output_section::Input_section): Change class visibility to public.
9695         (Output_section::Input_section::addralign): Use stored alignments
9696         for special input sections if set.
9697         (Output_section::Input_section::set_addralign): New method.
9698         (Output_section::get_input_sections): Change parameter type from
9699         list of Simple_input_section to list of Input_section.
9700         (Output_section::add_script_input_section): Rename from
9701         Output_section::add_simple_input_section. Change first parameter's
9702         type from Simple_input_section to Input_section and remove the
9703         second and third parameters.
9704         * script-sections.cc (Input_section::Input_section_list): Change
9705         type to list of Output_section::Input_section/
9706         (Input_section_info::Input_section_info): Change parameter type of
9707         INPUT_SECTION to Output_section::Input_section.
9708         (Input_section_info::input_section): Change return type.
9709         (Input_section_info::input_section_): Change type to
9710         Output_section::Input_section.
9711         (Output_section_element_input::set_section_addresses): Adjust code
9712         to use Output_section::Input_section instead of
9713         Output_section::Simple_input_section.  Adjust code for renaming
9714         of Output_section::add_simple_input_section.
9715         (Orphan_output_section::set_section_addresses): Ditto.
9716
9717 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9718
9719         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9720         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9721
9722 2010-05-18  Rafael Espindola  <espindola@google.com>
9723
9724         * options.cc (General_options::finalize): Handle -nostdlib.
9725         * options.h (nostdlib): New option.
9726         * script.cc (script_add_search_dir): Handle -nostdlib.
9727
9728 2010-05-12  Doug Kwan  <dougkwan@google.com>
9729
9730         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9731         attributes section only if there no attributes section after merging.
9732         (Target_arm::merge_object_attributes): Move value of
9733         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9734         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9735         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9736         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9737         and arm_attr_merge_7.stdout.
9738         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9739         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9740         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9741         arm_attr_merge_7b.o): New rules.
9742         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9743         arm_attr_merge_7
9744         * testsuite/Makefile.in: Regenerate.
9745         * testsuite/arm_attr_merge.sh: New file.
9746         * testsuite/arm_attr_merge_[67][ab].s: Same.
9747
9748 2010-05-05  Nick Clifton  <nickc@redhat.com>
9749
9750         * po/es.po: Updated Spanish translation.
9751
9752 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9753
9754         * Makefile.am (install-exec-local): Properly install gold as
9755         default cross linker.
9756         * Makefile.in: Regenerated.
9757
9758 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9759             Nick Clifton  <nickc@redhat.com>
9760
9761         * configure.ac (install_as_default): Define and set to false
9762         unless --enable-gold or --enable-gold=both/gold has been
9763         specified.
9764         * configure: Regenerate.
9765
9766         * Makefile.am (install-exec-local): Install the executable as
9767         'ld.gold'.  If install_as_default is true then also install it as
9768         'ld'.
9769         * Makefile.in: Regenerated.
9770
9771 2010-04-24  Ian Lance Taylor  <iant@google.com>
9772
9773         * layout.cc (Layout::layout_reloc): In relocatable link don't
9774         combine reloc sections for grouped sections.
9775
9776 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9777
9778         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9779         sections that are not ordinary to icf.
9780         * icf.cc (get_section_contents): Handle relocation pointing to section
9781         with no object or shndx information.
9782         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9783         * testsuite/Makefile.in: Regenerate.
9784         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9785         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9786
9787 2010-04-22  Ian Lance Taylor  <iant@google.com>
9788
9789         * expression.cc (Expression::Expression_eval_info): Add
9790         result_alignment_pointer field.
9791         (Expression::eval_with_dot): Add result_alignment_pointer
9792         parameter.  Change all callers.
9793         (Expression::eval_maybe_dot): Likewise.
9794         (class Binary_expression): Add alignment_pointer parameter to
9795         left_value and right_value.  Change all callers.
9796         (BINARY_EXPRESSION): Set result alignment.
9797         (class Trinary_expression): Add alignment_pointer parameter to
9798         arg2_value and arg3_value.  Change all callers.
9799         (Trinary_cond::value): Set result alignment.
9800         (Max_expression::value, Min_expression::value): Likewise.
9801         (Align_expression::value): Likewise.
9802         * script-sections.cc (class Sections_element): Add dot_alignment
9803         parameter to set_section_addresses virtual function.  Update
9804         instantiations.
9805         (class Output_section_element): Likewise.
9806         (Script_sections::create_segments): Add dot_alignment parameter.
9807         Change all callers.
9808         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9809         (Script_sections::set_phdrs_clause_addresses): Likewise.
9810         * script-sections.h: Update declarations.
9811         * script.h: Update declarations.
9812         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9813         min_p_align.
9814         * testsuite/script_test_3.t: Set large alignment.
9815         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9816         segment has expected alignment.
9817
9818 2010-04-22  Nick Clifton  <nickc@redhat.com>
9819
9820         * po/gold.pot: Updated by the Translation project.
9821         * po/vi.po: Updated Vietnamese translation.
9822
9823 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9824
9825         * testsuite/Makefile.am (check_PROGRAMS): Add
9826         icf_virtual_function_folding_test.
9827         * testsuite/Makefile.in: Regenerated.
9828
9829 2010-04-15  Andrew Haley  <aph@redhat.com>
9830
9831         * options.h (merge_exidx_entries): New option.
9832         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9833         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9834         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9835         (Target_arm::merge_exidx_entries): New function.
9836         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9837         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9838         to Arm_exidx_fixup constructor.
9839         Add new arg, merge_exidx_entries.
9840         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9841         Arm_output_section::fix_exidx_coverage.
9842
9843 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9844
9845         * icf.cc (get_section_contents): Check for preemptible functions.
9846         Ignore addend when appropriate.
9847         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9848         section folded.
9849         (add_from_relobj): Check for section folded.
9850         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9851         * symtab.h (should_add_dynsym_entry): Add new parameter.
9852         * target-reloc.h (scan_relocs): Check for section folded.
9853         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9854         Check reloc types for function pointers in shared objects.
9855         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9856         case.
9857         (icf_preemptible_functions_test): New test case.
9858         (icf_string_merge_test): New test case.
9859         * testsuite.Makefile.in: Regenerate.
9860         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9861         bar_glob.  Refactor code.
9862         * testsuite/icf_preemptible_functions_test.cc: New file.
9863         * testsuite/icf_preemptible_functions_test.sh: New file.
9864         * testsuite/icf_string_merge_test.cc: New file.
9865         * testsuite/icf_string_merge_test.sh: New file.
9866         * testsuite/icf_virtual_function_folding_test.cc: New file.
9867         * testsuite/icf_virtual_function_folding_test.sh: New file.
9868
9869 2010-04-14  Doug Kwan  <dougkwan@google.com>
9870
9871         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9872         for local symbol recounting if we remove a section due to ICF.
9873         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9874         there are no regular objects in input.
9875
9876 2010-04-13  Doug Kwan  <dougkwan@google.com>
9877
9878         * arm.cc (Arm_input_section::set_final_data_size): Compute
9879         accurate final data size instead of using current data size.
9880
9881 2010-04-09  Doug Kwan  <dougkwan@google.com>
9882
9883         * layout.cc (Layout::choose_output_section): Handle script section
9884         types.
9885         (Layout::make_output_section_for_script): Add section type parameter.
9886         Handle script section types.
9887         * layout.h (Layout::make_output_section_for_script): Add section
9888         type parameter.
9889         * output.cc (Output_section::Output_section): Initialize data member
9890         is_noload_.
9891         (Output_section::do_reset_address_and_file_offset): Do not set address
9892         to 0 if section is a NOLOAD section.
9893         * output.h (Output_section::is_noload): New method.
9894         (Output_section::set_is_noload): Ditto.
9895         (Output_section::is_noload_): New data member.
9896         * script-c.h (Script_section_type): New enum type.
9897         (struct Parser_output_section_header): Add new file section_type.
9898         * script-sections.cc (Sections_element::output_section_name): Add
9899         parameter for returning script section type.
9900         (Output_section_definition::output_section_name): Ditto.
9901         (Output_section_definition::section_type)P; New method.
9902         (Output_section_definiton::script_section_type_name): Ditto.
9903         (Output_section_definition::script_section_type_): New data member.
9904         (Output_section_definition::Output_section_definition): Initialize
9905         data member Output_section_definition::script_section_type_.
9906         (Output_section_definition::create_sections): Pass script section type
9907         to Layout::make_output_section_for_script.
9908         (Output_section_definition::output_section_name): Return script
9909         section type to caller.
9910         (Output_section_definition::set_section_address): Do not advance
9911         dot value and load address if section type is NOLOAD.  Set address
9912         of NOLOAD sections regardless of section flags.
9913         (Output_section_definition::print): Print section type if it is
9914         not SCRIPT_SECTION_TYPE_NONE.
9915         (Output_section_definition::section_type): New method.
9916         (Output_section_definition::script_section_type_name): Ditto.
9917         (Script_sections::output_section_name): Add new parameter
9918         PSECTION_TYPE for returning script section type.  Pass it to
9919         section elements.  Handle discard sections.
9920         (Sort_output_sections::operator()): Handle NOLOAD sections.
9921         * script-sections.h (Script_sections::Section_type): New enum type.
9922         (Script_sections::output_section_name): Add a new parameter for
9923         returning script section type.
9924         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9925         INFO and NOLOAD.
9926         * yyscript.y (union): Add new field SECTION_TYPE.
9927         (COPY, DSECT, INFO, NOLOAD): New tokens.
9928         (opt_address_and_section_type): Change type to output_section_header.
9929         (section_type): New non-terminal
9930         (section_header): Handle section type.
9931         (opt_address_and_section_type): Return section type value.
9932
9933 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
9934
9935         * testsuite/plugin_common_test_1.c (foo): Add prototype.
9936         * testsuite/plugin_common_test_2.c (foo): Likewise.
9937
9938 2010-04-08  Doug Kwan  <dougkwan@google.com>
9939
9940         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9941         Output_merge_data.
9942         * output.cc (Output_section::add_merge_input_section): Simplify
9943         code and return status of Output_merge_base::add_input_section.
9944         Update merge section map only if Output_merge_base::add_input_section
9945         returns true.
9946
9947 2010-04-07  Doug Kwan  <dougkwan@google.com>
9948
9949         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9950         if section is marked as containing instructions but has no mapping
9951         symbols.
9952         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9953         correct section index.
9954         (Arm_relobj::find_linked_text_section): Ditto.
9955
9956 2010-04-07  Cary Coutant  <ccoutant@google.com>
9957
9958         * archive.cc (include_member): Destroy Read_symbols_data object before
9959         releasing file.
9960         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9961         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9962         (Read_symbols_data::~Read_symbols_data) New destructor.
9963         (Section_relocs::Section_relocs) New constructor.
9964         (Section_relocs::~Section_relocs) New destructor.
9965         (Read_relocs_data::Read_relocs_data) New constructor.
9966         (Read_relocs_data::~Read_relocs_data) New destructor.
9967         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9968         pointers to NULL after deleting.
9969
9970 2010-04-07  Doug Kwan  <dougkwan@google.com>
9971
9972         * arm.cc: Replace "endianity" with "endianness" in comments.
9973         (Arm_exidx_cantunwind): Ditto.
9974         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9975         (Arm_relobj::merge_flags_and_attributes): New method.
9976         (Arm_relobj::merge_flags_and_attributes_): New data member.
9977         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9978         (Arm_relobj::scan_sections_for_stubs): Ditto.
9979         (Arm_relobj::do_read_symbols): Check to see if we really want to
9980         merge processor-specific flags and attributes.  Exit early if
9981         an object is empty except for section names and the undefined symbol.
9982         (Target_arm::do_finalize_sections): Move check for ELF format to
9983         Arm_relobj::do_read_symbols.  Merge processor specific flags and
9984         attributes from a regular object only when we have determined that
9985         it is aapropriate.  Do not create an .ARM.attributes section in
9986         output if there is no regular input object.
9987         (Target_arm::merge_processor_specific_flags): Check
9988         --warn-mismatch before printing any error.
9989         (Target_arm::merge_object_attributes): Ditto.
9990         * gold.cc (queue_middle_tasks): Handle the case in which there is
9991         no regular object in input.
9992         * options.cc (General_options::parse_EB): New method.
9993         (General_options::parse_EL): Same.
9994         (General_options::General_options): Initialize endianness_.
9995         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9996         New options.
9997         (General_options::Endianness): New enum.
9998         (General_options::endianness): New method.
9999         (General_options::endianness_): New data member.
10000         * parameters.cc (Parameters::set_options): Check target endianness.
10001         (Parameters::set_target_once): Ditto.
10002         (Parameters::check_target_endianness): New method.
10003         (parameters_force_valid_target): If either -EL or -EB is specified,
10004         use it to define endianness of default target.
10005         * parameters.h (Parameters::check_target_endianness): New method
10006         declaration.
10007         * target.h (class Target): Change "endianity" to "endianness"
10008         in comments.
10009
10010 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10011
10012         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10013         * configure: Regenerate.
10014         * Makefile.in: Regenerate.
10015         * testsuite/Makefile.in: Regenerate.
10016
10017 2010-04-06  Cary Coutant  <ccoutant@google.com>
10018
10019         gcc PR lto/42757
10020         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10021         prevailing definitions of common symbols.
10022         * testsuite/plugin_test_6.sh: New test case.
10023         * testsuite/plugin_common_test_1.c: New test case.
10024         * testsuite/plugin_common_test_2.c: New test case.
10025         * testsuite/Makefile.am (plugin_test_6): New test case.
10026         * testsuite/Makefile.in: Regenerate.
10027
10028 2010-04-06  Nick Clifton  <nickc@redhat.com>
10029
10030         * po/vi.po: New Vietnamese translation.
10031
10032 2010-03-30  Doug Kwan  <dougkwan@google.com>
10033
10034         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10035
10036 2010-03-25  Doug Kwan  <dougkwan@google.com>
10037
10038         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10039         to avoid a conversion warning on a 32-bit host.
10040
10041 2010-03-24  Ian Lance Taylor  <iant@google.com>
10042
10043         * testsuite/script_test_3.t: Add a TLS segment.
10044         * testsuite/Makefile.am (check_PROGRAMS): Add
10045         tls_phdrs_script_test.
10046         (tls_phdrs_script_test_SOURCES): Define.
10047         (tls_phdrs_script_test_DEPENDENCIES): Define.
10048         (tls_phdrs_script_test_LDFLAGS): Define.
10049         (tls_phdrs_script_test_LDADD): Define.
10050         * testsuite/Makefile.in: Rebuild.
10051
10052 2010-03-23  Cary Coutant  <ccoutant@google.com>
10053
10054         * fileread.cc (find_or_make_view): Fix comment.
10055
10056 2010-03-23  Ian Lance Taylor  <iant@google.com>
10057
10058         * script-sections.cc (class Orphan_section_placement): Define
10059         PLACE_TLS and PLACE_TLS_BSS.
10060         (Orphan_section_placement::Orphan_section_placement): Initialize
10061         new places.
10062         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10063         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10064         (tls_script_test_SOURCES): Define.
10065         (tls_script_test_DEPENDENCIES): Define.
10066         (tls_script_test_LDFLAGS): Define.
10067         (tls_script_test_LDADD): Define.
10068         * testsuite/Makefile.in: Rebuild.
10069
10070 2010-03-22  Doug Kwan  <dougkwan@google.com>
10071
10072         * arm.cc (Arm_relocate_functions::abs8,
10073         Arm_relocate_functions::abs16): Use correct check for overflow
10074         specified in the ARM ELF specs.
10075         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10076         target of a BLX instruction specially.
10077         (Reloc_stub::stub_type_for_reloc): Ditto.
10078         (Relocate::relocate): Use symbolic names instead of numeric relocation
10079         codes to report error.
10080         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10081         workaround.
10082         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10083         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10084         thumb2_blx_out_of_range.stdout
10085         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10086         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10087         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10088         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10089         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10090         thumb2_blx_in_range, thumb2_blx_in_range.o,
10091         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10092         thumb2_blx_out_of_range.o): New rules.
10093         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10094         thumb2_blx_in_range and thumb2_blx_out_of_range.
10095         * testsuite/Makefile.in: Regenerate.
10096         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10097         * testsuite/thumb_blx_in_range.s: New file.
10098         * testsuite/thumb_blx_out_of_range.s: New file.
10099
10100 2010-03-22  Rafael Espindola  <espindola@google.com>
10101
10102         * archive.cc (Should_include): Move to archive.h.
10103         (should_include_member): Make it a member of Archive.
10104         (Lib_group): New.
10105         (Add_lib_group_symbols): New.
10106         * archive.h: Include options.h.
10107         (Archive_member): Moved from Archive.
10108         (Should_include): Moved from archive.cc.
10109         (Lib_group): New.
10110         (Add_lib_group_symbols): New.
10111         * dynobj.cc (do_should_include_member): New.
10112         * dynobj.h (do_should_include_member): New.
10113         * gold.cc (queue_initial_tasks): Update call to queue.
10114         * main.cc (main): Print lib group stats.
10115         * object.cc (do_should_include_member): New.
10116         * object.h: Include archive.h.
10117         (Object::should_include_member): New.
10118         (Object::do_should_include_member): New.
10119         (Sized_relobj::do_should_include_member): New.
10120         * options.cc (General_options::parse_start_lib): New.
10121         (General_options::parse_end_lib): New.
10122         (Input_arguments::add_file): Handle lib groups.
10123         (Input_arguments::start_group): Check we are not in a lib.
10124         (Input_arguments::start_lib): New.
10125         (Input_arguments::end_lib): New.
10126         * options.h (General_options): Add start_lib and end_lib.
10127         (Input_argument::lib_): New.
10128         (Input_argument::lib): New.
10129         (Input_argument::is_lib): New.
10130         (Input_file_lib): New.
10131         (Input_arguments::in_lib_): New.
10132         (Input_arguments::in_lib): New.
10133         (Input_arguments::start_lib): New.
10134         (Input_arguments::end_lib_): New.
10135         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10136         in unused members as preempted.
10137         (Sized_pluginobj::do_should_include_member): New.
10138         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10139         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10140         return the blocker.
10141         (Read_symbols::do_whole_lib_group): New.
10142         (Read_symbols::do_lib_group): New.
10143         (Read_symbols::do_read_symbols): Handle lib groups.
10144         (Read_symbols::get_name): Handle lib groups.
10145         * readsyms.h (Read_symbols): Add an archive member pointer.
10146         (Read_symbols::do_whole_lib_group): New.
10147         (Read_symbols::do_lib_group): New.
10148         (Read_symbols::member_): New.
10149         * script.cc (read_input_script): Update call to queue_soon.
10150
10151 2010-03-19  Doug Kwan  <dougkwan@google.com>
10152
10153         * arm.cc (Stub_table::Stub_table): Initialize new data members
10154         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10155         (Stub_table::add_reloc_stub): Assign stub offset and update
10156         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10157         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10158         New data members.
10159         (Stub_table::update_data_size_and_addralign): Use
10160         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10161         instead of going over all reloc stubs.
10162         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10163         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10164         Stringpool_template::offset_ to size of Stringpool_char.
10165         (Stringpool_template::new_key_offset): Remove code to initialize
10166         Stringpool_template::offset_.
10167         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10168         Stringpool_template::offset_ to zero.
10169
10170 2010-03-15  Doug Kwan  <dougkwan@google.com>
10171
10172         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10173         offset_.
10174         (Stringpool_template::new_key_offset): New method.
10175         (Stringpool_template::add_string): Assign offsets when adding new
10176         strings.
10177         (Stringpool_template::set_string_offsets): Do not set string offsets
10178         when not optimizing.
10179         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10180         member size_.
10181         (Chunked_vector::clear): Clear size_.
10182         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10183         (Chunked_vector::size): Return size_.
10184         (Chunked_vector::push_back): Use size_ to find insert position.
10185         (Chunked_vector::size_): New data member.
10186         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10187         (Stringpool_template::new_key_offset): New method declaration.
10188         (Stringpool_template::offset_): New data member.
10189
10190 2010-03-15   Rafael Espindola  <espindola@google.com>
10191
10192         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10193         Add_symbols' constructor.
10194         * readsyms.h (Add_symbols): Remove the input_group member.
10195
10196 2010-03-10  Ian Lance Taylor  <iant@google.com>
10197
10198         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10199         target to ask whether a reference to a symbol requires a stack
10200         split.
10201         * target.h (Target::is_call_to_non_split): New function.
10202         (Target::do_is_call_to_non_split): Declare virtual function.
10203         * target.cc: Include "symtab.h".
10204         (Target::do_is_call_to_non_split): New function.
10205         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10206
10207 2010-03-10  Cary Coutant  <ccoutant@google.com>
10208
10209         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10210         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10211         (File_read::open[2]): Add whole_file_view_ to list of views.
10212         (File_read::make_view): Remove test of whole_file_view_.
10213         (File_read::find_or_make_view): Create whole_file_view_ if
10214         necessary.
10215         (File_read::clear_views): Replace bool parameter with enum;
10216         adjust all callers.  Don't delete views with permanent data;
10217         do delete cached views and views from archives if
10218         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10219         if clearing the corresponding view.
10220         * fileread.h (File_read::Clear_views_mode): New enum.
10221         (File_read::View::is_permanent_view): New method.
10222         (File_read::clear_views): Replace bool parameter
10223         with enum; adjust all callers.
10224         * options.h (General_options): Change keep_files_mapped option;
10225         add map_whole_files.
10226         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10227         releasing the file.
10228         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10229         the file.
10230
10231 2010-03-10  David S. Miller  <davem@davemloft.net>
10232
10233         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10234
10235 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10236
10237         * icf.cc (get_section_contents): Add '@' marker after processing the
10238         merge reloc.
10239
10240 2010-03-08  Doug Kwan  <dougkwan@google.com>
10241
10242         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10243         due to a conversion warning.
10244         (Arm_relobj::update_output_local_symbol_count): Check for local
10245         symbol with unset output index.
10246
10247 2010-03-05  Ian Lance Taylor  <iant@google.com>
10248
10249         * options.h (class General_options): Add --spare-dynamic-tags.
10250         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10251         --spare-dynamic-tags.
10252
10253 2010-03-05  Ian Lance Taylor  <iant@google.com>
10254
10255         * incremental.cc: Include "libiberty.h".
10256
10257 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10258
10259         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10260         function, is_info_ member.
10261         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10262         (Versions::Versions): Update caller.
10263         (Versions::define_base_version): Likewise.
10264         (Versions::add_def): Likewise.
10265
10266 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10267
10268         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10269         (Scan::possible_function_pointer_reloc): New function.
10270         (Scan::local_reloc_may_be_function_pointer): Change to call
10271         possible_function_pointer_reloc.
10272         (Scan::global_reloc_may_be_function_pointer): Ditto.
10273         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10274         relocations in ".data.rel.ro._ZTV" section.
10275         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10276         * testsuite/icf_safe_so_test.cc: Ditto.
10277         * testsuite/icf_safe_test.cc: Ditto.
10278         * testsuite/icf_safe_test.sh: Ditto.
10279
10280 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10281             Ian Lance Taylor  <iant@google.com>
10282
10283         * target-reloc.h (relocate_section): Check the symbol table index
10284         for -1U before setting the local symbol index.
10285         (scan_relocatable_relocs): If copying the relocation, record that
10286         the local symbol is required.
10287         * object.h (Symbol_value::is_output_symtab_index_set): New
10288         function.
10289         (Symbol_value::may_be_discarded_from_output_symtab): New
10290         function.
10291         (Symbol_value::has_output_symtab_entry): New function.
10292         (Symbol_value::needs_output_symtab_entry): Remove.
10293         (Symbol_value::output_symtab_index): Make sure the symbol index is
10294         set.
10295         (Symbol_value::set_output_symtab_index): Make sure the symbol
10296         index is not set.  Make sure the new index is valid.
10297         (Symbol_value::set_must_have_output_symtab_entry): New function.
10298         (Symbol_value::has_output_dynsym_entry): New function.
10299         (Symbol_value::set_output_dynsym_index): Make sure the new index
10300         is valid.
10301         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10302         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10303         local symbol if permitted.
10304         (Sized_relobj::do_finalize_local_symbols): Call
10305         is_output_symtab_index_set rather than needs_output_symtab_entry.
10306         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10307         rather than needs_output_symtab_entry.  Call
10308         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10309         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10310         is_output_symtab_index_set rather than needs_output_symtab_entry.
10311         * testsuite/discard_locals_relocatable_test.c: New file.
10312         * testsuite/discard_locals_test.sh: Test -r.
10313         * testsuite/Makefile.am (check_DATA): Add
10314         discard_locals_relocatable_test1.syms,
10315         discard_local_relocatable_test2.syms.
10316         (MOSTLYCLEANFILES): Likewise.  Also add
10317         discard_locals_relocatable_test1.lout and
10318         discard_locals_relocatable_test2.out.
10319         (discard_locals_relocatable_test1.syms): New target.
10320         (discard_locals_relocatable_test.o): New target.
10321         (discard_locals_relocatable_test1.out): New target.
10322         (discard_locals_relocatable_test2.syms): New target.
10323         (discard_locals_relocatable_test2.out): New target.
10324         (various): Add missing ../ld-new dependencies.
10325         * testsuite/Makefile.in: Rebuild.
10326
10327 2010-03-03  Nick Clifton  <nickc@redhat.com>
10328
10329         * po/fi.po: New Finnish translation.
10330
10331 2010-03-01  Doug Kwan  <dougkwan@google.com>
10332
10333         * layout.cc (Layout::Layout): Force section types of .init_array*,
10334         .preinit_array* and .fini_array* sections.
10335         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10336         Fix check of return value of std::string::find.().
10337         (Output_section::Input_section_sort_compare::operator()): Remove
10338         comment about .init_array.
10339         (Output_section::Input_section_sort_init_fini_compare::operator()):
10340         New method.
10341         (Output_section::sort_attached_input_sections): Handle .init_array
10342         and .fini_array specially.
10343         * output.h (Output_section::Inut_section_sort_compare): Update
10344         comment.
10345         (Output_section::Input_section_sort_init_fini_compare): New struct.
10346
10347 2010-02-26  Doug Kwan  <dougkwan@google.com>
10348
10349         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10350         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10351         * testsuite/debug_msg.sh: Avoid matching source line number for
10352         use of global variable undef_int.
10353
10354 2010-02-26  Doug Kwan  <dougkwan@google.com>
10355
10356         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10357         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10358         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10359         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10360         * options.cc (General_options::General_options): Initialize member
10361         fix_v4bx_.
10362         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10363         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10364         and rm_no_fix_v4bx.stdout
10365         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10366         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10367         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10368         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10369         and arm_no_fix_v4bx.
10370         * Makefile.in: Regenerate.
10371         * testsuite/arm_fix_v4bx.s: New file.
10372         * testsuite/arm_fix_v4bx.sh: Ditto.
10373
10374 2010-02-24  Doug Kwan  <dougkwan@google.com>
10375
10376         * arm.cc (Target_arm::got_section): Make the .got section the first
10377         non RELRO section in the data segment.
10378         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10379         suffixes of section names.
10380
10381 2010-02-24  Doug Kwan  <dougkwan@google.com>
10382
10383         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10384         flags and attributes merging if an input file is a binary file.
10385         * fileread.cc (Input_file::open): Record format of original file.
10386         * fileread.h (Input_file::Format): New enum type.
10387         (Input_file::Input_file): Initialize data member format_.
10388         (Input_file::format): New method definition.
10389         (Input_file::format_):: New data member.
10390
10391 2010-02-24  Doug Kwan  <dougkwan@google.com>
10392
10393         * arm.cc (Arm_output_data_got): New class.
10394         (ARM_TCB_SIZE): New constant
10395         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10396         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10397         If user uses a script with a SECTIONS clause, issue only a warning
10398         for a misplaced EXIDX input section.  Otherwise, issue an error.
10399         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10400         garbage collection.
10401         (Target_arm::got_mode_index_entry): Handle static linking.
10402         (Target_arm::Scan::local): Ditto.
10403         (Target_arm::Scan::global): Ditto.
10404         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10405         all incorrectly implemented relocations.
10406         (Target_arm::fix_exidx_coverage): Pass layout to
10407         Arm_output_section::fix_exidx_coverage.
10408         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10409         from ".ARM.exidx." and ".ARM.extab.".
10410
10411 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10412
10413         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10414         section if it does not already exist.
10415         * attributes.cc (Attributes_section_data::Attributes_section_data):
10416         Don't crash if size is zero.
10417
10418 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10419             Ian Lance Taylor  <iant@google.com>
10420
10421         * gold.cc (queue_middle_tasks): If no input files were opened,
10422         exit.
10423         * workqueue.h (Task_function::Task_function): Assert that there is
10424         a blocker.
10425
10426 2010-02-22  Doug Kwan  <dougkwan@google.com>
10427
10428         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10429         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10430         types to avoid warnings due to different uint64_t implementations
10431         on different hosts.
10432
10433 2010-02-21  Doug Kwan  <dougkwan@google.com>
10434
10435         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10436         handling of the maximum backward branch offset.
10437         (Arm_relocate_functions::thumb_branch_common): Ditto.
10438         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10439         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10440         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10441         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10442         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10443         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10444         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10445         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10446         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10447         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10448         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10449         thumb2_bl_out_of_range.o): New rules.
10450         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10451         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10452         thumb2_bl_out_of_range
10453         * testsuite/Makefile.in: Regenerate.
10454         * testsuite/arm_bl_in_range.s: New file.
10455         * testsuite/arm_bl_out_of_range.s: Ditto.
10456         * testsuite/arm_branch_in_range.sh: Ditto.
10457         * testsuite/arm_branch_range.t: Ditto.
10458         * testsuite/thumb2_branch_range.t: Ditto.
10459         * testsuite/thumb_bl_in_range.s: Ditto.
10460         * testsuite/thumb_bl_out_of_range.s: Ditto.
10461         * testsuite/thumb_branch_range.t: Ditto.
10462
10463 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10464
10465         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10466         Add reloc offset information.
10467         * icf.cc (get_section_contents): Change iterators to point to the new
10468         vectors. Add reloc offset information to the contents.
10469         * icf.h (Icf::Sections_reachable_info): New typedef.
10470         (Icf::Sections_reachable_list): New typedef.
10471         (Icf::Offset_info): New typedef.
10472         (Icf::Reloc_info): New struct typedef.
10473         (Icf::Reloc_info_list): New typedef.
10474         (Icf::symbol_reloc_list): Delete method.
10475         (Icf::addend_reloc_list): Delete method.
10476         (Icf::section_reloc_list): Delete method.
10477         (Icf::reloc_info_list): New method.
10478         (Icf::reloc_info_list_): New member.
10479
10480 2010-02-19  Doug Kwan  <dougkwan@google.com>
10481
10482         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10483         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10484         * arm.cc (Arm_relocation_functions): New forward declaration.
10485         (Target_arm::Target_arm): Initialize new data members
10486         got_mod_index_offset_ and tls_base_symbol_defined_.
10487         (Target_arm::Relocate::relocate_tls): New method.
10488         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10489          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10490         New methods.
10491         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10492         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10493         (Target_arm::got_mod_index_offset_,
10494         Target_arm::tls_base_symbol_defined_): New data members.
10495         (Target_arm::Scan::local, Target::Scan::global,
10496         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10497         relocations.
10498
10499 2010-02-18  Doug Kwan  <dougkwan@google.com>
10500
10501         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10502         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10503         text section as a parameter becuase some broken tools may not set
10504         the link in section header.
10505         (Target_arm::has_got_section): New method.
10506         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10507         without any mapping symbol as data only.  Remove warning.
10508         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10509         link in its section header, try to discover the link by inspecting the
10510         REL31 relocation at the beginning of the section.
10511         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10512         in error message.
10513         (Target_arm::Scan::global): Treat any reference to the symbol
10514         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10515
10516 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10517
10518         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10519         (Scan::global_reloc_may_be_function_pointer): New function.
10520         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10521         (Scan::global_reloc_may_be_function_pointer): New function.
10522         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10523         (Scan::global_reloc_may_be_function_pointer): New function.
10524         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10525         (Scan::global_reloc_may_be_function_pointer): New function.
10526         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10527         (Scan::global_reloc_may_be_function_pointer): New function.
10528         (Scan::possible_function_pointer_reloc): New function.
10529         (Target_x86_64::can_check_for_function_pointers): New function.
10530         * gc.h (gc_process_relocs): Scan relocation types to determine if
10531         function pointers were taken for targets that support it.
10532         * icf.cc (Icf::find_identical_sections): Include functions for
10533         folding in safe ICF whose pointer is not taken.
10534         * icf.h (Secn_fptr_taken_set): New typedef.
10535         (fptr_section_id_): New member.
10536         (section_has_function_pointers): New function.
10537         (set_section_has_function_pointers): New function.
10538         (check_section_for_function_pointers): New function.
10539         * options.h: Fix comment for safe ICF option.
10540         * target.h (can_check_for_function_pointers): New function.
10541         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10542         Modify icf_safe_test for X86-64.
10543         * testsuite/Makefile.in: Regenerate.
10544         * testsuite/icf_safe_so_test.cc: New file.
10545         * testsuite/icf_safe_so_test.sh: New file.
10546         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10547         (main): Change to take pointer to function kept_func_3.
10548         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10549         folding is done correctly for X86-64.
10550
10551 2010-02-12  David S. Miller  <davem@davemloft.net>
10552
10553         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10554         is_symbolless parameter.
10555         (Output_reloc<SHT_REL>::is_symbolless): New.
10556         (Output_reloc<SHT_REL>::is_symbolless_): New.
10557         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10558         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10559         (Output_reloc<SHT_RELA>::is_symbolless): New.
10560         (Output_data_reloc::add_global): Handle is_symbolless.
10561         (Output_data_reloc::add_global_relative): Likewise.
10562         (Output_data_reloc::add_local): Likewise.
10563         (Output_data_reloc::add_local_relative): Likewise.
10564         (Output_data_reloc::add_symbolless_global_addend): New.
10565         (Output_data_reloc::add_symbolless_local_addend): New.
10566         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10567         is_symbolless.
10568         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10569         instead of ->is_relative_
10570         (Output_reloc::write): Likewise.
10571         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10572         (Output_reloc::write_rel): Simplify.
10573
10574         * sparc.cc (Target_sparc::Scan::local): Use
10575         ->add_symbolless_local_addend as needed.
10576         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10577         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10578         based upon relocation offset.
10579
10580 2010-02-11  Doug Kwan  <dougkwan@google.com>
10581
10582         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10583         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10584         beginning of function.
10585         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10586         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10587         parameter is_32bit in calls to should_apply_static_reloc.
10588         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10589         (check_DATA): Add arm_abs_global.stdout.
10590         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10591         arm_abs_global.stdout): New rules.
10592         (MOSTLLYCLEANFILES): Add arm_abs_global
10593         * Makefile.in: Regenerate.
10594         * testsuite/arm_abs_global.s: New file.
10595         * testsuite/arm_abs_global.sh: Ditto.
10596         * testsuite/arm_abs_lib.s: Ditto.
10597
10598 2010-02-11  Ian Lance Taylor  <iant@google.com>
10599
10600         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10601         Read_relocs task.
10602         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10603         Allocate_commons_task first.
10604         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10605         task, rather than symtab_lock_.
10606         (Gc_process_relocs::~Gc_process_relocs): New function.
10607         (Gc_process_relocs::is_runnable): Check this_blocker_.
10608         (Gc_process_relocs::locks): Use next_blocker_ rather than
10609         blocker_.
10610         (Scan_relocs::~Scan_relocs): New function.
10611         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10612         symtab_lock_.
10613         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10614         next_blocker_.
10615         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10616         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10617         constructor accordingly.
10618         (class Gc_process_relocs): Likewise.
10619         (class Scan_relocs): Likewise.
10620         * common.h (class Allocate_commons_task): Remove symtab_lock_
10621         field, and corresponding constructor parameter.
10622         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10623         symtab_lock_.
10624         (Allocate_commons_task::locks): Likewise.
10625
10626 2010-02-11  Ian Lance Taylor  <iant@google.com>
10627
10628         * gold-threads.h (class Once): Define.
10629         (class Initialize_lock): Rewrite as child of Once.
10630         * gold-threads.cc (class Once_initialize): Define.
10631         (once_pointer_control): New static variable.
10632         (once_pointer, once_arg): New static variables.
10633         (c_run_once): New static function.
10634         (Once::Once, Once::run_once, Once::internal_run): New functions.
10635         (class Initialize_lock_once): Remove.
10636         (initialize_lock_control): Remove.
10637         (initialize_lock_pointer): Remove.
10638         (initialize_lock_once): Remove.
10639         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10640         (Initialize_lock::initialize): Rewrite.
10641         (Initialize_lock::do_run_once): New function.
10642         * archive.cc (Archive::interpret_header): Only clear name if it is
10643         not already empty.
10644         * fileread.cc: Include "gold-threads.h"
10645         (file_counts_lock): New static variable.
10646         (file_counts_initialize_lock): Likewise.
10647         (File_read::release): Only increment counts when using --stats.
10648         Use a lock around the increment.
10649         * parameters.cc (class Set_parameters_target_once): Define.
10650         (set_parameters_target_once): New static variable.
10651         (Parameters::Parameters): Move here from parameters.h.
10652         (Parameters::set_target): Rewrite.
10653         (Parameters::set_target_once): New function.
10654         (Parameters::clear_target): Move here and rewrite.
10655         * parameters.h (class Parameters): Update declarations.  Add
10656         set_parameters_target_once_ field.
10657         (Parameters::Parameters): Move to parameters.cc.
10658         (Parameters::clear_target): Likewise.
10659         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10660         task.
10661         (Start_group::~Start_group): New function.
10662         (Start_group::is_runnable): New function.
10663         (Start_group::locks, Start_group::run): New functions.
10664         (Finish_group::run): Change saw_undefined to size_t.
10665         * readsyms.h (class Start_group): Define.
10666         (class Finish_group): Change saw_undefined_ field to size_t.
10667         (Finish_group::Finish_group): Remove saw_undefined and
10668         this_blocker parameters.  Change all callers.
10669         (Finish_group::set_saw_undefined): New function.
10670         (Finish_group::set_blocker): New function.
10671         * symtab.h (class Symbol_table): Change saw_undefined to return
10672         size_t.  Change saw_undefined_ field to size_t.
10673         * target-select.cc (Set_target_once::do_run_once): New function.
10674         (Target_selector::Target_selector): Initialize set_target_once_
10675         field.  Don't initialize lock_ and initialize_lock_ fields.
10676         (Target_selector::instantiate_target): Rewrite.
10677         (Target_selector::set_target): New function.
10678         * target-select.h (class Set_target_once): Define.
10679         (class Target_selector): Update declarations.  Make
10680         Set_target_once a friend.  Remove lock_ and initialize_lock_
10681         fields.  Add set_target_once_ field.
10682
10683 2010-02-10  Ian Lance Taylor  <iant@google.com>
10684
10685         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10686         queueing any tasks.
10687         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10688         (queue_middle_tasks): Add all blockers before queueing any tasks.
10689         (queue_final_tasks): Likewise.
10690         * token.h (Task_token::add_blockers): New function.
10691         * object.h (Input_objects::number_of_relobjs): New function.
10692
10693 2010-02-10  Ian Lance Taylor  <iant@google.com>
10694
10695         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10696         shared, not if not position independent.
10697         * x86_64.cc (Relocate::relocate_tls): Likewise.
10698         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10699         (tls_pie_pic_test): New target.
10700         * testsuite/Makefile.in: Rebuild.
10701
10702         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10703         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10704         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10705         * testsuite/Makefile.in: Rebuild.
10706
10707 2010-02-09  David S. Miller  <davem@davemloft.net>
10708
10709         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10710         R_SPARC_RELATIVE using ->add_local_relative().
10711         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10712
10713         * output.h (Output_data_dynamic::add_section_size): New method
10714         that takes two Output_data objects.
10715         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10716         entry param.  Handle it in initializers.
10717         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10718         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10719         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10720         arg.
10721         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10722         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10723         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10724         for dynrel_includes_plt.
10725         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10726         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10727         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10728         before .rela.plt
10729         (Target_sparc::do_finalize_sections): Update to pass true for
10730         dynrel_includes_plt.
10731         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10732         output before .rela.plt
10733         (Target_powerpc::do_finalize_sections): Update to pass true for
10734         dynrel_includes_plt when 32-bit.
10735
10736 2010-02-08  Doug Kwan  <dougkwan@google.com>
10737
10738         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10739         method.
10740         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10741         Arm_relobj::scan_section_for_cortex_a8_stubs,
10742         Arm_relobj::do_relocation_section): Instead of calling
10743         Output_section::output_address, use faster
10744         Arm_relobj::simple_input_section_output_address.
10745
10746 2010-02-08  David S. Miller  <davem@davemloft.net>
10747
10748         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10749         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10750         relocation helper function.
10751
10752         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10753         just like R_SPARC_GOT{10,13,22}.
10754         (Target_sparc::Scan::local): Likewise.
10755         (Target_sparc::Relocate:relocate): Likewise.
10756
10757 2010-02-06  Ian Lance Taylor  <iant@google.com>
10758
10759         * configure.ac: Rewrite targetobjs duplicate removal code to use
10760         only shell constructs.
10761         * configure: Rebuild.
10762
10763 2010-02-05  Doug Kwan  <dougkwan@google.com>
10764
10765         PR 11247
10766         * arm.cc (Arm_relobj::section_is_scannable): New method.
10767         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10768         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10769
10770 2010-02-04  Doug Kwan  <dougkwan@google.com>
10771
10772         PR 11247
10773         * arm-reloc-property.cc (cstdio): Include.
10774         * configure.ac (targetobjs): Remove duplicates.
10775         * configure: Regenerate.
10776         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10777         big and little endian version for a given address size.
10778
10779 2010-02-03  Doug Kwan  <dougkwan@google.com>
10780
10781         * arm-reloc-property.cc
10782         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10783         definition.
10784         * arm-reloc-property.h
10785         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10786         New method definition.
10787         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10788         declaration.
10789         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10790         overflow to N.
10791         (GOT_PREL): Change implemented to Y.
10792         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10793         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10794         (Arm_relocate_functions::movw_abs_nc): Remove method.
10795         (Arm_relocate_functions::movt_abs): Ditto.
10796         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10797         (Arm_relocate_functions::thm_movt_abs): Ditto.
10798         (Arm_relocate_functions::movw_rel_nc): Ditto.
10799         (Arm_relocate_functions::movw_rel): Ditto.
10800         (Arm_relocate_functions::movt_rel): Ditto.
10801         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10802         (Arm_relocate_functions:thm_movw_rel): Ditto.
10803         (Arm_relocate_functions:thm_movt_rel): Ditto.
10804         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10805         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10806         New method definitions.
10807         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10808         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10809         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10810         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10811         (Target_arm::Relocate::relocate): Check for non-static or
10812         unimplemented relocation code and exit early.  Change calls to
10813         Target_arm::reloc_uses_thumb_bit and
10814         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10815         instead.  Refactor code to handle similar relocations to increase
10816         code sharing.  Remove check for unsupported relocation code in switch
10817         statement.
10818         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10819         relocation property table to find out size.  Change error message to
10820         print out the name of a relocation code instead of the numeric value.
10821         (Target_arm::scan_reloc_for_stub): Use relocation property table
10822         instead of calling Target_arm::reloc_uses_thumb_bit().
10823
10824 2010-02-02  Doug Kwan  <dougkwan@google.com>
10825
10826         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10827         types of relaxed input section.
10828
10829 2010-02-02  Doug Kwan  <dougkwan@google.com>
10830
10831         * Makefile.am (HFILES): Add arm-reloc-property.h.
10832         (DEFFILES): New.
10833         (TARGETSOURCES): Add arm-reloc-property.cc
10834         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10835         (libgold_a_SOURCES): $(DEFFILES)
10836         * Makefile.in: Regenerate.
10837         * arm-reloc-property.cc: New file.
10838         * arm-reloc-property.h: New file.
10839         * arm-reloc.def: New file.
10840         * arm.cc: Update comments.
10841         (arm-reloc-property.h): New included header.
10842         (arm_reloc_property_table): New global variable.
10843         (Target_arm::do_select_as_default_target): New method definition.
10844         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10845         arm-reloc-property to targ_extra_obj.
10846         * parameters.cc (set_parameters_target): Call
10847         Target::select_as_default_target().
10848         * target.h (Target::select_as_default_target): New method definition.
10849         (Target::do_select_as_default_target): Same.
10850
10851 2010-02-01  Doug Kwan  <dougkwan@google.com>
10852
10853         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10854         first_output_text_section_.
10855         (Arm_exidx_fixup::first_output_text_section): New method definition.
10856         (Arm_exidx_fixup::first_output_text_section_): New data member.
10857         (Arm_exidx_fixup::process_exidx_section): Record the first text
10858         output section seen.
10859         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10860         and entsize in output section header.
10861
10862 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10863
10864         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10865         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10866         (Arm_relocate_functions::thm_alu11): New Method.
10867         (Arm_relocate_functions::thm_pc8): New Method.
10868         (Arm_relocate_functions::thm_pc12): New Method.
10869         (Target_arm::Scan::local): Handle the relocations.
10870         (Target_arm::Scan::global): Likewise.
10871         (Target_arm::Relocate::relocate): Likewise.
10872         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10873
10874 2010-01-29  Doug Kwan  <dougkwan@google.com>
10875
10876         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10877         of relocation types as ld.
10878
10879 2010-01-29  Doug Kwan  <dougkwan@google.com>
10880
10881         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10882         to public.
10883         (Arm_relocate_functions::thumb_branch_common): Ditto.
10884         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10885         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10886         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10887         Arm_relocate_functions::jump24): Remove.
10888         (Target_arm::Relocate::relocate): Adjust code to call
10889         Arm_relocation_functions::arm_branch_common and
10890         Arm_relocation_functions::thumb_branch_common instead of their removed
10891         wrappers.  Merge switch-cases together to reduce source code size.
10892
10893 2010-01-29  Doug Kwan  <dougkwan@google.com>
10894
10895         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10896         output_local_symbol_count_needs_update_.
10897         (Arm_relobj::output_local_symbol_count_needs_update,
10898          Arm_relobj::set_output_local_symbol_count_needs_update,
10899          Arm_relobj::update_output_local_symbol_count): New methods.
10900         (Arm_relobj::output_local_symbol_count_needs_update_): New data
10901         member.
10902         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10903         of pointed function as in a R_ARM_PREL31 relocation.
10904         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10905         for output local symbol count updating.
10906         (Target_arm::do_relax): Update output local symbol counts in objects
10907         if necessary.
10908         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10909
10910 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10911
10912         * arm.cc: Added support for the ARM relocations:
10913         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10914         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10915         (Arm_relocate_functions::movw_rel_nc): Renamed (was
10916         movw_prel_nc).
10917         (Arm_relocate_functions::movw_rel): New method.
10918         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10919         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10920         thm_movw_prel_nc).
10921         (Arm_relocate_functions::thm_movw_rel): New method.
10922         (Arm_relocate_functions::thm_movt_rel): Renamed (was
10923         thm_movt_prel).
10924         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10925         relocations.
10926         (Target_arm::Scan::global): Likewise.
10927         (Target_arm::Relocate::relocate): Likewise.
10928         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10929         Likewise.
10930
10931 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10932
10933         * arm.cc: Added support for ARM group relocations.
10934         (Target_arm::reloc_needs_sym_origin): New method.
10935         (Arm_relocate_functions::calc_grp_kn): New method.
10936         (Arm_relocate_functions::calc_grp_residual): New method.
10937         (Arm_relocate_functions::calc_grp_gn): New method.
10938         (Arm_relocate_functions::arm_grp_alu): New Method.
10939         (Arm_relocate_functions::arm_grp_ldr): New Method.
10940         (Arm_relocate_functions::arm_grp_ldrs): New Method.
10941         (Arm_relocate_functions::arm_grp_ldc): New Method.
10942         (Target_arm::Scan::local): Handle the ARM group relocations.
10943         (Target_arm::Scan::global): Likewise.
10944         (Target_arm::Relocate::relocate): Likewise.
10945         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10946         Likewise.
10947
10948 2010-01-26  Doug Kwan  <dougkwan@google.com>
10949
10950         * arm.cc (set): Include.
10951         (class Arm_exidx_fixup): Change type of last_input_section_ to const
10952         pointer type.
10953         (Arm_output_section::Text_section_list): New type.
10954         (Arm_output_section::append_text_sections_to_list): New method.
10955         (Arm_output_section::fix_exidx_coverage): Ditto.
10956         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10957         (Arm_relobj::convert_input_section_to_relaxed_section): Use
10958         Relobj::set_section_offset() instead of
10959         Sized_relobj::invalidate_section_offset().
10960         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10961         parameter for section headers. Ignore relocation sections for
10962         unallocated sections and EXIDX sections.
10963         (Target_arm::fix_exidx_coverage): New method.
10964         (Target_arm::output_section_address_less_than): New type.
10965         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10966         linked text section instead of the EXIDX section.
10967         (Arm_output_section::create_stub_group): Add an assertion to check
10968         that this is not an EXIDX output section.
10969         (Arm_output_section::append_text_sections_to_list): New method.
10970         (Arm_output_section::fix_exidx_coverage): Ditto.
10971         (Arm_relobj::scan_sections_for_stubs): Adjust call to
10972         Arm_relobj::section_needs_reloc_stub_scanning.
10973         (Target_arm::do_relax): Fix EXIDX output section coverage in the
10974         first pass.
10975         (Target_arm::fix_exidx_coverage): New method.
10976         * object.h (Relobj::set_output_section): New method.
10977         (Sized_relobj::invalidate_section_offset): Remove method.
10978         (Sized_relobj::do_invalidate_section_offset): Remove method.
10979         (Sized_relobj::do_set_section_offset): Handle offset value -1.
10980
10981 2010-01-25  Doug Kwan  <dougkwan@google.com>
10982
10983         * arm.cc (Arm_exidx_merged_section::do_output_offset):
10984         Fix warning due to signed and unsigned comparison on a 32-bit host.
10985
10986 2010-01-22  Doug Kwan  <dougkwan@google.com>
10987
10988         * arm.cc (Target_arm::do_relax): Record an output section for section
10989         offset adjustment it contains any stub table that has changed.
10990         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10991         offsets in an output section if necessary.
10992         * output.cc (Output_section::Output_section): Initialize
10993         section_offsets_need_adjustments_.
10994         (Output_section::add_input_section_for_script): Renamed to
10995         Output_section::add_simple_input_section.
10996         (Output_section::save_states): Add a comment.
10997         (Output_section::discard_states): New method defintion.
10998         (Output_section::adjust_section_offsets): Same.
10999         * output.h (Output_section::add_input_section_for_script): Renamed to
11000         Output_section::add_simple_input_section.
11001         (Output_section::discard_states): New method declaration.
11002         (Output_section::adjust_section_offsets): Same.
11003         (Output_section::section_offsets_need_adjustment,
11004         Output_section::set_section_offsets_need_adjustment): New method
11005         definitions.
11006         (Output_section::section_offsets_need_adjustment_): New data member.
11007         * script-sections.cc
11008         (Output_section_element_input::set_section_address): Adjust code for
11009         renaming of Output_section::add_input_section_for_script.
11010         (Orphan_output_section::set_section_address): Same.
11011
11012 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11013
11014         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11015         Fix_v4bx enum values .
11016         * gold/options.h (General_options): New option definitions.
11017         (General_options::fix_v4bx): New method.
11018         (General_options::Fix_v4bx): New enum.
11019         * gold/options.cc (General_options::parse_fix_v4bx): New method.
11020         (General_options::parse_fix_v4bx_interworking): New method.
11021
11022 2010-01-22  Doug Kwan  <dougkwan@google.com>
11023
11024         * arm.cc (Arm_exidx_fixup): New class.
11025
11026 2010-01-21  Doug Kwan  <dougkwan@google.com>
11027
11028         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11029         classes.
11030         (Arm_exidx_section_offset_map): New type.
11031
11032 2010-01-21  Doug Kwan  <dougkwan@google.com>
11033
11034         * arm.cc (Arm_exidx_input_section): New class.
11035         (Arm_relobj::exidx_input_section_by_link,
11036         Arm_relobj::exidx_input_section_by_shndx,
11037         Arm_relobj::make_exidx_input_section): New methods.
11038         (read_arm_attributes_section): Remove.
11039         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11040         information about them.
11041         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11042         to here.
11043
11044 2010-01-20  Doug Kwan  <dougkwan@google.com>
11045
11046         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11047         Input_section_specifier to Section_id.
11048         (Target_arm::new_arm_input_section: Adjust code for change of key
11049         type.
11050         (Target_arm::find_arm_input_section): Ditto.
11051         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11052         (Section_id): Remove.
11053         (Garbage_collection::Section_id_hash): Remove.
11054         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11055         (Section_id): Remove.
11056         (Icf::Section_id_hash): Remove.
11057         * object.h (Section_id, Const_section_id, Section_id_hash,
11058         Const_section_id_hash): New type definitions.
11059         * output.cc (Output_section::add_relaxed_input_section): Change to
11060         use Const_section_id instead of Input_section_specifier as key type.
11061         (Output_section::add_merge_input_section): Ditto.
11062         (Output_section::build_relaxation_map): Change to use Section_id
11063         instead of Input_section_specifier as key type.
11064         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11065         Ditto.
11066         (Output_section::convert_input_sections_to_relaxed_sections): Change
11067         to use Const_section_id instead of Input_section_specifier as key type.
11068         (Output_section::find_merge_section): Ditto.
11069         (Output_section::find_relaxed_input_section): Ditto.
11070         * output.h (Input_section_specifier): Remove class.
11071         (Output_section::Output_section_data_by_input_section_map): Change
11072         key type to Const_section_id.
11073         (Output_section::Output_relaxed_input_section_by_input_section_map):
11074         Ditto.
11075         (Output_section::Relaxation_map): Change key type to Section_id.
11076
11077 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11078
11079         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11080         (class Arm_v4bx_stub): New class.
11081         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11082         (Stub_factory::make_arm_v4bx_stub): New method.
11083         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11084         (Stub_table::empty): Handle v4bx stubs.
11085         (Stub_table::add_arm_v4bx_stub): New method.
11086         (Stub_table::find_arm_v4bx_stub): New method.
11087         (Arm_relocate_functions::v4bx): New method.
11088         (Target_arm::fix_v4bx): New method.
11089         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11090         (Stub_table::relocate_stubs): Likewise.
11091         (Stub_table::do_write): Likewise.
11092         (Stub_table::update_data_size_and_addralign): Likewise.
11093         (Stub_table::finalize_stubs):  Likewise.
11094         (Target_arm::Scan::local): Likewise.
11095         (Target_arm::Scan::global): Likewise.
11096         (Target_arm::do_finalize_sections): Likewise.
11097         (Target_arm::Relocate::relocate): Likewise.
11098         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11099         Likewise.
11100         (Target_arm::scan_reloc_for_stub): Likewise.
11101         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11102
11103 2010-01-19  Ian Lance Taylor  <iant@google.com>
11104
11105         * output.cc (Output_section_headers::do_sized_write): Write large
11106         segment count to sh_info field.
11107         (Output_file_header::do_sized_write): For large segment count,
11108         write PN_XNUM to e_phnum field.
11109
11110 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11111
11112         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11113         (Arm_relocate_functions::thm_jump8): New function.
11114         (Arm_relocate_functions::thm_jump11): New function.
11115         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11116         R_ARM_THM_JUMP11.
11117         (Target_arm::Scan::global): Likewise.
11118         (Target_arm::Relocate::relocate): Likewise.
11119         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11120         Likewise.
11121
11122 2010-01-14  Doug Kwan  <dougkwan@google.com>
11123
11124         * arm.cc (map, utility): Include headers.
11125         (Target_arm::apply_cortex_a8_workaround): New method.
11126         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11127         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11128         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11129         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11130         the --[no-]fix-cortex-a8 command line options.
11131         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11132         (Target_arm::relocate_stub): Use addend in instruction template.
11133         * options.h (DEFINE_bool): Set the user-set flag.
11134         (General_options): Add --[no-]-fix-cortex options.
11135         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11136         : Update fast look-up map after conversion.
11137
11138 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11139
11140         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11141         in the first pass of do_layout.
11142
11143 2010-01-13  Doug Kwan  <dougkwan@google.com>
11144
11145         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11146         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11147         apparent compiler problem of not folding static constant integral
11148         data members of elfcpp::Elf_sizes<32>.
11149
11150 2010-01-13  Doug Kwan  <dougkwan@google.com>
11151
11152         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11153         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11154         Arm_relobj::scan_section_for_cortex_a8_erratum,
11155         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11156         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11157         sections to scan for relocation stubs into a new method
11158         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11159         relocation and Cortex-A8 stub scanning.
11160         (Target_arm::do_relax): Force stubs to be after stubbed sections
11161         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11162         the beginning of a new relaxation pass.  Update a comment.
11163         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11164
11165 2010-01-12  Ian Lance Taylor  <iant@google.com>
11166
11167         * target-reloc.h (visibility_error): New inline function.
11168         (relocate_section): Call visibility_error.
11169         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11170         (MOSTLYCLEANFILES): Likewise.
11171         (protected_4_pic.o, protected_3.err): New targets.
11172         * testsuite/protected_4.cc: New file.
11173
11174 2010-01-12  Doug Kwan  <dougkwan@google.com>
11175
11176         * arm.cc (Cortex_a8_reloc): New class.
11177         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11178         and cortex_a8_relocs_info_.
11179         (Target_arm::fix_cortex_a8): New method definition.
11180         (Target_arm::Cortex_a8_relocs_info): New type.
11181         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11182         New data member declarations.
11183         (Target_arm::scan_reloc_for_stub): Record information about
11184         relocations for THUMB branches that might be exempted from the
11185         Cortex-A8 workaround.
11186         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11187         at the beginning of a relaxation pass.
11188
11189 2010-01-12  Doug Kwan  <dougkwan@google.com>
11190
11191         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11192         (Arm_relobj::Mapping_symbol_position,
11193          Arm_reloj::Mapping_symbol_position_less,
11194          Arm_relobj::Mapping_symbols_info): New types.
11195         (Target_arm::is_mapping_symbol_name): New method definition.
11196         (Arm_relobj::do_count_local_symbols): Save information about mapping
11197         symbols.
11198
11199 2010-01-11  Doug Kwan  <dougkwan@google.com>
11200
11201         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11202         Arm_relocate_functions::thumb32_branch_upper,
11203         Arm_relocate_functions::thumb32_branch_lower,
11204         Arm_relocate_functions::thumb32_cond_branch_offset,
11205         Arm_relocate_functions::thumb32_cond_branch_upper,
11206         Arm_relocate_functions::thumb32_cond_branch_lower,
11207         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11208         branch offset encoding.
11209         (Arm_relocate_functions::thumb_branch_common): Use new branch
11210         offset encoding methods to avoid code duplication.
11211         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11212         (Stub_addend_reader::operator()): Use new branch encoding method
11213         to avoid code duplication.
11214
11215 2010-01-11  Doug Kwan  <dougkwan@google.com>
11216
11217         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11218         (Target_arm::do_finalize_sections): Define special EXIDX section
11219         symbols only if referenced.
11220         * gc.h (Garbage_collection::add_reference): New method.
11221         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11222         code duplication.
11223
11224 2010-01-11  Ian Lance Taylor  <iant@google.com>
11225
11226         * script.cc (Version_script_info::build_expression_list_lookup):
11227         Change complaing about duplicate wildcard match from error to
11228         warning.
11229
11230         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11231         of 2009-12-30.
11232         (Version_script_info::Version_script_info): Initialize globs_,
11233         default_version_, default_is_global_, and exact_.  Don't
11234         initialize globals_ or locals_.
11235         (Version_script_info::build_lookup_tables): Build local symbols
11236         first.
11237         (Version_script_info::unquote): New function.
11238         (Version_script_info::add_exact_match): New function.
11239         (Version_script_info::build_expression_list_lookup): Remove lookup
11240         parameter.  Add is_global parameter.  Change all callers.  Handle
11241         wildcard pattern specially.  Unquote pattern.  Call
11242         add_exact_match.
11243         (Version_script_info::get_name_to_match): New function.
11244         (Version_script_info::get_symbol_version): New function.
11245         (Version_script_info::get_symbol_version_helper): Remove.
11246         (Version_script_info::check_unmatched_names): Call unquote.
11247         * script.h (class Version_script_info): Change get_symbol_version
11248         to be non-inline and add is_global parameter; change all callers.
11249         Rewrite symbol_is_local.  Update declarations.  Define struct
11250         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11251         Remove globals_ and locals_ members.  Add exact_, globs_,
11252         default_version_, is_global_.
11253         (Version_script_info::Glob): Remove pattern, add expression and
11254         is_global.  Update constructor.  Change all callers.
11255         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11256         default version.
11257         (Versions::symbol_section_contents): If a symbol is undefined, or
11258         defined in a dynamic object, set the version index to
11259         VER_NDX_LOCAL.
11260         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11261         symbol_is_local.
11262         (Symbol_table::add_from_pluginobj): Likewise.
11263         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11264
11265 2010-01-11  Doug Kwan  <dougkwan@google.com>
11266
11267         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11268         (incremental_dump_LDADD): Add linking option for libintl.
11269         * Makefile.in: Regenerate.
11270
11271 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11272
11273         PR gold/11144
11274         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11275         instead of -Ds.
11276         * testsuite/Makefile.in: Regenerated.
11277
11278 2010-01-10  Doug Kwan  <dougkwan@google.com>
11279
11280         * options.h (DEFINE_var): Use parentheses around argument varname__
11281         in macro body to avoid any unintended subsequent substitutions.
11282
11283 2010-01-10  Ian Lance Taylor  <iant@google.com>
11284
11285         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11286         candidates before doing symbol resolution.
11287
11288         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11289         ODR candidates if only one is weak.
11290
11291 2010-01-08  Ian Lance Taylor  <iant@google.com>
11292
11293         * script.cc (Version_script_info::build_expression_list_lookup):
11294         Don't warn about ambiguous version, just record the ambiguity.
11295         (Version_script_info::get_symbol_version_helper): Give error if
11296         version is ambiguous.
11297
11298 2010-01-08  Doug Kwan  <dougkwan@google.com>
11299
11300         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11301         prev_data_size_ and prev_addralign_.  Remove initializer for
11302         deleted data member has_been_changed_.
11303         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11304         to determine if the table is empty.
11305         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11306         Remove.
11307         (Stub_table::add_reloc_stub): Define method in class definition
11308         instead of just declaring it there.
11309         (Stub_table::add_cortex_a8_stub): New method definition.
11310         (Stub_table::update_data_size_and_addralign): Ditto.
11311         (Stub_table::finalize_stubs): Ditto.
11312         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11313         (Stub_table::do_addralign_): Return address alignment in the
11314         (Stub_table::do_reset_address_and_file_offset): Define method in
11315         class definition instead of declaring it there.  Set current data
11316         size to be the data size of the previous pass.
11317         (Stub_table::set_final_data_size): Use current data size as the
11318         final data size.
11319         (Stub_table::relocate_stub): Change parameter type of stub from
11320         Reloc_stub pointer to Stub pointer.
11321         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11322         (Stub_table::Cortex_a8_stub_list): New typedef.
11323         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11324          Stub_table::prev_addralign_): New data member.
11325         (Arm_relobj::Arm_relobj): Initialize data member
11326         section_has_cortex_a8_workaround_.
11327         (Arm_relobj::section_has_cortex_a8_workaround,
11328          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11329          definitions.
11330         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11331         declarations.
11332         (Target_arm::relocate_stub): Change parameter type of stub from
11333         Reloc_stub pointer to Stub pointer.
11334         (Insn_template::size, Insn_template::alignment): Handle
11335         THUMB16_SPECIAL_TYPE.
11336         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11337          Stub_table::update_data_size_and_addralign,
11338          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11339         definitions.
11340         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11341         (Stub_table::do_write): Ditto.
11342         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11343
11344 2010-01-08  Ian Lance Taylor  <iant@google.com>
11345
11346         PR 11108
11347         * symtab.h (class Symbol): Remove fields is_target_special_ and
11348         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11349         (Symbol::is_defined_in_discarded_section): New function.
11350         (Symbol::set_is_defined_in_discarded_section): New function.
11351         (Symbol::has_plt_offset): Rewrite.
11352         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11353         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11354         Don't initialize is_target_special_ or has_plt_offset_.
11355         Initialize is_defined_in_discarded_section_.
11356         (Symbol_table::add_from_relobj): If appropriate, set
11357         is_defined_in_discarded_section.
11358         * resolve.cc (Symbol::override_base_with_special): Don't test
11359         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11360         * target-reloc.h (relocate_section): Do special handling for
11361         symbols defined in discarded sections for global symbols as well
11362         as local symbols.
11363
11364 2010-01-08  Ian Lance Taylor  <iant@google.com>
11365
11366         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11367         the SHT_SYMTAB case.
11368
11369 2010-01-08  Ian Lance Taylor  <iant@google.com>
11370
11371         * object.cc (Sized_relobj::do_layout): Don't get confused if
11372         layout_eh_frame returns NULL.
11373
11374 2010-01-08  Ian Lance Taylor  <iant@google.com>
11375
11376         PR 11084
11377         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11378         dynamic symbol table, use the normal symbol table.
11379         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11380         symbol table.
11381
11382 2010-01-08  Ian Lance Taylor  <iant@google.com>
11383
11384         PR 11072
11385         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11386         sections.
11387
11388 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11389
11390         * version.cc (print_version): Change to "Copyright 2010".
11391
11392 2010-01-08  Ian Lance Taylor  <iant@google.com>
11393
11394         PR 10287
11395         PR 11063
11396         * i386.cc (class Target_i386): Change return type of plt_section
11397         to be non-const.
11398         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11399         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11400         tls_desc_rel_ field.
11401         (Output_data_plt_i386::rel_tls_desc): New function.
11402         (Target_i386::rel_tls_desc_section): New function.
11403         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11404         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11405         R_386_TLS_DESC reloc in rel_tls_desc_section.
11406         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11407         Define struct Tlsdesc_info.
11408         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11409         (Target_x86_64::do_reloc_symbol_index): New function.
11410         (Target_x86_64::add_tlsdesc_info): New function.
11411         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11412         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11413         tlsdesc_rel_ field.
11414         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11415         all callers.
11416         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11417         (Target_x86_64::rela_tlsdesc_section): New function.
11418         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11419         handling.
11420         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11421         (Target_x86_64::do_reloc_addend): New function.
11422         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11423         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11424         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11425         (Output_reloc::type): New function.
11426         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11427         (Output_reloc::is_target_specific): New function.
11428         (Output_reloc::target_arg): New function.
11429         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11430         absolute relocs and target specific relocs.
11431         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11432         add_target_specific.
11433         (class Output_data_reloc) [SHT_RELA]: Likewise.
11434         * output.cc (Output_reloc::Output_reloc): Add four new versions
11435         for absolute relocs and target specific relocs.
11436         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11437         (Output_reloc::get_symbol_index): Likewise.
11438         (Output_reloc::local_section_offset): Check that local_sym_index_
11439         is not TARGET_CODE or 0.
11440         (Output_reloc::symbol_value): Likewise.
11441         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11442         reloc.
11443         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11444         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11445         functions.
11446         * layout.cc (add_target_dynamic_tags): Use output section for
11447         DT_PLTRELSZ and DT_JMPREL.
11448
11449 2010-01-07  Ian Lance Taylor  <iant@google.com>
11450
11451         PR 11061
11452         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11453         function.
11454         (class Output_data_reloc_generic): Define.
11455         (class Output_data_reloc_base): Change base class to
11456         Output_data_reloc_generic.  Change add() method to call
11457         bump_relative_reloc_count for a relative reloc.  Remove
11458         sort_relocs_ field.
11459         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11460         to sort_relocs().
11461         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11462         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11463         appropriate.
11464         * layout.h (class Layout): Update declaration.
11465
11466 2010-01-07  Ian Lance Taylor  <iant@google.com>
11467
11468         * output.h (class Output_data): Add const version of
11469         output_section and do_output_section.
11470         (class Output_section_data): Add const version of
11471         do_output_section.
11472         (class Output_section): Likewise.
11473         * layout.cc (Layout::add_target_dynamic_tags): New function.
11474         * layout.h (class Layout): Update declarations.
11475         * arm.cc (Target_arm::do_finalize_sections): Use
11476         add_target_dynamic_tags.
11477         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11478         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11479         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11480         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11481
11482 2010-01-07  Ian Lance Taylor  <iant@google.com>
11483
11484         PR 11042
11485         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11486         object as needed.
11487
11488 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11489             Ian Lance Taylor  <iant@google.com>
11490
11491         PR 11019
11492         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11493         Xindex::read_symtab_xindex.
11494
11495 2010-01-07  Doug Kwan  <dougkwan@google.com>
11496
11497         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11498         (Insn_template::thumb16_bcond_insn): New method declaration.
11499         (Insn_template): Fix spelling.
11500         (Stub::thumb16_special): New method declaration.
11501         (Stub::do_write): Define virtual method which was previously pure
11502         virtual.
11503         (Stub::do_thumb16_special): New method declaration.
11504         (Stub::do_fixed_endian_write): New template member.
11505         (Reloc_stub::do_write): Remove.
11506         (Reloc_stub::do_fixed_endian_write): Remove.
11507         (Cortex_a8_stub): New class definition.
11508         (Stub_factory::make_cortex_a8_stub): New method definition.
11509         (Stub_factory::Stub_factory): Add missing static storage class
11510         qualifier for elf32_arm_stub_a8_veneer_blx.
11511
11512 2010-01-07  Ian Lance Taylor  <iant@google.com>
11513
11514         PR 10980
11515         * options.h (class General_options): Add --warn-unresolved-symbols
11516         and --error-unresolved-symbols.
11517         * errors.cc (Errors::undefined_symbol): Implement
11518         --warn-unresolved-symbols.
11519
11520         * options.h (class General_options): Add -z text and -z textoff.
11521         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11522
11523 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11524
11525         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11526         (Garbage_collection::cident_sections): New function.
11527         (Garbage_collection::add_cident_section): New function.
11528         (Garbage_collection::cident_sections_): New member.
11529         (gc_process_relocs): Add references to sections whose names are C
11530         identifiers.
11531         * gold.h (cident_section_start_prefix): New constant.
11532         (cident_section_stop_prefix): New constant.
11533         (is_cident): New function.
11534         * layout.cc (Layout::define_section_symbols): Replace string constants
11535         with the newly defined constants.
11536         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11537         C identifiers.
11538         * testsuite/Makefile.am: Add gc_orphan_section_test.
11539         * testsuite/Makefile.in: Regenerate.
11540         * testsuite/gc_orphan_section_test.cc: New file.
11541         * testsuite/gc_orphan_section_test.sh: New file.
11542
11543 2010-01-06  Ian Lance Taylor  <iant@google.com>
11544
11545         PR 10980
11546         * options.h (class General_options): Add --warn-shared-textrel.
11547         * layout.cc (Layout::finish_dynamic_section): Implement
11548         --warn-shared-textrel.
11549
11550         PR 10980
11551         * options.h (class General_options): Add --warn-multiple-gp.
11552
11553 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11554
11555         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11556         $(THREADSLIB) and $(LIBDL).
11557         * Makefile.in: Rebuild.
11558
11559 2010-01-06  Ian Lance Taylor  <iant@google.com>
11560
11561         PR 10980
11562         * options.cc (General_options::parse_section_start): New function.
11563         (General_options::section_start): New function.
11564         (General_options::General_options): Initialize all members.
11565         * options.h: Include <map>
11566         (class General_options): Add --section-start.  Add section_starts_
11567         member.
11568         * layout.cc (Layout::attach_allocated_section_to_segment): If
11569         --section-start was used, set the address of the segment.  Remove
11570         local sort_sections.
11571         (Layout::relaxation_loop_body): If the address of the load segment
11572         has been set by --section-start, don't use it.
11573         * output.h (Output_segment::update_flags_for_output_section): New
11574         function.
11575         * output.cc (Output_segment::add_output_section): Call
11576         update_flags_for_output_section.
11577
11578 2010-01-05  Ian Lance Taylor  <iant@google.com>
11579
11580         PR 10980
11581         * options.h (class General_options): Add --undefined-version.
11582         * script.cc (struct Version_expression): Add was_matched_by_symbol
11583         field.
11584         (Version_script_info::matched_symbol): New function.
11585         (Version_script_info::get_symbol_version_helper): Call
11586         matched_symbol.
11587         (Version_script_info::check_unmatched_names): New function.
11588         * script.h (class Version_script_info): Update declarations.
11589         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11590
11591         * options.h (class General_options): Use DEFINE_bool_alias for
11592         allow_multiple_definition.
11593         * resolve.cc (Symbol_table::should_override): Don't test
11594         allow_multiple_definition.
11595
11596         PR 10980
11597         * options.h (class General_options): Add --cref.
11598         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11599         until after printing cref table.
11600         * cref.cc: Include "symtab.h".
11601         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11602         (Cref_table_compare::operator()): New function.
11603         (Cref_inputs::gather_cref): New function.
11604         (filecol): New static const.
11605         (Cref_inputs::print_cref): New function.
11606         (Cref::print_cref): New function.
11607         * cref.h: Include <cstdio>.
11608         (class Cref): Update declarations.
11609         * mapfile.h (Mapfile::file): New function.
11610         * object.h (class Object): Define Symbols.  Declare virtual
11611         do_get_global_symbols.
11612         (Object::get_global_symbols): New function.
11613         * object.cc (Input_objects::add_object): Pass object to cref_ if
11614         --cref.
11615         (Input_objects::archive_start): Likewise.
11616         (Input_objects::archive_stop): Likewise.
11617         (Input_objects::print_cref): New function.
11618         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11619         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11620         --cref.
11621         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11622         function.
11623         * plugin.h (class Sized_pluginobj): Update declarations.
11624
11625 2010-01-05  Ian Lance Taylor  <iant@google.com>
11626
11627         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11628         to is_default_version.  Rename insdef to insdefault.
11629         (Symbol_table::add_from_relobj): Rename def to is_default_version
11630         and local to is_forced_local.
11631         (Symbol_table::add_from_pluginobj): Likewise.
11632         (Symbol_table::add_from_dynobj): Likewise.
11633         (Symbol_table::define_special_symbol): Rename insdef to
11634         insdefault.
11635
11636 2010-01-04  Ian Lance Taylor  <iant@google.com>
11637
11638         PR 10980
11639         * options.h (class General_options): Add
11640         --allow-multiple-definition and -z muldefs.
11641         * resolve.cc (Symbol_table::should_override): Don't warn about a
11642         multiple symbol definition if --allow-multiple-definition or -z
11643         muldefs.
11644
11645         PR 10980
11646         * options.h (class General_options): Add --add-needed and
11647         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11648         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11649         error if --copy-dt-needed-entries aka --add-needed is used and
11650         would cause a change in behaviour.
11651
11652         PR 10980
11653         * options.h (class General_options): Add -G as a short version of
11654         --shared.  Add no-op options -assert, -g, and -i.
11655
11656 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11657
11658         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11659         check for .text or .gnu.linkonce.t sections.
11660         * icf.cc (Icf::find_identical_sections): Ditto.
11661         Change the detection for mangled function name within the section
11662         name.
11663         * icf.h (is_section_foldable_candidate): New function.
11664
11665 2009-12-30  Ian Lance Taylor  <iant@google.com>
11666
11667         PR 10980
11668         * options.h (class General_options): Permit two dashes with
11669         --retain-symbols-file.
11670
11671 2009-12-30  Ian Lance Taylor  <iant@google.com>
11672
11673         PR 10979
11674         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11675         don't put the file header and segment headers in the text
11676         segment.
11677
11678         PR 10979
11679         * common.cc (Sort_commons::operator()): Stabilize sort when both
11680         entries are NULL.
11681         (Symbol_table::do_allocate_commons_list): When allocating common
11682         symbols, skip a symbol which is no longer common.
11683         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11684         an object before checking its type.
11685         * testsuite/common_test_2.c: New file.
11686         * testsuite/common_test_3.c: New file.
11687         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11688         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11689         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11690         (common_test_2_pic.o, common_test_2.so): New targets.
11691         (common_test_3_pic.o, common_test_3.so): New targets.
11692         * testsuite/Makefile.in: Rebuild.
11693
11694         PR 10979
11695         * script.cc (read_input_script): If we see a new SECTIONS clause,
11696         and we have added an input section, give an error.
11697         * layout.h (class Layout): Add have_added_input_section function.
11698         Add have_added_input_section_ field.
11699         * layout.cc (Layout::Layout): Initialize
11700         have_added_input_section_.
11701         (Layout::layout): Set have_added_input_section_.
11702         (Layout::layout_eh_frame): Likewise.
11703
11704 2009-12-30  Ian Lance Taylor  <iant@google.com>
11705
11706         PR 10931
11707         * options.h (class General_options): Add --sort-common option.
11708         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11709         * common.cc (Sort_common): Add sort_order parameter to
11710         constructor.  Add sort_order_ field.
11711         (Sort_commons::operator): Check sort_order_.
11712         (Symbol_table::allocate_commons): Determine the sort order.
11713         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11714         Change all callers.
11715         (Symbol_table::do_allocate_commons_list): Likewise.
11716
11717 2009-12-30  Ian Lance Taylor  <iant@google.com>
11718
11719         PR 10916
11720         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11721         symbols from this object, don't change the visibility of an
11722         undefined symbol.
11723         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11724
11725 2009-12-30  Ian Lance Taylor  <iant@google.com>
11726
11727         PR 10861
11728         * script.h (class Version_script_info): Define Language enum.
11729         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11730         new fields globals_, locals_, and is_finalized_.
11731         * script.cc: Various formatting fixes.
11732         (class Parser_closure): Change language_stack_ from a vector of
11733         std::string to one of Version_script_info::Language.  Adjust all
11734         uses accordingly.
11735         (class Lazy_demangler): Remove.
11736         (struct Version_expression): Change language from std::string to
11737         Version_script_info::Language.
11738         (Version_script_info::Version_script_info): New function.
11739         (Version_script_info::~Version_script_info): Don't call clear.
11740         (Version_script_info::finalize): New function.
11741         (Version_script_info::build_lookup_tables): New function.
11742         (Version_script_info::build_expression_list_lookup): New
11743         function.
11744         (Version_script_info::get_symbol_version_helper): Rewrite to use
11745         lookup tables.
11746         (Version_script_info::print_expression_list): Adjust to use
11747         Version_script_info::Language.
11748         (script_push_lex_into_version_mode): Check that the version script
11749         has not been finalized.
11750         (version_script_push_lang): Change language string to
11751         Version_script_info::Language.
11752         * options.cc (Command_line::version_script): New function.
11753         * options.h (class General_options): Add finalize_dynamic_list
11754         function.  Change version_script from declaration to definition.
11755         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11756         * testsuite/version_script.map: Remove duplicate def of foo.
11757         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11758         version_script.map.
11759         * testsuite/Makefile.in: Rebuild.
11760
11761 2009-12-30  Ian Lance Taylor  <iant@google.com>
11762
11763         PR 10843
11764         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11765         if the input symbol index is 0, make the output symbol index 0.
11766
11767 2009-12-30  Ian Lance Taylor  <iant@google.com>
11768
11769         PR 10670
11770         * options.h (class General_options): Add -x/--discard-all.
11771         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11772         --discard-all.  If the local symbol needs a dynamic entry, check
11773         that before handling --discard-locals.
11774
11775 2009-12-30  Ian Lance Taylor  <iant@google.com>
11776
11777         PR 10450
11778         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11779         flags to PF_R.
11780         (Output_segment::add_output_section): Don't change the flags if
11781         the type is PT_TLS.
11782
11783         PR 10450
11784         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11785         GNU hash table if they need a dynamic value.  Otherwise, don't add
11786         them if they are defined in a dynamic object or are forced local.
11787
11788 2009-12-29  Ian Lance Taylor  <iant@google.com>
11789
11790         PR 10450
11791         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11792         .gnu.hash table for a 32-bit target.
11793
11794         PR 10450
11795         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11796         regular and a dynamic object only needs a dynamic symbol table
11797         entry if it is externally visible.
11798
11799         PR 10450
11800         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11801         constructor.  Add global_offset_table_ field.
11802         (Target_i386::got_section): Set global_offset_table_.
11803         (Target_i386::do_finalize_sections): Set global_offset_table_
11804         size.
11805         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11806         in constructor.  Add global_offset_table_ field.
11807         (Target_x86_64::got_section): Set global_offset_table_.
11808         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11809         size.
11810
11811         * layout.cc (Layout::Layout): Initialize increase_relro_.
11812         (Layout::get_output_section): Add is_relro, is_last_relro, and
11813         is_first_non_relro parameters.  Change all callers.
11814         (Layout::choose_output_section): Likewise.
11815         (Layout::add_output_section_data): Likewise.
11816         (Layout::make_output_section): Likewise.
11817         (Layout::set_segment_offsets): Clear increase_relro when using a
11818         linker script.
11819         * layout.h (class Layout): Add increase_relro method.  Add
11820         increase_relro_ field.  Update declarations.
11821         * output.cc (Output_section::Output_section): Initialize
11822         is_last_relro_ and is_first_non_relro_.
11823         (Output_segment::add_output_section): Group relro sections is
11824         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11825         (Output_segment::maximum_alignment): Remove relro handling.
11826         (Output_segment::set_section_addresses): Add increase_relro
11827         parameter.  Change all callers.  Add initial alignment to align
11828         relro sections on separate page.  Remove old relro handling.
11829         (Output_segment::set_section_list_addresses): Remove in_relro
11830         parameter.  Change all callers.
11831         (Output_segment::set_offset): Add increase parameter.  Change all
11832         callers.  Remove old relro handling.
11833         * output.h (class Output_section): Add new methods: is_last_relro,
11834         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11835         Add is_last_relro_ and is_first_non_relro_ fields.
11836         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11837         Create separate .got.plt section.  Call increase_relro.
11838         * x86_64.cc (Target_x86_64::got_section): Likewise.
11839         * testsuite/relro_script_test.t: Add .got.plt.
11840
11841         PR 10450
11842         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11843         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11844         (Layout::finalize): Call set_dynamic_symbol_size.
11845         (Layout::set_dynamic_symbol_size): New function.
11846         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11847         set_dynamic_symbol_size.
11848
11849         PR 10450
11850         * output.h (class Output_section): Add is_entsize_zero_ field.
11851         * output.cc (Output_section::Output_section): Initialize
11852         is_entsize_zero_.
11853         (Output_section::set_entsize): If two different entsizes are
11854         requested, force it to zero.
11855         (Output_section::add_input_section): Set flags for .debug_str
11856         before updating section flags.  Set entsize.
11857         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11858         and SHF_STRING if all input sections have those flags.
11859
11860 2009-12-29   Rafael Espindola  <espindola@google.com>
11861
11862         * main.cc (main): Fix the sys time reporting.
11863         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11864         reporting.
11865
11866 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11867
11868         * options.cc (General_options::parse_version): Allow -v to exit
11869         without an error if there is nothing to link.
11870
11871 2009-12-29  Ian Lance Taylor  <iant@google.com>
11872
11873         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11874         using a version of gcc before 4.1.
11875         * configure: Rebuild.
11876
11877 2009-12-28  Chris Demetriou  <cgd@google.com>
11878
11879         * attributes.cc (Output_attributes_section_data::do_write): Use
11880         std::vector::front rather than std::vector::data.
11881
11882 2009-12-28  Ian Lance Taylor  <iant@google.com>
11883
11884         * symtab.h (class Symbol_table): Add enum Defined.
11885         * resolve.cc (Symbol_table::should_override): Add defined
11886         parameter.  Change all callers.  Test whether object is NULL
11887         before calling a method on it.
11888         (Symbol_table::report_resolve_problem): Add defined parameter.
11889         Change all callers.
11890         (Symbol_table::should_override_with_special): Likewise.
11891         * symtab.cc (Symbol_table::define_in_output_data): Add defined
11892         parameter.  Change all callers.
11893         (Symbol_table::do_define_in_output_data): Likewise.
11894         (Symbol_table::define_in_output_segment): Likewise.
11895         (Symbol_table::do_define_in_output_segment): Likewise.
11896         (Symbol_table::define_as_constant): Likewise.
11897         (Symbol_table::do_define_as_constant): Likewise.
11898         * script.h (class Symbol_assignment): Add is_defsym parameter to
11899         constructor; change all callers.
11900         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11901         parameter.  Change all callers.  Add is_defsym_ field.
11902         (class Parser_closure): Add parsing_defsym parameter to
11903         constructor; change all callers.  Add parsing_defsym accessor
11904         function.  Add parsing_defsym_ field.
11905
11906 2009-12-28  Ian Lance Taylor  <iant@google.com>
11907
11908         * gold.cc (queue_middle_tasks): Fix formatting.
11909         * object.cc (Relobj::is_section_name_included): Likewise.
11910
11911 2009-12-23  Ian Lance Taylor  <iant@google.com>
11912
11913         * i386.cc (Target_i386::do_calls_non_split): Recognize
11914         -fsplit-stack prologue for a function with a static chain.
11915         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11916         -fsplit-stack prologue when using %r11.
11917
11918 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
11919
11920         * options.cc (General_options::parse_version): Make -v continue and do
11921         the link like GNU ld does.
11922
11923 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
11924
11925         * Makefile.am (CCFILES): Add timer.cc.
11926         (HFILES): Add timer.h.
11927         * configure.ac: Check for sysconf and times.
11928         * main.cc: include timer.h.
11929         (main): Use Timer instead of get_run_time.
11930         * timer.cc: New.
11931         * timer.h: New.
11932         * workqueue.cc: include timer.h.
11933         (Workqueue::find_and_run_task):
11934         Report user, sys and wall time.
11935         * Makefile.in: Regenerate.
11936         * config.in: Regenerate.
11937         * configure: Regenerate.
11938
11939 2009-12-16  Doug Kwan  <dougkwan@google.com>
11940
11941         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11942         sections.
11943         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11944         relaxed input sections.
11945         * output.cc (Output_section::find_relaxed_input_section): Change
11946         return type to Output_relaxed_input_section pointer.  Adjust code
11947         for new type of relaxed_input_section_map_.
11948         * output.h (Output_section::find_relaxed_input_section): Change
11949         return type to Output_relaxed_input_section pointer.
11950         (Output_section::Output_relaxed_input_section_by_input_section_map):
11951         New type.
11952         (Output_section::relaxed_input_section_map_): Change type to
11953         Output_section::Output_relaxed_input_section_by_input_section_map.
11954         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11955         input section.
11956
11957 2009-12-15  Ian Lance Taylor  <iant@google.com>
11958
11959         * layout.cc (Layout::create_shstrtab): Only write out after input
11960         sections if we are compressing debug sections.
11961
11962 2009-12-15  Ian Lance Taylor  <iant@google.com>
11963
11964         * archive.cc (Archive::add_symbols): Only look up a symbol without
11965         a version if there is, in fact, a version.
11966
11967 2009-12-14  Ian Lance Taylor  <iant@google.com>
11968
11969         Revert -Wshadow changes, all changes from:
11970         2009-12-11  Doug Kwan  <dougkwan@google.com>
11971         2009-12-11  Nick Clifton  <nickc@redhat.com>
11972         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11973
11974 2009-12-11  Doug Kwan  <dougkwan@google.com>
11975
11976         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11977         due to -Wshadow.
11978         * attributes.cc (Object_attribute::size): Ditto.
11979         (Attributes_section_data::size): Ditto.
11980         (Attributes_section_data::Attributes_section_data): Ditto.
11981         (Output_attributes_section_data::do_write): Ditto.
11982         * attributes.h (Object_attribute::set_type): Ditto.
11983         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11984
11985 2009-12-11  Nick Clifton  <nickc@redhat.com>
11986
11987         * archive.cc: Fix shadowed variable warnings.
11988         * arm.cc: Likewise.
11989         * compressed_output.cc: Likewise.
11990         * compressed_output.h: Likewise.
11991         * configure: Likewise.
11992         * dwarf_reader.cc: Likewise.
11993         * dynobj.cc: Likewise.
11994         * dynobj.h: Likewise.
11995         * ehframe.cc: Likewise.
11996         * ehframe.h: Likewise.
11997         * errors.cc: Likewise.
11998         * expression.cc: Likewise.
11999         * fileread.cc: Likewise.
12000         * fileread.h: Likewise.
12001         * freebsd.h: Likewise.
12002         * i386.cc: Likewise.
12003         * icf.cc: Likewise.
12004         * incremental.h: Likewise.
12005         * layout.cc: Likewise.
12006         * layout.h: Likewise.
12007         * mapfile.cc: Likewise.
12008         * merge.cc: Likewise.
12009         * merge.h: Likewise.
12010         * object.cc: Likewise.
12011         * object.h: Likewise.
12012         * options.h: Likewise.
12013         * output.cc: Likewise.
12014         * output.h: Likewise.
12015         * parameters.cc: Likewise.
12016         * plugin.cc: Likewise.
12017         * powerpc.cc: Likewise.
12018         * reduced_debug_output.cc: Likewise.
12019         * reduced_debug_output.h: Likewise.
12020         * reloc.cc: Likewise.
12021         * reloc.h: Likewise.
12022         * resolve.cc: Likewise.
12023         * script-sections.cc: Likewise.
12024         * script.cc: Likewise.
12025         * script.h: Likewise.
12026         * sparc.cc: Likewise.
12027         * symtab.cc: Likewise.
12028         * symtab.h: Likewise.
12029         * target-select.cc: Likewise.
12030         * target-select.h: Likewise.
12031         * token.h: Likewise.
12032         * workqueue.cc: Likewise.
12033         * workqueue.h: Likewise.
12034         * x86_64.cc: Likewise.
12035
12036 2009-12-10  Doug Kwan  <dougkwan@google.com>
12037
12038         * arm.cc (attributes.h): New include.
12039         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12040         (Arm_relobj::~Arm_relobj): Delete object pointed by
12041         attributes_section_data_.
12042         (Arm_relobj::attributes_section_data): New method definition.
12043         (Arm_relobj::attributes_section_data_): New data member declaration.
12044         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12045         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12046         attributes_section_data_.
12047         (Arm_dynobj::attributes_section_data): New method definition.
12048         (Arm_dynobj::attributes_section_data_): New data member declaration.
12049         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12050         initialization value of may_use_blx_ to false.
12051         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12052         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12053         object attributes to compute results instead of hard-coding.
12054         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12055         Target_arm::get_secondary_compatible_arch,
12056         Target_arm::set_secondary_compatible_arch
12057         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12058         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12059         New method declarations.
12060         (Target_arm::get_aeabi_object_attribute): New method definition.
12061         (Target_arm::attributes_section_data_): New data member declaration.
12062         (read_arm_attributes_section): New template definition.
12063         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12064         (Arm_dynobj::do_read_symbols): Ditto.
12065         (Target_arm::do_finalize_sections): Merge attributes sections from
12066         input.  Check for BLX use after attributes section merging.
12067         Fix __exidx_start and __exidx_end visibility.  Create an
12068         .ARM.attributes section if necessary.
12069         (Target_arm::get_secondary_compatible_arch,
12070         Target_arm::set_secondary_compatible_arch,
12071         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12072         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12073         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12074         New method definitions.
12075
12076 2009-12-09  Ian Lance Taylor  <iant@google.com>
12077
12078         * plugin.cc (Plugin::load): Don't cast from void* to a function
12079         pointer.
12080
12081 2009-12-09  Ian Lance Taylor  <iant@google.com>
12082
12083         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12084         information fields.
12085
12086 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12087
12088         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12089         Replace two_file_shared_1.so with two_file_shared_2.so.
12090         * testsuite/Makefile.in: Regenerated.
12091
12092 2009-12-08  Doug Kwan  <dougkwan@google.com>
12093
12094         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12095         (HFILES): Add attributes.h and int_encoding.h.
12096         * Makefile.in: Regenerate.
12097         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12098         function definitions to int_encoding.cc
12099         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12100         prototypes to int_encoding.h
12101         * reduced_debug_output.cc (int_encoding.h): New include.
12102         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12103         function definitions to int_encoding.cc
12104         (insert_into_vector, read_from_pointer): Move template definitions to
12105         int_encoding.h
12106         * attributes.cc: New file.
12107         * attributes.h: New file.
12108         * int_encoding.cc: New file.
12109         * int_encoding.h: New file.
12110
12111 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12112
12113         PR gold/11055
12114         * incremental-dump.cc (dump_incremental_inputs): New.
12115         (main): Use dump_incremental_inputs.
12116
12117 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12118
12119         PR gold/10893
12120         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12121         checking elfcpp::STT_FUNC.
12122         (Target_i386::Relocate::relocate): Likewise.
12123         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12124
12125         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12126         symbols from shared libraries into normal FUNC symbols.
12127
12128         * symtab.h (Symbol): Add is_func and use it.
12129
12130 2009-12-05  Doug Kwan  <dougkwan@google.com>
12131
12132         * arm.cc (Target_arm::arm_info): Initialize new fields
12133         attributes_section and attributes_vendor.
12134         * i386.cc (Target_i386::i386_info): Same.
12135         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12136         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12137         fields attributes_section and attributes_vendor.
12138         * sparc.cc (Target_sparc::sparc_info): Same.
12139         * target.h (Target::attributes_section, Target::attributes_vendor,
12140         Target::is_attributes_section, Target::attribute_arg_type,
12141         Target::attributes_order): New method definitions.
12142         (Target::Target_info::attributes_section,
12143         Target::Target_info::attributes_vendor): New fields.
12144         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12145         virtual method definitions.
12146         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12147         attributes_section and attributes_vendor.
12148         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12149
12150 2009-12-05  Doug Kwan  <dougkwan@google.com>
12151
12152         * arm.cc: Update comments about interworking and stub generation.
12153         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12154         considered as non-PIC.
12155         (Arm_relocate_functions::base_abs): Fix formatting.
12156         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12157         of function to use GOT entry address instead of offset.
12158         (Target_arm::Scan::global): Issue an error if a symbol would need a
12159         PLT does not get one because it is untyped.  Remove code to create
12160         dynamic symbols for relative branches.
12161         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12162         takes unsigned integer instead of boolean.
12163
12164 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12165
12166         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12167         (two_file_test_LDADD): Likewise.
12168         (common_test_1_LDADD): Likewise.
12169         (exception_test_LDADD) Likewise.
12170         (weak_test_LDADD): Likewise.
12171         (many_sections_test_LDADD): Likewise.
12172         (initpri1_LDADD): Likewise.
12173         (script_test_1_LDADD): Likewise.
12174         (script_test_2_LDADD): Likewise.
12175         (justsyms_LDADD): Likewise.
12176         (binary_test_LDADD): Likewise.
12177         (large_LDADD): Likewise.
12178         * testsuite/Makefile.in: Regenerated.
12179
12180 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12181
12182         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12183         (Symbol_table::override_with_special): Likewise.
12184         (Symbol_table::add_from_object): Likewise.
12185
12186 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12187
12188         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12189         Don't set the data_offset twice.
12190
12191 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12192
12193         * testsuite/Makefile.in: Regenerate.
12194
12195 2009-12-03  Doug Kwan  <dougkwan@google.com>
12196
12197         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12198         (Target_arm::do_finalize_sections): Add parameter for symbol table
12199         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12200         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12201         parameter for symbol table pointer.
12202         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12203         an additional parameter for a pointer to symbol table.
12204         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12205         parameter for a symbol table pointer.
12206         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12207         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12208         Ditto.
12209         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12210         parameter for a symbol table pointer.
12211
12212 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12213
12214         * incremental.cc (Incremental_inputs_header)
12215         (Incremental_inputs_header_write, Incremental_inputs_entry)
12216         (Incremental_inputs_entry_write): Move ...
12217         * incremental.h (Incremental_inputs_header)
12218         (Incremental_inputs_header_write, Incremental_inputs_entry)
12219         (Incremental_inputs_entry_write): here.
12220
12221 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12222
12223         * incremental.cc (make_sized_incremental_binary): Set the target.
12224         Error if it is incompatible.
12225         * output.h (Output_file): Add filename method.
12226
12227 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12228
12229         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12230         from the get_* methods.
12231
12232 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12233
12234         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12235         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12236         Write 0 for the data_offset of scripts.
12237
12238 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12239
12240         * testsuite/Makefile.am: Add the incremental_test.sh test.
12241         * testsuite/incremental_test.sh: New.
12242         * testsuite/incremental_test_1.c: New.
12243         * testsuite/incremental_test_2.c: New.
12244
12245 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12246
12247         * incremental-dump.cc (main): Fix typos.
12248
12249 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12250
12251         PR gold/11025
12252         * incremental-dump.cc (main): Use llu to print 64 bit values.
12253
12254 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12255             H.J. Lu  <hongjiu.lu@intel.com>
12256
12257         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12258         $(LIBDL).
12259         (incremental_dump_LDADD): Likewise.
12260         * Makefile.in: Regenerated.
12261
12262 2009-11-25  Doug Kwan  <dougkwan@google.com>
12263
12264         Revert:
12265
12266         2009-11-25  Doug Kwan  <dougkwan@google.com>
12267
12268                 * arm.cc (Target_arm::Target_arm): Move method definition
12269                 outside of class definition.  Add code to handle
12270                 --target1-rel, --target1-abs and --target2= options.
12271                 (Target_arm::get_reloc_reloc_type): Change method to be
12272                 non-static and const.
12273                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12274                 New data member declaration.
12275                 (Target_arm::Scan::local, Target_arm::Scan::global,
12276                 Target_arm::Relocate::relocate,
12277                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12278                 Adjust call to Target_arm::get_real_reloc_type.
12279                 (Target_arm::get_real_reloc_type): Use command line options
12280                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12281                 * options.h (--target1-rel, --target1-abs, --target2): New
12282                 ARM-only options.
12283
12284 2009-11-25  Doug Kwan  <dougkwan@google.com>
12285
12286         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12287         class definition.  Add code to handle --target1-rel, --target1-abs
12288         and --target2= options.
12289         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12290         and const.
12291         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12292         member declaration.
12293         (Target_arm::Scan::local, Target_arm::Scan::global,
12294         Target_arm::Relocate::relocate,
12295         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12296         call to Target_arm::get_real_reloc_type.
12297         (Target_arm::get_real_reloc_type): Use command line options to
12298         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12299         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12300         options.
12301
12302 2009-11-25  Doug Kwan  <dougkwan@google.com>
12303
12304         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12305         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12306         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12307         formatting.
12308         (Arm_relocate_functions::thm_call): Replace body with a call to
12309         Arm_relocate_functions::thumb_branch_common.
12310         (Arm_relocate_functions::thm_jump24,
12311         Arm_relocate_functions::thm_xpc22): New method definitions.
12312         (Arm_relocate_functions::thumb_branch_common): New method definition.
12313         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12314         operator.
12315         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12316         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12317
12318 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12319
12320         * Makefile.am: Build incremental-dump
12321         * Makefile.in: Regenerate.
12322         * incremental-dump.cc: New.
12323         * incremental.cc (Incremental_inputs_header_data,
12324         Incremental_inputs_entry_data): Move to incremental.h
12325         * incremental.h: (Incremental_inputs_header_data,
12326         Incremental_inputs_entry_data): Move from incremental.cc
12327
12328 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12329
12330         * incremental.cc (Incremental_inputs_header,
12331         Incremental_inputs_header_write, Incremental_inputs_entry,
12332         Incremental_inputs_entry_write): Add a typedef with the data type.
12333
12334 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12335
12336         * incremental.cc (Incremental_inputs_header,
12337         Incremental_inputs_header_write, Incremental_inputs_entry,
12338         Incremental_inputs_entry_write): Update comment about which
12339         type has the filed descriptions.
12340
12341 2009-11-15  Doug Kwan  <dougkwan@google.com>
12342
12343         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12344         (Arm_relocate_functions::arm_branch_common): Change method defintion
12345         in class definition to a method declaration and update list of formal
12346         parameters.
12347         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12348         Arm_relocation_functions::jump24): Adjust call to
12349         Arm_relocate_functions::arm_branch_common.  Update list of formal
12350         parameters.
12351         (Arm_relocate_functions::xpc25): New method definition.
12352         (Arm_relocate_functions::arm_branch_common): Move method defintion
12353         out from class definition.  Use stubs for mode-switching and extending
12354         branch ranges.
12355         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12356         specially.  Change code to enable use of stubs in ARM branches.
12357
12358 2009-11-10  Doug Kwan  <dougkwan@google.com>
12359
12360         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12361         in method declaration.
12362         (Target_arm::relocate_stub): New method declaration.
12363         (Target_arm::default_target): Change to return a pointer instead of
12364         a const reference.
12365         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12366         Target_arm::default_target.
12367         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12368         method definition.
12369         (Target_arm::relocate_section): Adjust view.
12370         (Target_arm::relocate_stub): New method definition.
12371
12372 2009-11-10  Doug Kwan  <dougkwan@google.com>
12373
12374         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12375         a format warning.
12376         * incremental.cc (open_incremental_binary): Initialized local
12377         variables to avoid warnings.
12378         * object.cc (make_elf_object): Ditto.
12379         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12380         a format warning.
12381
12382 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12383
12384         PR gold/10930
12385         * testsuite/plugin_test.c: Include "config.h".
12386
12387 2009-11-09  Doug Kwan  <dougkwan@google.com>
12388
12389         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12390         (arm_symbol_value): Remove.
12391         (Arm_relocate_functions::arm_branch_common,
12392         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12393         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12394         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12395         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12396         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12397         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12398         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12399         Arm_relocate_functions::thm_mobw_abs_nc,
12400         Arm_relocate_functions::thm_mov_abs,
12401         Arm_relocate_functions::movw_prel_nc,
12402         Arm_relocate_functions::thm_movt_abs,
12403         Arm_relocate_functions::movt_prel,
12404         Arm_relocate_functions::thm_movw_prel_nc,
12405         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12406         (Target_arm::Relocate::relocate): Only decompose address into two
12407         parts if relocation type uses the thumb-bit and pass the actual
12408         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12409         calls to methods in Arm_relocate_functions for this change.
12410
12411 2009-11-08  Ian Lance Taylor  <iant@google.com>
12412
12413         PR 10925
12414         * reloc.cc: Instantiate
12415         Sized_relobj::initialize_input_to_output_maps and
12416         Sized_relobj:free_input_to_output_maps.
12417
12418 2009-11-06  Ian Lance Taylor  <iant@google.com>
12419
12420         PR 10876
12421         * defstd.cc (in_segment): Set only_if_ref true for "end".
12422
12423 2009-11-06  Doug Kwan  <dougkwan@google.com>
12424
12425         * arm.cc (class Reloc_stub): Correct a comment.
12426         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12427         (Target_arm::scan_section_for_stubs): New method declaration.
12428         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12429         Change methods from private to protected.
12430         (Target_arm::do_may_relax): New method definition.
12431         (Target_arm::do_relax, Target_arm::group_sections,
12432         Target_arm::scan_reloc_for_stub,
12433         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12434         (Target_arm::arm_input_section_map_): New data member declaration.
12435         (Target_arm::scan_reloc_for_stub,
12436         Target_arm::scan_reloc_section_for_stubs,
12437         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12438         Target_arm::do_relax): New method definitions.
12439
12440 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12441
12442         * configure.ac: Check for (struct stat)::st_mtim
12443         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12444         * config.in: Regenerate.
12445         * configure: Regenerate.
12446
12447 2009-11-05  Ian Lance Taylor  <iant@google.com>
12448
12449         PR 10910
12450         * output.cc (Output_segment::add_output_section): Add missing
12451         return statement.
12452
12453 2009-11-04  Ian Lance Taylor  <iant@google.com>
12454
12455         PR 10880
12456         * object.h (class Object): Add is_needed and set_is_needed
12457         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12458         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12459         defined in a dynamic object and referenced by a regular object,
12460         set is_needed for the dynamic object.
12461         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12462         if the file is marked with as_needed and it is not needed.
12463
12464 2009-11-04  Ian Lance Taylor  <iant@google.com>
12465
12466         PR 10887
12467         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12468         tags if data is discarded by linker script.
12469         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12470         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12471         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12472         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12473
12474 2009-11-04  Ian Lance Taylor  <iant@google.com>
12475
12476         * layout.cc (Layout::get_output_section): Add is_interp and
12477         is_dynamic_linker_section parameters.  Change all callers.
12478         (Layout::choose_output_section): Likewise.
12479         (Layout::make_output_section): Likewise.
12480         (Layout::add_output_section_data): Add is_dynamic_linker_section
12481         parameter.  Change all callers.
12482         * layout.h (class Layout): Update declarations.
12483         * output.h (class Output_section): Add is_interp, set_is_interp,
12484         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12485         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12486         generate_code_fills_at_write_ to a bitfield.
12487         * output.cc (Output_section::Output_sections): Initialize new
12488         fields.
12489         (Output_segment::add_output_section): Add do_sort parameter.
12490         Change all callers.
12491
12492 2009-11-03  Ian Lance Taylor  <iant@google.com>
12493
12494         PR 10860
12495         * options.h (class General_options): Add --warn-common.
12496         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12497         merging two common symbols.
12498         (Symbol_table::should_override): Handle --warn-common when merging
12499         a common symbol with a defined symbol.  Use report_resolve_problem
12500         for multiple definitions.
12501         (Symbol_table::report_resolve_problem): New function.
12502         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12503
12504 2009-11-03  Doug Kwan  <dougkwan@google.com>
12505
12506         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12507         stub_factory_.
12508         (Target_arm::stub_factory): New method definition.
12509         (Target_arm::new_arm_input_section,
12510         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12511         Target_arm::reloc_uses_thumb_bit): New method declarations.
12512         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12513         New type definitions.
12514         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12515         member declarations.
12516         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12517         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12518         New method definitions.
12519
12520 2009-11-03  Ian Lance Taylor  <iant@google.com>
12521
12522         * options.h (class General_options): Add --warn_constructors.
12523
12524 2009-11-03  Ian Lance Taylor  <iant@google.com>
12525
12526         PR 10893
12527         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12528         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12529
12530 2009-11-03  Ian Lance Taylor  <iant@google.com>
12531
12532         PR 10895
12533         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12534         --msgid-bugs-address.
12535         (install-pdf): New target.
12536         (install-data_yes): Look up one directory to find mkinstalldirs.
12537
12538 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12539
12540         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12541         tree.
12542
12543 2009-10-30  Doug Kwan  <dougkwan@google.com>
12544
12545         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12546
12547 2009-10-30  Doug Kwan  <dougkwan@google.com>
12548
12549         * arm.cc (Stub_addend_reader): New struct template definition
12550         and partial specializations.
12551         (Stub_addend_reader::operator()): New method definition for a
12552         partially specialized template.
12553
12554 2009-10-30  Doug Kwan  <dougkwan@google.com>
12555
12556         * arm.cc (Arm_relobj::processor_specific_flags): New method
12557         definition.
12558         (Arm_relobj::do_read_symbols): New method declaration.
12559         (Arm_relobj::processor_specific_flags_): New data member declaration.
12560         (Arm_dynobj): New class definition.
12561         (Target_arm::do_finalize_sections): Add input_objects parameter.
12562         (Target_arm::do_adjust_elf_header): New method declaration.
12563         (Target_arm::are_eabi_versions_compatible,
12564         (Target_arm::merge_processor_specific_flags): New method declaration.
12565         (Target_arm::do_make_elf_object): New overloaded method definitions
12566         and declaration.
12567         (Arm_relobj::do_read_symbols): New method definition.
12568         (Arm_dynobj::do_read_symbols): Ditto.
12569         (Target_arm::do_finalize_sections): Add input_objects parameters.
12570         Merge processor-specific flags from all input objects.
12571         (Target_arm::are_eabi_versions_compatible,
12572         Target_arm::merge_processor_specific_flags,
12573         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12574         New method definitions.
12575         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12576         Input_objects pointer type parameter.
12577         * layout.cc (Layout::finalize): Pass input objects to target's.
12578         finalize_sections function.
12579         * output.cc (Output_file_header::do_sized_write): Set ELF file
12580         header's processor-specific flags.
12581         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12582         Input_objects pointer type parameter.
12583         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12584         * target.h (Input_objects): New forward class declaration.
12585         (Target::processor_specific_flags,
12586         Target::are_processor_specific_flags_sect): New method definitions.
12587         (Target::finalize_sections): Add input_objects parameter.
12588         (Target::Target): Initialize processor_specific_flags_ and
12589         are_processor_specific_flags_set_.
12590         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12591         parameter.
12592         (Target::set_processor_specific_flags): New method definition.
12593         (Target::processor_specific_flags_,
12594         Target::are_processor_specific_flags_set_): New data member
12595         declarations.
12596         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12597         Input_objects pointer type parameter.
12598
12599 2009-10-30  Doug Kwan  <dougkwan@google.com>
12600
12601         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12602
12603 2009-10-28  Ian Lance Taylor  <iant@google.com>
12604
12605         * object.h (class Relobj): Drop options parameter from
12606         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12607         do_scan_relocs, do_relocate.  Change all callers.
12608         (class Sized_relobj): Drop options parameters from
12609         do_gc_process_relocs, do_scan_relocs, do_relocate,
12610         do_relocate_sections, relocate_sections, emit_relocs_scan,
12611         emit_relocs_scan_reltype.  Change all callers.
12612         (struct Relocate_info): Remove options field and all references to
12613         it.
12614         * reloc.h (class Read_relocs): Remove options constructor
12615         parameter and options_ field.  Change all callers.
12616         (class Gc_process_relocs, class Scan_relocs): Likewise.
12617         (class Relocate_task): Likewise.
12618         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12619         all callers.
12620         (scan_relocatable_relocs): Likewise.
12621         * target.h (class Sized_target): Remove options parameter from
12622         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12623         all callers.
12624         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12625         callers.
12626         * arm.cc: Update functions to remove options parameters.
12627         * i386.cc: Likewise.
12628         * powerpc.cc: Likewise.
12629         * sparc.cc: Likewise.
12630         * x86_64.cc: Likewise.
12631         * testsuite/testfile.cc: Likewise.
12632
12633 2009-10-28  Doug Kwan  <dougkwan@google.com>
12634
12635         * arm.cc (Arm_relobj): New class definition.
12636         (Arm_relobj::scan_sections_for_stubs,
12637         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12638         New method definitions.
12639
12640 2009-10-28  Cary Coutant  <ccoutant@google.com>
12641
12642         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12643         (Plugin::cleanup_done_): New member.
12644         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12645         (Plugin_manager::cleanup_done_): Remove.
12646         (Plugin_manager::add_input_file): Edit error message.
12647         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12648         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12649
12650 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12651
12652         * fileread.cc: (File_read::View::~View): Use the new
12653         data_ownership_ filed.
12654         (File_read::~File_read): Dispose the new whole_file_view_.
12655         (File_read::open): Mmap the whole file if needed.
12656         (File_read::open): Use whole_file_view_ instead of contents_.
12657         (File_read::find_view): Use whole_file_view_ if applicable.
12658         (File_read::do_read): Use whole_file_view_ instead of contents_.
12659         (File_read::make_view): Use whole_file_view_ instead of contents_,
12660         update File_read::View::View call.
12661         (File_read::find_or_make_view): Update File_read::View::View
12662         call.
12663         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12664         remove contents_
12665         (File_read::View::Data_ownership): New enum.
12666         (File_read::View::View): Replace bool mapped_ with Data_ownership
12667         argument.
12668         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12669         (File_read::View::data_ownership_): New field.
12670         (File_read::contents_): Remove (replaced by whole_file_view_).
12671         (File_read::whole_file_view_): New field.
12672         * options.h (class General_options): Add --keep-files-mapped.
12673
12674 2009-10-27  Cary Coutant  <ccoutant@google.com>
12675
12676         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12677         * testsuite/Makefile.am (plugin_test_5): New test case.
12678         * testsuite/Makefile.in: Regenerate.
12679
12680 2009-10-25  Doug Kwan  <dougkwan@google.com>
12681
12682         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12683         from private to protected to allow access by child class.
12684         (Sized_relobj::do_relocate_sections): New method declaration.
12685         (Sized_relobj::relocate_sections): Virtualize.
12686         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12687         Sized_relobj::relocate_sections.  Instantiate template explicitly
12688         for different target sizes and endianity.
12689
12690 2009-10-24  Doug Kwan  <dougkwan@google.com>
12691
12692         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12693         (Arm_input_section::as_arm_input_section): New method.
12694         (Arm_output_section): New class definition.
12695         (Arm_output_section::create_stub_group,
12696         Arm_output_section::group_sections): New method definitions.
12697
12698 2009-10-22  Doug Kwan  <dougkwan@google.com>
12699
12700         * arm.cc (Arm_input_section): New class definition.
12701         (Arm_input_section::init, Arm_input_section:do_write,
12702         Arm_input_section::set_final_data_size,
12703         Arm_input_section::do_reset_address_and_file_offset): New method
12704         definitions.
12705
12706 2009-10-21  Doug Kwan  <dougkwan@google.com>
12707
12708         * arm.cc (Stub_table, Arm_input_section): New forward class
12709         declarations.
12710         (Stub_table): New class defintion.
12711         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12712         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12713         New method definition.
12714
12715 2009-10-21  Doug Kwan  <dougkwan@google.com>
12716
12717         * arm.cc: Update copyright comments.
12718         (Target_arm): New forward class template declaration.
12719         (Arm_address): New type.
12720         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12721         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12722         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12723         constants.
12724         (Insn_template): Same.
12725         (DEF_STUBS): New macro.
12726         (Stub_type): New enum type.
12727         (Stub_template): New class definition.
12728         (Stub): Same.
12729         (Reloc_stub): Same.
12730         (Stub_factory): Same.
12731         (Target_arm::Target_arm): Initialize may_use_blx_ and
12732         should_force_pic_veneer_.
12733         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12734         Target_arm::should_force_pic_veneer,
12735         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12736         Target_arm::using_thumb_only, Target_arm:;default_target): New
12737         method defintions.
12738         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12739         New data member declarations.
12740         (Insn_template::size, Insn_template::alignment): New method defintions.
12741         (Stub_template::Stub_template): New method definition.
12742         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12743         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12744         (Stub_factory::Stub_factory): New method definition.
12745         * gold.h (string_hash): New template.
12746         * output.h (Input_section_specifier::hash_value): Use
12747         gold::string_hash.
12748         (Input_section_specifier::string_hash): Remove.
12749         * stringpool.cc (Stringpool_template::string_hash): Use
12750         gold::string_hash.
12751
12752 2009-10-20  Doug Kwan  <dougkwan@google.com>
12753
12754         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12755         symbols of relaxed input sections.
12756         * output.h (Output_section::find_relaxed_input_section): Make
12757         method public.
12758
12759 2009-10-16  Doug Kwan  <dougkwan@google.com>
12760
12761         * dynobj.cc (Versions::Versions): Initialize version_script_.
12762         Only insert base version symbol definition for a shared object
12763         if version script defines any version versions.
12764         (Versions::define_base_version): New method definition.
12765         (Versions::add_def): Check that base version is not needed.
12766         (Versions::add_need): Define base version lazily.
12767         * dynobj.h (Versions::define_base_version): New method declaration.
12768         (Versions::needs_base_version_): New data member declaration.
12769         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12770         (check_DATA): Add no_version_test.stdout.
12771         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12772         New make rules.
12773         * testsuite/Makefile.in: Regenerate.
12774         * testsuite/no_version_test.c: New file.
12775         * testsuite/no_version_test.sh: Ditto.
12776
12777 2009-10-16  Doug Kwan  <dougkwan@google.com>
12778
12779         * expression.cc (class Segment_start_expression): New class definition.
12780         (Segment_start_expression::value): New method definition.
12781         (script_exp_function_segment_start): Return a new
12782         Segment_start_expression.
12783         * gold/script-c.h (script_saw_segment_start_expression): New function
12784         prototype.
12785         * script-sections.cc (Script_sections::Script_sections): Initialize
12786         SAW_SEGMENT_START_EXPRESSION_ to false.
12787         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12788         and -Tbbs options to specify section addresses if given in
12789         command line and no SEGMENT_START expression is seen in a script.
12790         * script-sections.h (Script_sections::saw_segment_start_expression,
12791         Script_sections::set_saw_segment_start_expression): New method
12792         definition.
12793         (Script_sections::saw_segment_start_expression_): New data member
12794         declaration.
12795         * script.cc (script_saw_segment_start_expression): New function.
12796         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12797         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12798         script_test_7.sh and script_test_8.sh.
12799         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12800         script_test_8.stdout.
12801         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12802         (script_test_6, script_test_6.stdout, script_test_7,
12803         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12804         * Makefile.in: Regenerate.
12805         * testsuite/script_test_6.sh: New file.
12806         * testsuite/script_test_6.t: Same.
12807         * testsuite/script_test_7.sh: Same.
12808         * testsuite/script_test_7.t: Same.
12809         * testsuite/script_test_8.sh: Same.
12810
12811 2009-10-16  Doug Kwan  <dougkwan@google.com>
12812
12813         * output.cc (Output_segment::set_section_list_address): Cast
12814         expressions to unsigned long long type to avoid format warnings.
12815
12816 2009-10-15  Ian Lance Taylor  <iant@google.com>
12817
12818         * script.cc (Script_options::add_symbol_assignment): Always add a
12819         dot assignment to script_sections_.
12820         * script-sections.cc (Script_sections::add_dot_assignment):
12821         Initialize if necessary.
12822
12823         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12824         program headers with no load segment if there is a linker script.
12825
12826         * layout.cc (Layout::set_segment_offsets): Align the file offset
12827         to the segment aligment for -N or -n with no load segment.
12828         * output.cc (Output_segment::add_output_section): Don't crash if
12829         the first section is a TLS section.
12830         (Output_segment::set_section_list_addresses): Print an error
12831         message if the address moves backward in a linker script.
12832         * script-sections.cc
12833         (Output_section_element_input::set_section_addresses): Don't
12834         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12835         (Orphan_output_section::set_section_addresses): Likewise.
12836
12837 2009-10-15  Doug Kwan  <dougkwan@google.com>
12838
12839         * layout.cc (Layout::finish_dynamic_section): Generate tags
12840         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12841         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12842         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12843
12844 2009-10-14  Ian Lance Taylor  <iant@google.com>
12845
12846         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12847         fields.
12848         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12849         data_shdr fields of relinfo.
12850         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12851         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12852         R_386_TLS_LDO_32, adjust based on section flags.
12853         (Target_i386::Relocate::fix_up_ldo): Remove.
12854
12855 2009-10-13  Ian Lance Taylor  <iant@google.com>
12856
12857         Add support for -pie.
12858         * options.h (class General_options): Add -pie and
12859         --pic-executable.
12860         (General_options::output_is_position_independent): Test -pie.
12861         (General_options::output_is_executable): Return true if not shared
12862         and not relocatable.
12863         (General_options::output_is_pie): Remove.
12864         * options.cc (General_options::finalize): Reject incompatible uses
12865         of -pie.
12866         * gold.cc (queue_middle_tasks): A -pie link is not static.
12867         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12868         * symtab.cc (Symbol::final_value_is_known): Return false if
12869         output_is_position_independent.
12870         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12871         output_is_position_independent.
12872         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12873         output_is_position_independent.
12874         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12875         output_is_position_independent.
12876         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12877         two_file_pie_test.
12878         (basic_pie_test.o, basic_pie_test): New targets.
12879         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12880         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12881         (two_file_pie_test): New target.
12882         * testsuite/Makefile.in: Rebuild.
12883         * README: Remove note saying that -pie is not supported.
12884
12885 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
12886
12887         * options.h (class General_options): Add -init and -fini.
12888         * layout.cc (Layout::finish_dynamic_section): Emit
12889         given init and fini functions.
12890
12891 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
12892
12893         * gc.h (gc_process_relocs): Check if icf is enabled using new
12894         function.
12895         * gold.cc (queue_initial_tasks): Likewise.
12896         (queue_middle_tasks): Likewise.
12897         * object.cc (do_layout): Likewise.
12898         * symtab.cc (is_section_folded): Likewise.
12899         * main.cc (main): Likewise.
12900         * reloc.cc (Read_relocs::run): Likewise.
12901         (Sized_relobj::do_scan_relocs): Likewise.
12902         * icf.cc (is_function_ctor_or_dtor): New function.
12903         (Icf::find_identical_sections): Check if function is ctor or dtor when
12904         safe icf is chosen.
12905         * options.h (General_options::icf): Change option to be an enum.
12906         (Icf_status): New enum.
12907         (icf_enabled): New method.
12908         (icf_safe_folding): New method.
12909         (set_icf_status): New method.
12910         (icf_status_): New variable.
12911         * (options.cc) (General_options::finalize): Set icf_status_.
12912         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12913         icf_test and icf_keep_unique_test to use the --icf enum flag.
12914         * testsuite/icf_safe_test.sh: New file.
12915         * testsuite/icf_safe_test.cc: New file.
12916
12917 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
12918
12919         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12920         includes to gc.h and icf.h.
12921         * arm.cc: Include gc.h.
12922         * gold.cc: Likewise.
12923         * i386.cc: Likewise.
12924         * powerpc.cc: Likewise.
12925         * sparc.cc: Likewise.
12926         * x86_64.cc: Likewise.
12927         * gc.h: Include icf.h.
12928
12929 2009-10-11  Ian Lance Taylor  <iant@google.com>
12930
12931         * plugin.cc: Include "gold.h" before other header files.
12932
12933 2009-10-10  Chris Demetriou  <cgd@google.com>
12934
12935         * options.h (Input_file_argument::Input_file_type): New enum.
12936         (Input_file_argument::is_lib_): Replace with...
12937         (Input_file_argument::type_): New member.
12938         (Input_file_argument::Input_file_argument): Take Input_file_type
12939         'type' rather than boolean 'is_lib' as second argument.
12940         (Input_file_argument::is_lib): Use type_.
12941         (Input_file_argument::is_searched_file): New function.
12942         (Input_file_argument::may_need_search): Handle is_searched_file.
12943         * options.cc (General_options::parse_library): Support -l:filename.
12944         (General_options::parse_just_symbols): Update for Input_file_argument
12945         changes.
12946         (Command_line::process): Likewise.
12947         * archive.cc (Archive::get_file_and_offset): Likewise.
12948         * plugin.cc (Plugin_manager::release_input_file): Likewise.
12949         * script.cc (read_script_file, script_add_file): Likewise.
12950         * fileread.cc (Input_file::Input_file): Likewise.
12951         (Input_file::will_search_for): Handle is_searched_file.
12952         (Input_file::open): Likewise.
12953         * readsyms.cc (Read_symbols::get_name): Likewise.
12954         * testsuite/Makefile.am (searched_file_test): New test.
12955         * testsuite/Makefile.in: Regenerate.
12956         * testsuite/searched_file_test.cc: New file.
12957         * testsuite/searched_file_test_lib.cc: New file.
12958
12959 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12960             Ian Lance Taylor  <iant@google.com>
12961
12962         * descriptor.cc: Include <cstdio> and "binary-io.h".
12963         (Descriptors::open): Open the files in binary mode always.
12964         * script.cc (Lex::get_token): Treat \r as whitespace.
12965
12966 2009-10-09  Ian Lance Taylor  <iant@google.com>
12967
12968         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12969
12970 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12971             Ian Lance Taylor  <iant@google.com>
12972
12973         * configure.ac: Check for readv function also.
12974         * fileread.cc (readv): Define if not HAVE_READV.
12975         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12976         does not exist.
12977         * config.in: Regenerate.
12978         * configure: Regenerate.
12979
12980 2009-10-09  Doug Kwan  <dougkwan@google.com>
12981
12982         * layout.cc (Layout::make_output_section): Call target hook to make
12983         ordinary output section.
12984         (Layout::finalize): Adjust parameter list of call the
12985         Target::may_relax().
12986         * layout.h (class Layout::section_list): New method.
12987         * merge.h (Output_merge_base::entsize): Change visibility to public.
12988         (Output_merge_base::is_string, Output_merge_base::do_is_string):
12989         New methods.
12990         (Output_merge_string::do_is_string): New method.
12991         * object.cc (Sized_relobj::do_setup): renamed from
12992         Sized_relobj::set_up.
12993         * object.h (Sized_relobj::adjust_shndx,
12994         Sized_relobj::initializ_input_to_output_maps,
12995         Sized_relobj::free_input_to_output_maps): Change visibilities to
12996         protected.
12997         (Sized_relobj::setup): Virtualize.
12998         (Sized_relobj::do_setup): New method declaration.
12999         (Sized_relobj::invalidate_section_offset,
13000         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13001         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13002         * options.cc (parse_int): New function.
13003         * options.h (parse_int): New declaration.
13004         (DEFINE_int): New macro.
13005         (stub_group_size): New option.
13006         * output.cc (Output_section::Output_section): Initialize memebers
13007         merge_section_map_, merge_section_by_properties_map_,
13008         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13009         (Output_section::add_input_section): Handled deferred code-fill
13010         generation and remove an old comment.
13011         (Output_section::add_relaxed_input_section): New method definition.
13012         (Output_section::add_merge_input_section): Use merge section by
13013         properties map to speed to search.  Update merge section maps
13014         as appropriate.
13015         (Output_section::build_relaxation_map): New method definition.
13016         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13017         Same.
13018         (Output_section::relax_input_section): Renamed to
13019         Output_section::convert_input_sections_to_relaxed_sections and change
13020         interface to take a vector of pointers to relaxed sections.
13021         (Output_section::find_merge_section,
13022         Output_section::find_relaxed_input_section): New method definitions.
13023         (Output_section::is_input_address_mapped,
13024         Output_section::output_offset, Output_section::output_address):
13025         Use output section data maps to speed up searching.
13026         (Output_section::find_starting_output_address): Add comments.
13027         (Output_section::do_write,
13028         Output_section::write_to_postprocessing_buffer): Do code-fill
13029         generation as appropriate.
13030         (Output_section::get_input_sections): Invalidate relaxed input section
13031         map.
13032         (Output_section::restore_states): Adjust type of checkpoint .
13033         Invalidate relaxed input section map.
13034         * output.h (Output_merge_base): New class declaration.
13035         (Input_section_specifier): New class defintion.
13036         (class Output_relaxed_input_section) Change base class to
13037         Output_section_data_build.
13038         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13039         base class initializer.
13040         (Output_section::add_relaxed_input_section): New method declaration.
13041         (Output_section::Input_section): Change visibility to protected.
13042         (Output_section::Input_section::relobj,
13043         Output_section::Input_section::shndx): Handle relaxed input sections.
13044         Output_section::input_sections) Change visibility to protected.  Also
13045         define overload to return a non-const pointer.
13046         (Output_section::Merge_section_properties): New class defintion.
13047         (Output_section::Merge_section_by_properties_map,
13048         Output_section::Output_section_data_by_input_section_map,
13049         Output_section::Relaxation_map): New types.
13050         (Output_section::relax_input_section): Rename method to
13051         Output_section::convert_input_sections_to_relaxed_sections and change
13052         interface to take a vector of relaxed section pointers.
13053         (Output_section::find_merge_section,
13054         Output_section::find_relaxed_input_section,
13055         Output_section::build_relaxation_map,
13056         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13057         New method declarations.
13058         (Output_section::merge_section_map_
13059         Output_section::merge_section_by_properties_map_,
13060         Output_section::relaxed_input_section_map_,
13061         Output_section::is_relaxed_input_section_map_valid_,
13062         Output_section::generate_code_fills_at_write_): New data members.
13063         * script-sections.cc
13064         (Output_section_element_input::set_section_addresses): Call
13065         current_data_size and addralign methods of relaxed input sections.
13066         (Orphan_output_section::set_section_addresses): Call current_data_size
13067         and addralign methods of relaxed input sections.
13068         * symtab.cc (Symbol_table::compute_final_value): Extract template
13069         from the body of Symbol_table::sized_finalize_symbol.
13070         (Symbol_table::sized_finalized_symbol): Call
13071         Symbol_table::compute_final_value.
13072         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13073         (Symbol_table::compute_final_value): New templated method declaration.
13074         * target.cc (Target::do_make_output_section): New method defintion.
13075         * target.h (Target::make_output_section): New method declaration.
13076         (Target::relax): Add more parameters for input objects, symbol table
13077         and layout.  Adjust call to do_relax.
13078         (Target::do_make_output_section): New method declaration.
13079         (Target::do_relax): Add parameters for input objects, symbol table
13080         and layout.
13081
13082 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13083
13084         * pread.c: Include stdio.h.
13085
13086 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13087
13088         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13089         defined.
13090
13091 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13092
13093         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13094         Change read_shndx type to unsigned int.
13095         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13096         int.
13097         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13098         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13099         Change read_shndx type to unsigned int.
13100         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13101         int.
13102         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13103         * layout.cc (Layout::create_symtab_sections): Cast the result of
13104         local_symcount * symsize to off_t in the gold_assert.
13105
13106 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13107
13108         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13109         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13110         R_ARM_BASE_ABS.
13111         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13112         (Arm_relocate_functions::thm_abs5): New function.
13113         (Arm_relocate_functions::abs12): New function.
13114         (Arm_relocate_functions::abs16): New function.
13115         (Arm_relocate_functions::base_abs): New function.
13116         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13117         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13118         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13119         R_ARM_BASE_ABS.
13120         (Scan::global): Likewise.
13121         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13122         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13123         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13124         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13125         R_ARM_BASE_ABS.
13126
13127 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13128
13129         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13130         (Arm_relocate_functions::movt_prel): New function.
13131         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13132         (Arm_relocate_functions::thm_movt_prel): New function.
13133         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13134         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13135         (Scan::global, Relocate::relocate): Likewise.
13136         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13137
13138 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13139
13140         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13141         Incremental_checker.
13142         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13143         unsigned int.
13144         (class Incremental_inputs_header): New class.
13145         (Incremental_inputs_header_writer): Edit comment.
13146         (Incremental_inputs_entry): New class.
13147         (Incremental_inputs_entry_writer): Edit comment.
13148         (Sized_incremental_binary::do_find_incremental_inputs_section):
13149         Add *strtab_shndx parameter, fill it.
13150         (Sized_incremental_binary::do_check_inputs): New method.
13151         (Incremental_checker::can_incrementally_link_output_file): Use
13152         Sized_incremental_binary::check_inputs.
13153         (Incremental_inputs::report_command_line): Save command line in
13154         command_line_.
13155         * incremental.h:
13156         (Incremental_binary::find_incremental_inputs_section): New
13157         method.
13158         (Incremental_binary::do_find_incremental_inputs_section): Add
13159         strtab_shndx parameter.
13160         (Incremental_binary::do_check_inputs): New pure virtual method.
13161         (Sized_incremental_binary::do_check_inputs): Declare.
13162         (Incremental_checker::Incremental_checker): Add incremental_inputs
13163         parameter, use it to initialize incremental_inputs_.
13164         (Incremental_checker::incremental_inputs_): New field.
13165         (Incremental_checker::command_line): New method.
13166         (Incremental_checker::inputs): New method.
13167         (Incremental_checker::command_line_): New field.
13168
13169 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13170
13171         * incremental.cc: Include <cstdarg> and "target-select.h".
13172         (vexplain_no_incremental): New function.
13173         (explain_no_incremental): New function.
13174         (Incremental_binary::error): New method.
13175         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13176         method.
13177         (make_sized_incremental_binary): New function.
13178         (open_incremental_binary): New function.
13179         (can_incrementally_link_file): Add checks if output is ELF and has
13180         inputs section.
13181         * incremental.h: Include "elfcpp_file.h" and "output.h".
13182         (Incremental_binary): New class.
13183         (Sized_incremental_binary): New class.
13184         (open_incremental_binary): Declare.
13185         * object.cc (is_elf_object): Use
13186         elfcpp::Elf_recognizer::is_elf_file.
13187         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13188         * output.h (Output_file::filesize): New method.
13189
13190 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13191
13192         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13193         New function.
13194         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13195         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13196         function.
13197         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13198         function.
13199         (Arm_relocate_functions::movw_abs_nc): New function.
13200         (Arm_relocate_functions::movt_abs): New function.
13201         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13202         (Arm_relocate_functions::thm_movt_abs): New function.
13203         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13204         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13205         (Scan::global): Likewise.
13206         (Relocate::relocate): Likewise.
13207         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13208
13209 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13210
13211         * arm.cc (Arm_relocate_functions::got_prel) New function.
13212         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13213         (Relocate::relocate): Likewise.
13214         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13215
13216 2009-10-06  Ian Lance Taylor  <iant@google.com>
13217
13218         * options.h (class General_options): Define
13219         split_stack_adjust_size parameter.
13220         * object.h (class Object): Add uses_split_stack_ and
13221         has_no_split_stack_ fields.  Add uses_split_stack and
13222         has_no_split_stack accessor functions.  Declare
13223         handle_split_stack_section.
13224         (class Reloc_symbol_changes): Define.
13225         (class Sized_relobj): Define Function_offsets.  Declare
13226         split_stack_adjust, split_stack_adjust_reltype, and
13227         find_functions.
13228         * object.cc (Object::handle_split_stack_section): New function.
13229         (Sized_relobj::do_layout): Call handle_split_stack_section.
13230         * dynobj.cc (Sized_dynobj::do_layout): Call
13231         handle_split_stack_section.
13232         * reloc.cc (Sized_relobj::relocate_sections): Call
13233         split_stack_adjust for executable sections in split_stack
13234         objects.  Pass reloc_map to relocate_section.
13235         (Sized_relobj::split_stack_adjust): New function.
13236         (Sized_relobj::split_stack_adjust_reltype): New function.
13237         (Sized_relobj::find_functions): New function.
13238         * target-reloc.h: Include "object.h".
13239         (relocate_section): Add reloc_symbol_changes parameter.  Change
13240         all callers.
13241         * target.h (class Target): Add calls_non_split method.  Declare
13242         do_calls_non_split virtual method.  Declare match_view and
13243         set_view_to_nop.
13244         * target.cc: Include "elfcpp.h".
13245         (Target::do_calls_non_split): New function.
13246         (Target::match_view): New function.
13247         (Target::set_view_to_nop): New function.
13248         * gold.cc (queue_middle_tasks): Give an error if mixing
13249         split-stack and non-split-stack objects with -r.
13250         * i386.cc (Target_i386::relocate_section): Add
13251         reloc_symbol_changes parameter.
13252         (Target_i386::do_calls_non_split): New function.
13253         * x86_64.cc (Target_x86_64::relocate_section): Add
13254         reloc_symbol_changes parameter.
13255         (Target_x86_64::do_calls_non_split): New function.
13256         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13257         parameter.
13258         * powerpc.cc (Target_powerpc::relocate_section): Add
13259         reloc_symbol_changes parameter.
13260         * sparc.cc (Target_sparc::relocate_section): Add
13261         reloc_symbol_changes parameter.
13262         * configure.ac: Call AM_CONDITIONAL for the default target.
13263         * configure: Rebuild.
13264         * testsuite/Makefile.am (TEST_AS): New variable.
13265         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13266         (check_DATA): Add split_i386 and split_x86_64 files.
13267         (SPLIT_DEFSYMS): Define.
13268         (split_i386_[1234n].o): New targets.
13269         (split_i386_[124]): New targets.
13270         (split_i386_[1234r].stdout): New targets.
13271         (split_x86_64_[1234n].o): New targets.
13272         (split_x86_64_[124]): New targets.
13273         (split_x86_64_[1234r].stdout): New targets.
13274         (MOSTLYCLEANFILES): Add new executables.
13275         * testsuite/split_i386.sh: New file.
13276         * testsuite/split_x86_64.sh: New file.
13277         * testsuite/split_i386_1.s: New file.
13278         * testsuite/split_i386_2.s: New file.
13279         * testsuite/split_i386_3.s: New file.
13280         * testsuite/split_i386_4.s: New file.
13281         * testsuite/split_i386_n.s: New file.
13282         * testsuite/split_x86_64_1.s: New file.
13283         * testsuite/split_x86_64_2.s: New file.
13284         * testsuite/split_x86_64_3.s: New file.
13285         * testsuite/split_x86_64_4.s: New file.
13286         * testsuite/split_x86_64_n.s: New file.
13287         * testsuite/testfile.cc (Target_test): Update relocation_section
13288         function.
13289         * testsuite/Makefile.in: Rebuild.
13290
13291 2009-10-06  Ian Lance Taylor  <iant@google.com>
13292
13293         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13294         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13295         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13296         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13297         the address on ldo_addrs_.
13298         (Target_i386::Relocate::fix_up_ldo): New function.
13299
13300 2009-10-06   Rafael Espindola  <espindola@google.com>
13301
13302         * plugin.cc (add_input_library): New.
13303         (Plugin::load): Add add_input_library to tv.
13304         (Plugin_manager::add_input_file): Add the is_lib argument.
13305         (add_input_file): Update call to Plugin_manager::add_input_file.
13306         (add_input_library): New.
13307         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13308
13309 2009-09-30  Doug Kwan  <dougkwan@google.com>
13310
13311         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13312         symbol and call Symbol::may_need_copy_reloc to determine if
13313         a copy reloc is needed.
13314         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13315         nocopyreloc is given in command line.
13316         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13317         given in command line.
13318         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13319         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13320         of the removed Target_i386::may_need_copy_reloc.
13321         * options.h (copyreloc): New option with default value false.
13322         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13323         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13324         instead of the removed Target_powerpc::may_need_copy_reloc.
13325         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13326         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13327         instead of the removed Target_sparc::may_need_copy_reloc.
13328         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13329         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13330         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13331         instead of the removed Target_x86_64::may_need_copy_reloc.
13332
13333 2009-09-30  Ian Lance Taylor  <iant@google.com>
13334
13335         * object.h (class Object): Remove target_ field, and target,
13336         sized_target, and set_target methods.
13337         (Object::sized_target): Remove.
13338         (class Sized_relobj): Update declarations.  Remove sized_target.
13339         * object.cc (Sized_relobj::setup): Remove target parameter.
13340         Change all callers.
13341         (Input_objects::add_object): Don't do anything with the target.
13342         (make_elf_sized_object): Add punconfigured parameter.  Change all
13343         callers.  Set or test parameter target.
13344         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13345         Change all callers.
13346         * parameters.cc (Parameters::set_target): Change parameter type to
13347         be non-const.
13348         (Parameters::default_target): Remove.
13349         (set_parameters_target): Change parameter type to be non-const.
13350         (parameters_force_valid_target): New function.
13351         (parameters_clear_target): New function.
13352         * parameters.h (class Parameters): Update declarations.  Remove
13353         default_target method.  Add sized_target and clear_target
13354         methods.  Change target_ to be non-const.
13355         (set_parameters_target): Update declaration.
13356         (parameters_force_valid_target): Declare.
13357         (parameters_clear_target): Declare.
13358         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13359         as NULL if we aren't searching.
13360         (Add_symbols::run): Don't check for compatible target.
13361         * fileread.cc (Input_file::open_binary): Call
13362         parameters_force_valid_target.
13363         * gold.cc (queue_middle_tasks): Likewise.
13364         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13365         set_target on object.
13366         * dynobj.h (class Sized_dynobj): Update declarations.
13367         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13368         make_elf_object returns NULL.
13369         (Archive::include_member): Don't check whether object target is
13370         compatible.
13371         * output.cc (Output_section::add_input_section): Get target from
13372         parameters.
13373         (Output_section::relax_input_section): Likewise.
13374         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13375         parameters.
13376         (Sized_relobj::do_scan_relocs): Likewise.
13377         (Sized_relobj::relocate_sections): Likewise.
13378         * resolve.cc (Symbol_table::resolve): Likewise.
13379         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13380         parameter.  Change all callers.
13381         (Symbol_table::add_from_object): Get target from parameters.
13382         (Symbol_table::add_from_relobj): Don't check object target.
13383         (Symbol_table::add_from_dynobj): Likewise.
13384         (Symbol_table::define_special_symbol): Get target from
13385         parameters.
13386         * symtab.h (class Symbol_table): Update declaration.
13387         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13388         parameter.  Change all callers.  Clear parameter target.
13389         (Binary_test): Test target here.
13390         * testsuite/object_unittest.cc (gold_testsuite): Remove
13391         target_test_pointer parameter.  Change all callers.
13392         (Object_test): Test target here.
13393
13394 2009-09-26  Ian Lance Taylor  <iant@google.com>
13395
13396         * testsuite/initpri1.c: Don't try to use constructor priorities if
13397         compiling with gcc before 4.3.
13398
13399 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13400
13401         * testsuite/retain_symbols_file_test.sh (check_present): Change
13402         output file name to retain_symbols_file_test.stdout.
13403         (check_absent): Likewise.
13404
13405 2009-09-18  Craig Silverstein  <csilvers@google.com>
13406
13407         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13408         * options.cc: Include <cerrno> and <fstream>.
13409         (General_options::finalize): Parse -retain-symbols-file tag.
13410         * options.h: New flag.
13411         (General_options): New method should_retain_symbol, new
13412         variable symbols_to_retain.
13413         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13414         should_retain_symbol map.
13415         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13416         * testsuite/Makefile.in: Regenerate.
13417         * testsuite/retain_symbols_file_test.sh: New file.
13418
13419 2009-09-18  Nick Clifton  <nickc@redhat.com>
13420
13421         * po/es.po: Updated Spanish translation.
13422
13423 2009-09-17  Doug Kwan  <dougkwan@google.com>
13424
13425         * debug.h (DEBUG_RELAXATION): New constant.
13426         (DEBUG_ALL): Add DEBUG_RELAXATION.
13427         (debug_string_to_enum): Add relaxation debug option.
13428         * layout.cc
13429         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13430         Layout::Relaxation_debug_check::read_sections,
13431         Layout::Relaxation_debug_check::read_sections): New method definitions.
13432         (Layout::Layout): Initialize data members
13433         record_output_section_data_from_scrips_,
13434         script_output_section_data_list_ and relaxation_debug_check_.
13435         (Layout::save_segments, Layout::restore_segments,
13436         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13437         Layout::relaxation_loop_body): New method definitions.
13438         (Layout::finalize): Support relaxation.  Move section layout code to
13439         Layout::relaxation_loop_body.
13440         (Layout::set_asection_address_from_script): Move code for orphan
13441         section placement out.
13442         (Layout::place_orphan_sections_in_script): New method definition.
13443         * layout.h (Output_segment_headers, Output_file_header):
13444         New forward class declarations.
13445         (Layout::~Layout): Define.
13446         (Layout::new_output_section_data_from_script): New method definition.
13447         (Layout::place_orphan_sections_in_script): New method declaration.
13448         (Layout::Segment_states): New type declaration.
13449         (Layout::save_segments, Layout::restore_segments,
13450         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13451         Layout::relaxation_loop_body): New method declarations.
13452         (Layout::Output_section_data_list): New type declaration.
13453         (Layout::Relaxation_debug_check): New class definition.
13454         (Layout::record_output_section_data_from_script_,
13455         Layout::script_output_section_data_list_, Layout::segment_states_,
13456         Layout::relaxation_debug_check_): New data members.
13457         * output.cc: (Output_section_headers::do_size): New method definition.
13458         (Output_section_headers::Output_section_headers): Move size
13459         computation to Output_section_headers::do_size.
13460         (Output_segment_headers::do_size): New method definition.
13461         (Output_file_header::Output_file_header): Move size computation to
13462         Output_file_header::do_size and call it.
13463         (Output_file_header::do_size): New method definition.
13464         (Output_data_group::Output_data_group): Adjust call to
13465         Output_section_data.
13466         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13467         (Output_symtab_xindex::do_write): Add array bound check.
13468         (Output_section::Input_section::print_to_mapfile): Handle
13469         RELAXED_INPUT_SECTION_CODE.
13470         (Output_section::Output_section): Initialize data member checkpoint_.
13471         (Output_section::~Output_section): Delete checkpoint object pointed
13472         by checkpoint_.
13473         (Output_section::add_input_section): Always add an Input_section if
13474         relaxing.
13475         (Output_section::add_merge_input_section): Add assert.
13476         (Output_section::relax_input_section): New method definition.
13477         (Output_section::set_final_data_size): Set load address to zero for
13478         an unallocated section.
13479         (Output_section::do_address_and_file_offset_have_reset_values):
13480         New method definition.
13481         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13482         Handle relaxed input section.
13483         (Output_section::sort_attached_input_sections): Checkpoint input
13484         section list lazily.
13485         (Output_section::get_input_sections): Change type of input_sections to
13486         list of Simple_input_section pointers.  Checkpoint input section list
13487         lazily.  Also handle relaxed input sections.
13488         (Output_section::add_input_section_for_script): Take a reference to
13489         a Simple_input_section object instead of Relobj pointer and section
13490         index as parameter.  Handle relaxed input sections.
13491         (Output_section::save_states, Output_section::restore_states): New
13492         method definitions.
13493         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13494         (Output_data::is_data_size_fixed): New method definition.
13495         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13496         if it is fixed.
13497         (Output_data::address_and_file_offset_have_reset_values): New method
13498         definition.
13499         (Output_data::do_address_and_file_offset_have_reset_values): New method
13500         definition.
13501         (Output_data::set_data_size): Check that data size is not fixed.
13502         (Output_data::fix_data_size): New method definition.
13503         (Output_data::is_data_size_fixed_): New data member.
13504         (Output_section_headers::set_final_data_size): New method definition.
13505         (Output_section_headers::do_size): New method declaration.
13506         (Output_segment_headers::set_final_data_size): New method definition.
13507         (Output_segment_headers::do_size): New method declaration.
13508         (Output_file_header::set_final_data_size)::New method definition.
13509         (Output_file_header::do_size)::New method declaration.
13510         (Output_section_data::Output_section_data): Add new parameter
13511         is_data_size_fixed and use it to fix data size.
13512         (Output_data_const::Output_data_const): Adjust call to base class
13513         constructor and fix data size.
13514         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13515         base class constructor and fix data size.
13516         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13517         base class constructor and fix data size.
13518         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13519         class constructor and fix data size.
13520         (Output_data_group::set_final_data_size): New method definition.
13521         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13522         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13523         class constructor and fix data size.
13524         (Output_relaxed_input_section): New class definition.
13525         (Output_section::Simple_input_section): New class definition.
13526         (Output_section::get_input_sections): Adjust parameter list.
13527         (Output_section::add_input_section_for_script): Same.
13528         (Output_section::save_states, Output_section::restore_states,
13529         Output_section::do_address_and_file_offset_have_reset_values,
13530         (Output_section::Input_section::Input_section): Handle
13531         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13532         Output_relaxed_input_section.
13533         (Output_section::Input_section::is_input_section,
13534         Output_section::Input_section::set_output_section): Handle relaxed
13535         input section.
13536         (Output_section::Input_section::is_relaxed_input_section,
13537         Output_section::Input_section::output_section_data,
13538         Output_section::Input_section::relaxed_input_section): New method
13539         definitions.
13540         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13541         value.
13542         (Output_section::Input_section::u1_): Update comments.
13543         (Output_section::Input_section::u2_): Add new union member poris.
13544         (Output_section::Checkpoint_output_section): New classs definition.
13545         (Output_section::relax_input_section): New method declaration.
13546         (Output_section::checkpoint_): New data member.
13547         (Output_segment): Update comments.
13548         (Output_segment::Output_segment): Un-privatize copy constructor.
13549         (Output_segment::operator=): Un-privatize.
13550         * script-sections.cc (Output_section_element::Input_section_list):
13551         Change element type to Output_section::Simple_input_section.
13552         (Output_section_element_dot_assignment::set_section_addresses):
13553         Register output section data for relaxation clean up.
13554         (Output_data_exression::Output_data_expression): Adjust call to base
13555         constructor to fix data size.
13556         (Output_section_element_data::set_section_addresses): Register
13557         Output_data_expression object for relaxation clean up.
13558         (struct Input_section_info): Replace Relobj pointer and section index
13559         pair with Output_section::Simple_input_section and Convert struct to a
13560         class.
13561         (Input_section_sorter::operator()): Adjust access to
13562         Input_section_info data member to use accessors.
13563         (Output_section_element_input::set_section_addresses): Use layout
13564         parameter.  Adjust code to use Output_section::Simple_input_section
13565         and Input_secction_info classes.  Register filler for relaxation
13566         clean up.
13567         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13568         and section index pair with Output_section::Simple_input_section
13569         class.  Adjust code accordingly.
13570         (Phdrs_element::release_segment): New method definition.
13571         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13572         segment list.
13573         (Script_sections::release_segments): New method definition.
13574         * gold/script-sections.h (Script_sections::release_segments): New
13575         method declaration.
13576         * gold/target.h (Target::may_relax, Target::relax,
13577         Target::do_may_relax, Target::do_relax): New method definitions.
13578
13579 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13580
13581         * arm.cc (has_signed_unsigned_overflow): New function.
13582         (Arm_relocate_functions::abs8): New function.
13583         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13584         (Target_arm::Scan::global): Likewise.
13585         (Target_arm::relocate::relocate): Likewise.
13586         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13587         Likewise.
13588
13589 2009-09-16  Cary Coutant  <ccoutant@google.com>
13590
13591         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13592         * testsuite/Makefile.in: Regenerate.
13593
13594 2009-09-11  Nick Clifton  <nickc@redhat.com>
13595
13596         * po/gold.pot: Updated by the Translation project.
13597
13598 2009-09-08  Cary Coutant  <ccoutant@google.com>
13599
13600         * output.cc (Output_file::open): Add execute permission to empty file.
13601         * testsuite/Makefile.am (permission_test): New test.
13602         * testsuite/Makefile.in: Regenerate.
13603
13604 2009-09-02  Ian Lance Taylor  <iant@google.com>
13605
13606         * output.cc (Output_file::resize): Call map_no_anonymous rather
13607         than map.
13608
13609 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13610
13611         * gold.cc: Include "incremental.h".
13612         (queue_initial_tasks): Call Incremental_checker methods.
13613         * incremental.cc: Include "output.h".
13614         (Incremental_checker::can_incrementally_link_output_file): New
13615         method.
13616         * incremental.h (Incremental_checker): New class.
13617
13618         * output.cc (Output_file::open_for_modification): New method.
13619         (Output_file::map_anonymous): Changed return type to bool.  Record
13620         map in base_ field.
13621         (Output_file::map_no_anonymous): New method, broken out of map.
13622         (Output_file::map): Use map_no_anonymous and map_anonymous.
13623         * output.h (class Output_file): Update declarations.
13624
13625 2009-08-24  Cary Coutant  <ccoutant@google.com>
13626
13627         * options.h (Command_line::Pre_options): New class.
13628         (Command_line::pre_options): New member.
13629         * options.cc (gold::options::ready_to_register): New variable.
13630         (One_option::register_option): Do nothing if not registering options.
13631         Assert if same short option registered twice.
13632         (General_options::General_options): Turn off option registration when
13633         done constructing.
13634         (Command_line::Pre_options::Pre_options): New constructor.
13635
13636 2009-08-24  Cary Coutant  <ccoutant@google.com>
13637
13638         * options.h (General_options::no_keep_memory): Remove incorrect
13639         short option.
13640
13641 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13642
13643         * Makefile.am (am__skiplex, am__skipyacc): New.
13644         * Makefile.in: Regenerate.
13645
13646 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13647
13648         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13649         (INCLUDES): ... this.
13650         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13651         (AM_CPPFLAGS): Renamed from ...
13652         (INCLUDE): ... this.
13653         * Makefile.in, testsuite/Makefile.in: Regenerate.
13654
13655         * Makefile.in: Regenerate.
13656         * aclocal.m4: Likewise.
13657         * config.in: Likewise.
13658         * configure: Likewise.
13659         * testsuite/Makefile.in: Likewise.
13660
13661         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13662         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13663         * Makefile.in: Regenerate.
13664         * testsuite/Makefile.in: Regenerate.
13665
13666 2009-08-19  Cary Coutant  <ccoutant@google.com>
13667
13668         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13669         symbols in shared libraries overridden by hidden or internal symbols
13670         in the main program.
13671
13672 2009-08-19  Chris Demetriou  <cgd@google.com>
13673
13674         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13675         checking source file names in error messages.
13676
13677 2009-08-18  Doug Kwan  <dougkwan@google.com>
13678
13679         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13680         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13681         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13682         an elfcpp::Ehdr as parameter.
13683         * object.cc (Object::set_target): Remove the version that looks up
13684         a target and sets it.
13685         (Sized_relobj::setup): Take a Target object instead of
13686         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13687         (make_elf_sized_object): Find target and ask target to
13688         make an ELF object.
13689         * object.h: (Object::set_target): Remove the version that looks up
13690         a target and sets it.
13691         (Sized_relobj::setup): Take a Target object instead of
13692         an elfcpp:Ehdr as parameter.
13693         * target.cc: Include dynobj.h.
13694         (Target::do_make_elf_object_implementation): New.
13695         (Target::do_make_elf_object): New.
13696         * target.h (Target::make_elf_object): New template declaration.
13697         (Target::do_make_elf_object): New method declarations.
13698         (Target::do_make_elf_object_implementation): New template declaration.
13699
13700 2009-08-14  Ian Lance Taylor  <iant@google.com>
13701
13702         * gold.h (FUNCTION_NAME): Define.
13703         (gold_unreachable): Use FUNCTION_NAME.
13704
13705 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13706
13707         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13708         symbol in the --keep-unique list is not found.
13709
13710 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13711
13712         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13713         been maked as --keep-unique.
13714         (Icf::unfold_section): New function.
13715         * icf.h (Icf::unfold_section): New function.
13716         * options.h (General_options::keep_unique): New option.
13717         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13718         * testsuite/Makefile.in: Regenerate.
13719         * testsuite/icf_keep_unique_test.sh: New file.
13720         * testsuite/icf_keep_unique_test.cc: New file.
13721
13722 2009-08-12  Cary Coutant  <ccoutant@google.com>
13723
13724         PR 10471
13725         * resolve.cc (Symbol_table::resolve): Check for references from
13726         dynamic objects to hidden and internal symbols.
13727         * testsuite/Makefile.am (hidden_test.sh): New test.
13728         * testsuite/Makefile.in: Regenerate.
13729         * testsuite/hidden_test.sh: New script.
13730         * testsuite/hidden_test_1.c: New test source.
13731         * testsuite/hidden_test_main.c: New test source.
13732
13733 2009-08-11  Doug Kwan  <dougkwan@google.com>
13734
13735         * arm.cc: Update comments.
13736         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13737         segment to locate the .ARM.exidx section if present.
13738
13739 2009-08-09  Doug Kwan  <dougkwan@google.com>
13740
13741         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13742         patch.
13743
13744 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13745         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13746         compiler warnings.
13747
13748 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13749
13750         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13751         valid tls_segment only for non-debug-section relocations.
13752         * testsuite/Makefile.am: Add gc_tls_test.
13753         * testsuite/Makefile.in: Regenerate.
13754         * testsuite/gc_tls_test.cc: New file.
13755         * testsuite/gc_tls_test.sh: New file.
13756
13757 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13758
13759         * icf.cc: New file.
13760         * icf.h: New file.
13761         * Makefile.am (CCFILES): Add icf.cc.
13762         (HFILES): Add icf.h
13763         * Makefile.in: Regenerate.
13764         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13765         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13766         section, symbol and addend information for the relocs.
13767         * gold.cc (queue_middle_tasks): Call identical code folding.
13768         * gold.h: Add defines for multimap.
13769         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13770         to the call of finalize_local_symbols.
13771         * main.cc (main): Create object of class Icf.
13772         * object.cc (Sized_relobj::do_layout): Allow this function to be
13773         called twice during icf.
13774         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13775         to sections marked as identical by icf.
13776         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13777         when available.
13778         (Sized_relobj::do_section_entsize): New function.
13779         * object.h (Object::section_entsize): New function.
13780         (Object::do_section_entsize): New pure virtual function.
13781         (Relobj::finalize_local_symbols): Add new parameter.
13782         (Relobj::do_section_entsize): New function.
13783         * options.h (General_options::icf): New option.
13784         (General_options::icf_iterations): New option.
13785         (General_options::print_icf_sections): New option.
13786         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13787         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13788         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13789         icf.
13790         * symtab.cc (Symbol_table::is_section_folded): New function.
13791         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13792         to sections marked as identical by icf.
13793         * symtab.h (Symbol_table::set_icf): New function.
13794         (Symbol_table::icf): New function.
13795         (Symbol_table::is_section_folded): New function.
13796         (Symbol_table::icf_): New data member.
13797         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13798         * testsuite/Makefile.am: Add commands to build icf_test.
13799         * testsuite/Makefile.in: Regenerate.
13800         * testsuite/icf_test.sh: New file.
13801         * testsuite/icf_test.cc: New file.
13802
13803 2009-07-24  Chris Demetriou  <cgd@google.com>
13804
13805         * layout.cc (is_compressible_debug_section): Fix incorrect
13806         comment about compressed section names.
13807
13808 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13809
13810         PR 10419
13811         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13812
13813 2009-07-16  Ian Lance Taylor  <iant@google.com>
13814
13815         PR 10400
13816         * layout.h: #include <map>.
13817         (class Kept_section): Change from struct to class.  Add accessors
13818         and setters.  Add section size to Comdat_group mapping.  Change
13819         Comdat_group to std::map.  Add is_comdat_ field.  Add
13820         linkonce_size field in union.
13821         (class Layout): Update declaration of find_or_add_kept_section.
13822         Don't declare find_kept_object.
13823         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13824         parameter.  Add object, shndx, is_comdat, and is_group_name
13825         parameters.  Change all callers.  Adjust for new Kept_section.
13826         (Layout::find_kept_object): Remove.
13827         * object.cc (Sized_relobj::include_section_group): Update use of
13828         Kept_section.  Rename secnum to shndx.  Only record
13829         Kept_comdat_section if sections are the same size.
13830         (Sized_relobj::include_linkonce_section): Update use of
13831         Kept_section.  Only record Kept_comdat_section if sections are the
13832         same size.  Set size of linkonce section.
13833         (Sized_relobj::map_to_kept_section): Update call to
13834         get_kept_comdat_section.
13835         * object.h (class Sized_relobj): Rename fields in
13836         Kept_comdat_section to drop trailing underscores; change object
13837         field to Relobj*.  Change Kept_comdat_section_table to store
13838         struct rather than pointer.
13839         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13840         Add kept_object and kept_shndx parameters.  Change all callers.
13841         (Sized_relobj::get_kept_comdat_section): Change return type to
13842         bool.  Add kept_object and kept_shndx parameters.  Change all
13843         callers.
13844         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13845         Layout::find_or_add_kept_section.
13846
13847 2009-07-09  Ian Lance Taylor  <iant@google.com>
13848
13849         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13850         Reserve space in the hash table.
13851
13852 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13853
13854         * fileread.cc (File_read::get_mtime): New method.
13855         * fileread.h (Timespec): New structure.
13856         (File_read::get_mtime): New method.
13857         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13858         Renamed from timestamp_nsec.
13859         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13860         Elf_Xword.
13861         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13862         timestamp_nsec.
13863         (Incremental_inputs::report_archive): Save mtime; style fix.
13864         (Incremental_inputs::report_obejct): Save mtime; style fix.
13865         (Incremental_inputs::report_script): Save mtime; style fix.
13866         (Incremental_inputs::finalize_inputs): Style fix.
13867         (Incremental_inputs::finalize): Style fix.
13868         (Incremental_inputs::create_input_section_data): Store inputs
13869         mtime.
13870         * incremental.h (Incremental_inputs::report_script): Add mtime
13871         argument.
13872         (Incremental_inputs::Input_info::Input_info): Intialize only one
13873         union member.
13874         (Incremental_inputs::Input_info::archive): Move to nameless
13875         union.
13876         (Incremental_inputs::Input_info::obejct): Move to nameless union.
13877         (Incremental_inputs::Input_info::script): Move to nameless union.
13878         (Incremental_inputs::mtime): New field.
13879         * script.cc (read_input_script): Pass file mtime to
13880         Incremental_input.
13881         * script.h (Script_info::inputs): Style fix.
13882
13883 2009-07-01  Ian Lance Taylor  <ian@airs.com>
13884
13885         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13886         instead of 32.
13887
13888 2009-06-24  Ian Lance Taylor  <iant@google.com>
13889
13890         PR 10156
13891         * layout.cc (Layout::choose_output_section): If we find an
13892         existing section, update the flags.
13893         (Layout::create_notes): New function, broken out of
13894         Layout::finalize.
13895         (Layout::finalize): Don't create note sections.
13896         (Layout::create_note): Don't crash if linker script discards
13897         section.
13898         (Layout::create_gold_note): Likewise.
13899         (Layout::create_build_id): Likewise.  Don't set
13900         after_input_sections on the section.
13901         (Layout::create_executable_stack_info): Remove target parameter.
13902         Change caller.
13903         * layout.h (class Layout): Declare create_notes.  Update
13904         declaration of create_executable_stack_info.
13905         * gold.cc (queue_middle_tasks): Call create_notes.
13906         * output.cc (Output_section::update_flags_for_input_section): Move
13907         here from output.h.  If SHF_ALLOC flag is newly set, mark address
13908         invalid.
13909         * output.h (Output_data::mark_address_invalid): New function.
13910         (class Output_section): Only declare, not define,
13911         update_flags_for_input_section.  Remove set_flags.
13912
13913 2009-06-24  Ian Lance Taylor  <iant@google.com>
13914
13915         * script-sections.cc (Output_section_definition::
13916         set_section_addresses): Rename shadowing local load_address to
13917         laddr.
13918
13919 2009-06-24  Ian Lance Taylor  <iant@google.com>
13920
13921         PR 10244
13922         * reloc.cc (relocate_sections): Skip empty relocation sections.
13923
13924 2009-06-23  Ian Lance Taylor  <iant@google.com>
13925
13926         PR 10156
13927         * layout.cc (Layout::create_note): Use choose_output_section
13928         rather than make_output_section.
13929
13930 2009-06-23  Ian Lance Taylor  <iant@google.com>
13931
13932         PR 10237
13933         * options.cc (General_options::parse_V): Set printed_version_.
13934         (General_options::General_options): Initialize printed_version_.
13935         * options.h (class General_options): Add printed_version_ field.
13936         * gold.cc (queue_initial_tasks): If there are no input files,
13937         don't give a fatal error if we printed the version information.
13938         (queue_middle_tasks): If using -r with a shared object, give a
13939         fatal error rather than an ordinary error.
13940
13941 2009-06-23  Ian Lance Taylor  <iant@google.com>
13942
13943         PR 10219
13944         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13945         (Layout::make_output_section): Set have_stabstr_section_ if we see
13946         a .stab*str section.
13947         (Layout::finalize): Call link_stabs_sections.
13948         (Layout::link_stabs_sections): New file.
13949         * layout.h (class Layout): Add have_stabstr_section_ field.
13950         Declare link_stabs_sections.
13951
13952 2009-06-23  Doug Kwan  <dougkwan@google.com>
13953
13954         * Makefile.am (libgold_a_LIBADD): New.
13955         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13956         * Makefile.in: Regenerate.
13957         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13958         * configure: Regenerate.
13959         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13960         * fileread.cc: Include sys/state.h
13961         * gold.h: Declare memmem and strndup if found missing.
13962         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13963
13964 2009-06-23  Ian Lance Taylor  <iant@google.com>
13965
13966         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13967         * configure: Rebuild.
13968
13969 2009-06-23  Ian Lance Taylor  <iant@google.com>
13970
13971         PR 10147
13972         * object.cc (Object::section_contents): Don't try to get a view if
13973         the section has length zero.
13974         (Object::handle_gnu_warning_section): If the section is empty, use
13975         the name of the section as the warning.
13976
13977 2009-06-23  Ian Lance Taylor  <iant@google.com>
13978
13979         PR 10133
13980         * stringpool.h (class Stringpool_template): Add optimize_ field.
13981         (Stringpool_template::set_optimize): New function.
13982         * stringpool.cc (Stringpool_template::Stringpool_template):
13983         Initialize optimize_ field.
13984         (Stringpool_template::set_string_offsets): Test local optimize
13985         fild rather than parameter.
13986         * layout.cc (Layout::Layout): Call set_optimize on the section
13987         name stringpool.
13988
13989 2009-06-22  Ian Lance Taylor  <iant@google.com>
13990
13991         PR 10030
13992         * yyscript.y: Parse TARGET.
13993         * script.cc (script_set_target): New function.
13994         * script-c.h (script_set_target): Declare.
13995         * options.cc (General_options::string_to_object_format): Rename
13996         from string_to_object_format in anonymous namespace.  Change
13997         callers.
13998         * options.h (class General_options): Declare
13999         string_to_object_format.
14000
14001 2009-06-22  Ian Lance Taylor  <iant@google.com>
14002
14003         * script-sections.cc (Script_sections::create_segments): Don't put
14004         program headers in a PT_LOAD segment if -n or -N.
14005
14006 2009-06-22  Ian Lance Taylor  <iant@google.com>
14007
14008         PR 10141
14009         * options.h (class General_options): Add -z lazy and -z now.  Sort
14010         -z options into alphabetical order.
14011         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14012
14013 2009-06-21  Ian Lance Taylor  <iant@google.com>
14014
14015         * layout.cc (Layout::make_output_section): Call
14016         Target::new_output_section.
14017         (Layout::attach_allocated_section_to_segment): Put large section
14018         sections in a separate load segment with the large segment flag
14019         set.
14020         (Layout::segment_precedes): Sort large data segments after other
14021         load segments.
14022         (align_file_offset): New static function.
14023         (Layout::set_segment_offsets): Use align_file_offset.
14024         * output.h (class Output_section): Add is_small_section_ and
14025         is_large_section_ fields.
14026         (Output_section::is_small_section): New function.
14027         (Output_section::set_is_small_section):  New function.
14028         (Output_section::is_large_section): New function.
14029         (Output_section::set_is_large_section): New function.
14030         (Output_section::is_large_data_section): New function.
14031         (class Output_segment): Add is_large_data_segment_ field.
14032         (Output_segment::is_large_data_segment): New function.
14033         (Output_segment::set_is_large_data_segment): New function.
14034         * output.cc (Output_section::Output_section): Initialize new
14035         fields.
14036         (Output_segment::Output_segment): Likewise.
14037         (Output_segment::add_output_section): Add assertion that large
14038         data sections always go in large data segments.  Force small data
14039         sections to the end of the list of data sections.  Force small BSS
14040         sections to the start of the list of BSS sections.  For large BSS
14041         sections to the end of the list of BSS sections.
14042         * symtab.h (class Symbol): Declare is_common_shndx.
14043         (Symbol::is_defined): Check Symbol::is_common_shndx.
14044         (Symbol::is_common): Likewise.
14045         (class Symbol_table): Define enum Commons_section_type.  Update
14046         declarations.  Add small_commons_ and large_commons_ fields.
14047         * symtab.cc (Symbol::is_common_shndx): New function.
14048         (Symbol_table::Symbol_table): Initialize new fields.
14049         (Symbol_table::add_from_object): Put small and large common
14050         symbols in the right list.
14051         (Symbol_table::sized_finalized_symbol): Check
14052         Symbol::is_common_shndx.
14053         (Symbol_table::sized_write_globals): Likewise.
14054         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14055         common symbol lists.  Don't call do_allocate_commons_list if the
14056         list is empty.
14057         (Symbol_table::do_allocate_commons_list): Remove is_tls
14058         parameter.  Add comons_section_type parameter.  Change all
14059         callers.  Handle small and large common symbols.
14060         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14061         Symbol::is_common_shndx.
14062         * resolve.cc (symbol_to_bits): Likewise.
14063         * target.h (Target::small_common_shndx): New function.
14064         (Target::small_common_section_flags): New function.
14065         (Target::large_common_shndx): New function.
14066         (Target::large_common_section_flags): New function.
14067         (Target::new_output_section): New function.
14068         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14069         small_common_section_flags, and large_common_section_flags
14070         fields.
14071         (Target::do_new_output_section): New virtual function.
14072         * arm.cc (Target_arm::arm_info): Initialize new fields.
14073         * i386.cc (Target_i386::i386_info): Likewise.
14074         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14075         Likewise.
14076         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14077         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14078         (Target_x86_64::do_new_output_section): New function.
14079         * configure.ac: Define conditional MCMODEL_MEDIUM.
14080         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14081         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14082         (large_LDFLAGS): Define.
14083         * testsuite/large.c: New file.
14084         * testsuite/testfile.cc (Target_test::test_target_info):
14085         Initialize new fields.
14086         * configure, testsuite/Makefile.in: Rebuild.
14087
14088 2009-06-05  Doug Kwan  <dougkwan@google.com>
14089
14090         * Makefile.am (CCFILES): Add target.cc.
14091         * Makefile.in: Regenerate.
14092         * i386.cc (class Target_i386): Define new virtual method to
14093         override do_is_local_label_name in parent.
14094         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14095         local symbols if --discard-locals or -X is given.
14096         * options.h (class General_options): Declare new options
14097         '--discard-locals' and '-X' for discarding locals.
14098         * target.h (class Target): Define new methods is_local_label_name.
14099         Declare new virtual method do_is_local_label_name.
14100         * target.cc: New file.
14101         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14102         (check_SCRIPTS): Add discard_locals_test.sh.
14103         (check_DATA): Add discard_local_tests.syms.
14104         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14105         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14106         * testsuite/Makefile.in: Regenerate.
14107         * testsuite/discard_locals_test.c: New file.
14108         * testsuite/discard_locals_test.sh: Same.
14109
14110 2009-06-05  Doug Kwan  <dougkwan@google.com>
14111
14112         * object.cc (Sized_relobj::Sized_relobj): Initialize
14113         discarded_eh_frame_shndx_ to -1U.
14114         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14115         section.
14116         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14117         a discarded .eh_frame section.
14118         (Sized_relobj::do_finalize_local_symbols): Ditto.
14119         * object.h (class Sized_relobj): Declare new member
14120         discarded_eh_frame_shndx_.
14121         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14122         (local_labels_test.o, local_labels_test): New rules.
14123         * testsuite/Makefile.in: Regenerate.
14124
14125 2009-06-04  Doug Kwan  <dougkwan@google.com>
14126
14127         * layout.cc (Layout::section_name_mapping): Add mapping for
14128         special ARM sections.
14129
14130 2009-06-03  Doug Kwan  <dougkwan@google.com>
14131
14132         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14133         (utils::has_overflow): Same.
14134
14135 2009-06-03  Ian Lance Taylor  <iant@google.com>
14136
14137         * layout.cc (Layout::section_name_mapping): New array, replacing
14138         Layout::linkonce_mapping.
14139         (Layout::section_name_mapping_count): New variable, replacing
14140         Layout::linkonce_mapping_count.
14141         (Layout::linkonce_output_name): Remove.
14142         (Layout::output_section_name): Rewrite.
14143         * layout.h (class Layout): Rename Linkonce_mapping to
14144         Section_name_mapping, linkonce_mapping to section_name_mapping,
14145         linkonce_mapping_count to section_name_mapping_count.  Don't
14146         declare linkonce_output_name.
14147
14148 2009-06-03  Doug Kwan  <dougkwan@google.com>
14149
14150         * gold/arm.cc (namespace utils): New.
14151         (Target_arm::reloc_is_non_pic): Define new method.
14152         (class Arm_relocate_functions): New.
14153         (Target_arm::Relocate::relocate): Handle relocation types used by
14154         Android.
14155
14156 2009-06-03  Ian Lance Taylor  <iant@google.com>
14157
14158         * arm.cc (Target_arm::scan::global): Use || instead of |.
14159
14160 2009-06-02  Doug Kwan  <dougkwan@google.com>
14161
14162         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14163         issued_non_pic_error_.
14164         (class Target_arm::Scan): Declare new method check_non_pic.
14165         Define new method symbol_needs_plt_entry.
14166         Declare new data member issued_non_pic_error_.
14167         (class Target_arm::Relocate): Declare new method
14168         should_apply_static_reloc.
14169         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14170         (Target_arm::Scan::check_non_pic): Define new method.
14171         (Target_arm::Scan::local): Handle a small subset of reloc types used
14172         by Android.
14173         (Target_arm::Scan::local): Same.
14174         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14175
14176 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14177
14178         * incremental.cc (Incremental_inputs::report_command_line): Filter
14179         out --incremental-* options.
14180
14181 2009-05-29  Doug Kwan  <dougkwan@google.com>
14182
14183         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14184         template class.
14185         (class Target_arm): Update comment.
14186         (Target_arm::Target_arm): Initialize new data members GOT_,
14187         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14188         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14189         and Target_arm::rel_dyn_section.
14190         Declare new_enum Target_arm::Got_type.
14191         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14192         and DYNBSS_.
14193         Update commments for member do_dynsym_value.
14194         (Target_arm::got_size, Target_arm::plt_section,
14195         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14196         new methods inside class defintion.
14197         (Target_arm::got_section): Define new method.
14198         (Target_arm::rel_dyn_section): Same.
14199         (Output_data_plt_arm): New template class.
14200         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14201         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14202         (Output_data_plt_arm::add_entry): Same.
14203         (Output_data_plt_arm::first_plt_entry): Define new
14204         static data member for PLT instruction template.
14205         (Output_data_plt_arm::plt_entry): Same.
14206         (Output_data_plt_arm::do_write): Define new method.
14207         (Target_arm::make_plt_entry): Same.
14208         (Target_arm::do_finalize_sections): Same.
14209         (Target_arm::do_dynsym_value): Same.
14210
14211 2009-05-28  Doug Kwan  <dougkwan@google.com>
14212
14213         * Makefile.am (TARGETSOURCES): Add arm.cc.
14214         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14215         * Makefile.in: Regenerate.
14216         * arm.cc: New file.
14217         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14218
14219 2009-05-26  Doug Kwan  <dougkwan@google.com>
14220
14221         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14222         (General_options::check_excluded_libs): Strip off directories in
14223         archive name before matching like GNU ld does.
14224         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14225         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14226         (exclude_libs_test_LDFLAGS): Add linker option
14227         -Wl,--exclude-libs,libexclude_libs_test_3
14228         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14229         an explicit archive without using -l.
14230         (alt/libexclude_libs_test_3.a): New make rule.
14231         * testsuite/Makefile.in: Regenerate.
14232         * testsuite/exclude_libs_test.c : Declare lib3_default().
14233         (main): Call it.
14234         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14235         * exclude_libs_test_3.c: New file.
14236
14237 2009-05-26  Nick Clifton  <nickc@redhat.com>
14238
14239         * po/id.po: New Indonesian translation.
14240         * po/gold.pot: Updated template file.
14241
14242 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14243
14244         * testsuite/Makefile.am: Add -ffunction-sections to compile
14245         gc_comdat_test files.  Add -Wl,--gc-sections to build
14246         gc_comdat_test.
14247         * testsuite/Makefile.in: Regenerate.
14248         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14249
14250 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14251
14252         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14253         kept comdat section was garbage collected.
14254         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14255         * testsuite/Makefile.in: Regenerate.
14256         * testsuite/gc_comdat_test.sh: New file.
14257         * testsuite/gc_comdat_test_1.cc: New file.
14258         * testsuite/gc_comdat_test_2.cc: New file.
14259
14260 2009-05-19  Doug Kwan  <dougkwan@google.com>
14261
14262         * archive.cc (Archive::Archive): Move constructor from archive.h
14263         to here.  Initialize no_export_.
14264         (Archive::get_elf_object_for_member): Set no_export flag of object.
14265         * archive.h (Archive::Archive): Move constructor body to
14266         archive.cc.
14267         (Archive::no_export): New method.
14268         (Archive::no_export_): New field.
14269         * object.h (Object::Object): Initialize no_export_ to false.
14270         (Object::no_export, Object::set_no_export): New methods.
14271         (Object::no_export_): New field.
14272         * options.cc (General_options::parse_exclude_libs): New method.
14273         (General_options::check_excluded_libs) Same.
14274         * options.h (exclude_libs): New option.
14275         (General_options::check_excluded_libs): New method declaration.
14276         (General_options::excluded_libs_): New field.
14277         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14278         default or protected visibility if an object has no-export flag set.
14279         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14280         (check_SCRIPTS): Add exclude_libs_test.sh.
14281         (check_DATA): Add exclude_libs_test.syms.
14282         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14283         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14284         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14285         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14286         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14287         libexclude_libs_test_2.a): New rules.
14288         * testsuite/Makefile.in: Regenerate.
14289         * testsuite/exclude_libs_test.c: New file.
14290         * testsuite/exclude_libs_test.sh: Ditto.
14291         * testsuite/exclude_libs_test_1.c: Ditto.
14292         * testsuite/exclude_libs_test_2.c: Ditto.
14293
14294 2009-05-15  Ian Lance Taylor  <iant@google.com>
14295
14296         * configure.ac: Check for declarations for cases where libiberty.h
14297         checks HAVE_DECL_xxx.
14298         * configure, config.in: Rebuild.
14299
14300 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14301
14302         * gold.h (Incremental_argument_list): Remove (invalid) forward
14303         declaration.
14304         * incremental.cc (Incremental_inputs::report_achive): New method.
14305         (Incremental_inputs::report_object): New method.
14306         (Incremental_inputs::report_script): New method.
14307         (Incremental_inputs::finalize_inputs): New method.
14308         (Incremental_inputs::finalize): Call finalize_inputs().
14309         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14310         Create inputs entries.
14311         * incremental.h (Incremental_input_type): New enum.
14312         (Incremental_inputs::Incremental_input): Initialize new fields.
14313         (Incremental_inputs::report_inputs): New method.
14314         (Incremental_inputs::report_achive): New method.
14315         (Incremental_inputs::report_object): New method.
14316         (Incremental_inputs::report_script): New method.
14317         (Incremental_inputs::finalize_inputs): New method.
14318         (Incremental_inputs::Input_info): New struct.
14319         (Incremental_inputs::Input_info_map): New typedef.
14320         (Incremental_inputs::lock_): New field.
14321         (Incremental_inputs::Inputs_): New field.
14322         (Incremental_inputs::Inputs_map): New field.
14323         * main.cc (main): Call Incremental_input::report_inputs.
14324         * options.h (Input_argument_list): Typedef moved from
14325         Input_arguments.
14326         (Input_file_group::Files): Remove, use ::Input_argument_list.
14327         (Input_file_group::Input_argument_list): Remove, use
14328         ::Input_argument_list.
14329         * plugin.cc (Plugin_manager::add_input_file): Add error in
14330         incremental build.
14331         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14332         functions.
14333         * script.cc (read_input_script): Call
14334         Incremental_input::report_script.
14335         * script.h (Script_info): New class.
14336
14337 2009-04-27  Ian Lance Taylor  <iant@google.com>
14338
14339         * x86_64.cc (do_adjust_output_section): Set entsize to
14340         plt_entry_size.
14341
14342 2009-04-23  Elliott Hughes  <enh@google.com>
14343
14344         * output.cc (Output_file::close): After short writes, continue
14345         writing from the correct offset in the buffer being written.
14346
14347 2009-04-23  Chris Demetriou  <cgd@google.com>
14348
14349         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14350         * configure: Regenerate.
14351         * config.in: Regenerate.
14352         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14353         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14354
14355 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14356
14357         * incremental.cc (Incremental_inputs_header_data): Renamed from
14358         Incremental_input_header_data.
14359         (Incremental_inputs_header_data::data_size): New field.
14360         (Incremental_inputs_header_data::put_input_file_count): Renamed
14361         from input_file_count.
14362         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14363         from command_line_offset.
14364         (Incremental_inputs_header_data::put_reserved): Renamed from
14365         put_reserved.
14366         (Incremental_inputs_entry_data): Renamed from
14367         Incremental_input_entry_data.
14368         (Incremental_inputs_entry_data::data_size): New field.
14369         (Incremental_inputs::report_command_line): New method.
14370         (Incremental_inputs::finalize): New method.
14371         (Incremental_inputs::create_incremental_inputs_data): New method.
14372         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14373         * incremental.h: New file.
14374         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14375         (Layout::finalize): Create incremental inputs section in
14376         incremental builds.
14377         (Layout::create_incremental_info_sections): New method.
14378         * layout.h (Layout::incremental_inputs): New method.
14379         (Layout::create_incremental_info_sections): New method.
14380         (Layout::incremental_inputs_): New field.
14381         * main.cc (main): Notify Incremental_input of the command line.
14382
14383 2009-04-01  Ian Lance Taylor  <iant@google.com>
14384             Mikolaj Zalewski  <mikolajz@google.com>
14385
14386         * gold.h (reserve_unordered_map): Define, three versions, one for
14387         each version of Unordered_map.
14388         * layout.cc (Layout::Layout): Remove options parameter.  Add
14389         number_of_input_files parameter.  Don't initialize options_.
14390         Initialize number_of_input_files_ and resized_signatures_.  Move
14391         sections_are_attached_.
14392         (Layout::layout_group): Reserve space for group_signatures_.
14393         (Layout::find_or_add_kept_section): Change name parameter to be a
14394         reference.  Resize signatures_ map when it gets large enough.
14395         (Layout::layout_eh_frame): Use parameters->options() instead of
14396         this->options_.
14397         (Layout::make_output_section): Likewise.
14398         (Layout::attach_allocated_section_to_segment): Likewise.
14399         (Layout::finalize, Layout::create_executable_stack): Likewise.
14400         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14401         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14402         * layout.h (class Layout): Update declarations.  Remove options_
14403         field.  Add number_of_input_files_ and resized_signatures_
14404         fields.  Move sections_are_attached_ field.
14405         * main.cc (main): Pass number of input files to Layout
14406         constructor.  Don't pass options.
14407
14408 2009-03-30  Ian Lance Taylor  <iant@google.com>
14409
14410         * ffsll.c (ffsll): Correct implementation.
14411
14412 2009-03-27  Ian Lance Taylor  <iant@google.com>
14413
14414         * ffsll.c: New file.
14415         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14416         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14417         * ftruncate.c (ftruncate): Declare before definition.
14418         * mremap.c (mremap): Likewise.
14419         * pread.c (pread): Likewise.
14420         * configure, Makefile.in, config.in: Rebuild.
14421
14422         * mremap.c: New file.
14423         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14424         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14425         (mremap): Declare if HAVE_MREMAP is not defined.
14426         * configure, Makefile.in, config.in: Rebuild.
14427
14428 2009-03-27  Cary Coutant  <ccoutant@google.com>
14429
14430         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14431         position independent.
14432         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14433         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14434
14435 2009-03-24  Cary Coutant  <ccoutant@google.com>
14436
14437         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14438         an executable.
14439         (needs_dynamic_reloc): Likewise.
14440
14441 2009-03-24  Ian Lance Taylor  <iant@google.com>
14442
14443         * yyscript.y (file_cmd): Recognize EXTERN.
14444         (extern_name_list, extern_name_list_body): New nonterminals.
14445         * script.cc (script_add_extern): Define.
14446         * script-c.h (script_add_extern): Declare.
14447
14448 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14449
14450         * object.cc (is_elf_object): Define.
14451         * object.h (is_elf_object): Declare.
14452         * archive.cc (Archive::get_elf_object_for_member): Call
14453         is_elf_object.
14454         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14455
14456 2009-03-24  Elliott Hughes  <enh@google.com>
14457
14458         * output.cc (Output_file::map_anonymous): Define.
14459         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14460         try an anonymous one.  Report the size if the mmap fails.
14461         * output.h (class Output_file): Declare map_anonymous.
14462
14463 2009-03-24  Ian Lance Taylor  <iant@google.com>
14464
14465         * target-select.cc (instantiate_target): Don't acquire the lock if
14466         the instantiated_target_ field has already been set.
14467
14468 2009-03-23  Ian Lance Taylor  <iant@google.com>
14469
14470         * gold-threads.h (class Initialize_lock): Define.
14471         * gold-threads.cc (class Initialize_lock_once): Define.
14472         (initialize_lock_control): New static variable.
14473         (initialize_lock_pointer): New static variable.
14474         (initialize_lock_once): New static function.
14475         (Initialize_lock::Initialize_lock): Define.
14476         (Initialize_lock::initialize): Define.
14477         * target-select.h: Include "gold-threads.h".
14478         (class Target_selector): Add lock_ and initialize_lock_ fields.
14479         Don't define instantiate_target, just declare it.
14480         * target-select.cc (Target_selector::Target_selector): Initialize
14481         new fields.
14482         (Target_selector::instantiate_target): Define.
14483         * descriptors.h: Include "gold-threads.h".
14484         (class Descriptors): Add initialize_lock_ field.
14485         * descriptors.cc (Descriptors::Descriptors): Initialize new
14486         field.
14487         (Descriptors::open): Use initialize_lock_ field
14488         * errors.h (class Errors): Add initialize_lock_ field.
14489         * errors.cc (Errors::Errors): Initialize new field.
14490         (Errors::initialize_lock): Use initialize_lock_ field.
14491         * powerpc.cc (class Target_selector_powerpc): Remove
14492         instantiated_target_ field.  In do_recognize call
14493         instantiate_target rather than do_instantiate_target.  In
14494         do_instantiate_target just allocate a new target.
14495         * sparc.cc (class Target_selector_sparc): Likewise.
14496
14497         * freebsd.h: New file.
14498         * i386.cc: Include "freebsd.h".
14499         (Target_i386): Derive from Target_freebsd rather than
14500         Sized_target.
14501         (Target_selector_i386): Derive from Target_selector_freebsd rather
14502         than Target_selector.
14503         * x86_64.cc: Include "freebsd.h".
14504         (Target_x86_64): Derive from Target_freebsd rather than
14505         Sized_target.
14506         (Target_selector_x86_64): Derive from Target_selector_freebsd
14507         rather than Target_selector.
14508         * target.h (class Target): Add adjust_elf_header and
14509         do_adjust_elf_header.
14510         * output.cc (Output_file_header:: do_sized_write): Call target
14511         adjust_elf_header routine.
14512         * configure.tgt: Set targ_osabi.
14513         * configure.ac: Define GOLD_DEFAULT_OSABI.
14514         * parameters.cc (Parameters::default_target): Pass
14515         GOLD_DEFAULT_OSABI to select_target.
14516         * target-select.h (class Target_selector): Make instantiate_target
14517         protected rather than private.
14518         * Makefile.am (HFILES): Add freebsd.h.
14519         * configure, Makefile.in, config.in: Rebuild.
14520
14521         * merge.cc (do_add_input_section): Correct pend value.  Change
14522         message about last entry not being null terminated from error to
14523         warning.
14524
14525 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14526
14527         * incremental.cc: New file.
14528         * Makefile.am (CCFILES): Add incremental.cc.
14529         * Makefile.in: Rebuild.
14530
14531 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14532
14533         * layout.cc (Layout::output_section_name): Preserve names
14534         of '.note.' sections.
14535
14536 2009-03-19  Ian Lance Taylor  <iant@google.com>
14537
14538         * descriptors.cc (Descriptors::open): Check that the options are
14539         valid before using them.
14540
14541 2009-03-18  Ian Lance Taylor  <iant@google.com>
14542
14543         * script-sections.h: Include <list>.
14544         (class Script_sections): Change Sections_elements from std::vector
14545         to std::list.  Typedef public Elements_iterator.  Add
14546         orphan_section_placement_, data_segment_align_start_, and
14547         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14548         field.
14549         * script-sections.cc (class Orphan_section_placement): New class.
14550         (class Sections_element): Add virtual functions is_relro and
14551         orphan_section_init.  Remove virtual function place_orphan_here.
14552         (class Output_section_definition): Add is_relro and
14553         orphan_section_init.  Remove place_orphan_here.
14554         (class Orphan_output_section): Likewise.
14555         (Script_sections::Script_sections): Update for field changes.
14556         (Script_sections::data_segment_align): Set saw_data_segment_align_
14557         and data_segment_align_start_, not data_segment_align_index.
14558         (Script_sections::data_segment_relro_end): Check
14559         saw_data_segment_align_.  Use data_segment_align_start_ rather
14560         than data_segment_align_index_.
14561         (Script_sections::place_orphan): Rewrite to use
14562         Orphan_section_placement.
14563
14564 2009-03-17  Ian Lance Taylor  <iant@google.com>
14565
14566         * archive.cc (Archive::add_symbols): Check for a version attached
14567         to the symbol name in the archive map.
14568         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14569         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14570         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14571         (ver_test_11.a): New target.
14572         * testsuite/Makefile.in: Rebuild.
14573
14574         * configure.ac: Check for chsize and posix_fallocate.  Replace
14575         ftruncate.
14576         * ftruncate.c: New file, from gnulib.
14577         * output.cc (posix_fallocate): Define dummy version if not
14578         HAVE_POSIX_FALLOCATE.
14579         (Output_file::map): Call posix_fallocate rather than lseek and
14580         write.
14581         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14582         * configure, Makefile.in, config.in: Rebuild.
14583
14584 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14585
14586         * layout.h (Layout::create_note): Add section_name parameter.
14587         * layout.cc (Layout::create_note): Likewise.
14588         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14589
14590 2009-03-17  Ian Lance Taylor  <iant@google.com>
14591
14592         * descriptors.cc: Include "options.h".
14593         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14594         (Descriptors::open): Always use O_CLOEXEC when opening a new
14595         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14596         then set FD_CLOEXEC.
14597
14598         * sparc.cc (class Target_sparc): Add has_got_section.
14599         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14600         make sure we have a GOT section.
14601
14602         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14603         (Target_sparc::Scan::local): Likewise.
14604         (Target_sparc::Scan::global): Likewise.
14605         (Target_sparc::Relocate::relocate): Likewise.
14606         (Target_sparc::Relocate::relocate_tls): Likewise.
14607
14608         * symtab.cc (Symbol_table::define_default_version): New function,
14609         broken out of add_from_object.
14610         (Symbol_table::add_from_object): Call define_default_version.
14611         (Symbol_table::define_special_symbol): Add resolve_oldsym
14612         parameter.  Change all callers.  If the version for a symbol comes
14613         from a version script, resolve it with the symbol with the same
14614         name with no version.  Also add the symbol without a version if
14615         appropriate.
14616         (do_define_in_output_data): If resolving with oldsym, don't delete
14617         sym.
14618         (do_define_in_output_segment): Likewise.
14619         (do_define_as_constant): Likewise.
14620         * symtab.h (class Symbol_table): Update declarations.
14621
14622 2009-03-13  Ian Lance Taylor  <iant@google.com>
14623
14624         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14625         (Read_symbols::requeue): New function.
14626         (Read_symbols::do_read_symbols): If make_elf_object fails because
14627         the target type is not configured, and the file was searched for,
14628         issue a warning and retry with the next directory.
14629         (Add_symbols::run): If the file has an incompatible format, and
14630         it was searched for, requeue the Read_symbols task.  On error,
14631         release the object.
14632         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14633         dirindex parameter to constructor.  Change all callers.  Declare
14634         incompatible_warning and requeue.
14635         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14636         input_argument_ and input_group_ fields.  Add them to
14637         constructor.  Change all callers.
14638         (class Read_script): Add dirindex_ field.  Add it to constructor.
14639         Change all callers.
14640         * archive.cc (Archive::setup): Remove input_objects parameter.
14641         Change all callers.
14642         (Archive::get_file_and_offset): Likewise.
14643         (Archive::read_all_symbols): Likewise.
14644         (Archive::read_symbols): Likewise.
14645         (Archive::get_elf_object_for_member): Remove input_objects
14646         parameter.  Add punconfigured parameter.  Change all callers.
14647         (Archive::add_symbols): Change return type to bool.  Check return
14648         value of include_member.
14649         (Archive::include_all_members): Likewise.
14650         (Archive::include_member): Change return type to bool.  Return
14651         false if first included object has incompatible target.  Set
14652         included_member_ field.
14653         (Add_archive_symbols::run): If add_symbols returns false, requeue
14654         Read_symbols task.
14655         * archive.h (class Archive): Add included_member_ field.
14656         Initialize it in constructor.  Add input_file and searched_for
14657         methods.  Update declarations.
14658         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14659         input_argument_ fields.  Add them to constructor.  Change all
14660         callers.
14661         * script.cc: Include "target-select.h".
14662         (class Parser_closure): Add skip_on_incompatible_target_ and
14663         found_incompatible_target_ fields.  Add
14664         skip_on_incompatible_target parameter to constructor.  Change all
14665         callers.  Add methods skip_on_incompatible_target,
14666         clear_skip_on_incompatible_target, found_incompatible_target, and
14667         set_found_incompatible_target.
14668         (read_input_script): Add dirindex parameter.  Change all callers.
14669         If parser finds an incompatible target, requeue Read_symbols
14670         task.
14671         (script_set_symbol): Clear skip_on_incompatible_target in
14672         closure.
14673         (script_add_assertion, script_parse_option): Likewise.
14674         (script_start_sections, script_add_phdr): Likewise.
14675         (script_check_output_format): New function.
14676         * script.h (read_input_script): Update declaration.
14677         * script-c.h (script_check_output_format): Declare.
14678         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14679         (ignore_cmd): Remove OUTPUT_FORMAT.
14680         * fileread.cc (Input_file::Input_file): Add explicit this.
14681         (Input_file::will_search_for): New function.
14682         (Input_file::open): Add pindex parameter.  Change all callers.
14683         * fileread.h (class Input_file): Add input_file_argument method.
14684         Declare will_search_for.  Update declarations.
14685         * object.cc (make_elf_object): Add punconfigured parameter.
14686         Change all callers.
14687         * object.h (class Object): Make input_file public.  Add
14688         searched_for method.
14689         (make_elf_object): Update declaration.
14690         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14691         restart search.
14692         * dirsearch.h (class Dirsearch): Update declaration.
14693         * options.h (class General_options): Add --warn-search-mismatch.
14694         * parameters.cc (Parameters::is_compatible_target): New function.
14695         * parameters.h (class Parameters): Declare is_compatible_target.
14696         * workqueue.cc (Workqueue::add_blocker): New function.
14697         * workqueue.h (class Workqueue): Declare add_blocker.
14698
14699         * fileread.cc (Input_file::open): Remove options parameter.
14700         Change all callers.
14701         (Input_file::open_binary): Likewise.
14702         * script.cc (read_input_script): Likewise.
14703         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14704         options parameter from constructor.  Change all callers.
14705         (class Read_script): Likewise.
14706         * fileread.h (class Input_file): Update declarations.
14707         * script.h (read_input_script): Update declaration.
14708
14709 2009-03-10  Nick Clifton  <nickc@redhat.com>
14710
14711         * po/es.po: New Spanish translation.
14712
14713 2009-03-06  Cary Coutant  <ccoutant@google.com>
14714
14715         * options.cc (parse_short_option): Keep dash_z from registering itself.
14716
14717 2009-03-03  Ian Lance Taylor  <iant@google.com>
14718
14719         PR 9918
14720         * target-reloc.h (relocate_section): Pass output_section to
14721         relocate.
14722         * i386.cc (Target_i386::should_apply_static_reloc): Add
14723         output_section parameter.  Change all callers.
14724         (Target_i386::Relocate::relocate): Add output_section parameter.
14725         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14726         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14727         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14728         * testsuite/two_file_shared.sh: New script.
14729         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14730         (check_DATA): Add two_file_shared.dbg.
14731         (two_file_shared.dbg): New target.
14732         * testsuite/Makefile.in: Rebuild.
14733
14734 2009-03-01  Ian Lance Taylor  <iant@google.com>
14735
14736         * configure.ac: Check for byteswap.h.
14737         * configure: Rebuild.
14738         * config.in: Rebuild.
14739
14740 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14741
14742         * layout.cc (Layout::find_or_add_kept_section): New function.
14743         (Layout::add_comdat): Removed.
14744         * layout.h (struct Kept_section): Move out of class Layout.
14745         Remove trailing underscores from field names.  Add group_sections
14746         field.  Rename group_ field to is_group.  Change all uses.
14747         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14748         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14749         comdat_groups_ field.
14750         (Sized_relobj::include_section_group): Use
14751         find_or_add_kept_section and Kept_section::group_sections.
14752         (Sized_relobj::include_linkonce_section): Likewise.
14753         * object.cc (class Sized_relobj): Don't define Comdat_group or
14754         Comdat_group_table.  Remove find_comdat_group and
14755         add_comdat_group.  Remove comdat_groups_ field.
14756         * plugin.cc (include_comdat_group): Use
14757         Layout::find_or_add_kept_section.
14758
14759 2009-02-28  Ian Lance Taylor  <iant@google.com>
14760
14761         * README: --gc-sections and map files are now supported.  Document
14762         some build requirements.
14763
14764         PR 6992
14765         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14766         relocatable link set the value of the section symbol to zero.
14767         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14768         relocatable link don't include the section address in the local
14769         symbol value.
14770
14771 2009-02-27  Ian Lance Taylor  <iant@google.com>
14772
14773         PR 6811
14774         * options.h (class Search_directory): Add is_system_directory.
14775         (class General_options): Declare is_in_system_directory.
14776         * options.cc (get_relative_sysroot): Make static.
14777         (get_default_sysroot): Make static.
14778         (General_optoins::is_in_system_directory): New function.
14779         * fileread.cc (Input_file::is_in_system_directory): New function.
14780         * fileread.h (class Input_file): Declare is_in_system_directory.
14781         * object.h (class Object): Add is_in_system_directory.
14782         (class Input_objects): Remove system_library_directory_ field.
14783         * object.cc (Input_objects::add_object): Don't set
14784         system_library_directory_.
14785         (input_objects::found_in_system_library_directory): Remove.
14786         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14787         parameter.  Change all callers.
14788         (Symbol_table::sized_write_globals): Likewise.
14789         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14790         Call Object::is_in_system_directory.
14791         * symtab.h (class Symbol_table): Update declarations.
14792
14793         PR 5990
14794         * descriptors.h (Open_descriptor): Add is_on_stack field.
14795         * descriptors.cc (Descriptors::open): If the descriptor is on the
14796         top of the stack, remove it.  Initialize is_on_stack field.
14797         (Descriptors::release): Only add pod to stack if it is not on the
14798         stack already.
14799         (Descriptors::close_some_descriptor): Clear stack_next and
14800         is_on_stack fields.
14801
14802         PR 7091
14803         * output.cc (Output_section::find_starting_output_address): Rename
14804         from starting_output_address; add PADDR parameter; change return
14805         type.
14806         * output.h (class Output_section): Declare
14807         find_starting_output_address instead of starting_output_address.
14808         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14809         section symbol for which we can't find a merge section.
14810
14811         PR 9836
14812         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14813         hidden or internal, force the symbol to be local.
14814         * resolve.cc (Symbol::override_visibility): Define.
14815         (Symbol::override_base): Use override_visibility.
14816         (Symbol_table::resolve): Likewise.
14817         (Symbol::override_base_with_special): Likewise.
14818         (Symbol_table::override_with_special): If the visibility is hidden
14819         or internal, force the symbol to be local.
14820         * symtab.h (class Symbol): Add set_visibility and
14821         override_visibility.
14822         * testsuite/ver_test_1.sh: New file.
14823         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14824         (check_DATA): Add ver_test_1.syms.
14825         (ver_test_1.syms): New target.
14826         * testsuite/Makefile.in: Rebuild.
14827
14828 2009-02-25  Cary Coutant  <ccoutant@google.com>
14829
14830         * layout.cc (Layout::choose_output_section): Don't rename sections
14831         when using a linker script that has a SECTIONS clause.
14832         * Makefile.in: Regenerate.
14833
14834         * testsuite/Makefile.am (script_test_5.sh): New test case.
14835         * testsuite/Makefile.in: Regenerate.
14836         * testsuite/script_test_5.cc: New file.
14837         * testsuite/script_test_5.sh: New file.
14838         * testsuite/script_test_5.t: New file.
14839
14840 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14841
14842         * archive.cc (Archive::include_member): Update calls to add_symbols.
14843         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14844         the Layout argument.
14845         * dynobj.h (do_add_symbols): Add the Layout argument.
14846         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14847         Layout argument.
14848         * object.h (Object::add_symbols): Add the Layout argument.
14849         (Object::do_add_symbols): Add the Layout argument.
14850         (Sized_relobj::do_add_symbols): Add the Layout argument.
14851         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14852         Unify the two versions.
14853         (Add_plugin_symbols): Remove.
14854         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14855         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14856         (Add_plugin_symbols): Remove.
14857         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14858         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14859         (Add_symbols::run): Make it work with Pulginobj.
14860
14861 2009-02-06  Ian Lance Taylor  <iant@google.com>
14862
14863         * object.cc (Sized_relobj::do_layout): Make info message start
14864         with lower case letter.
14865
14866 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14867
14868         * binary.cc: Fix file comment.
14869
14870         * options.h (enum Incremental_disposition): Define.
14871         (class General_options): Add new options: --incremental,
14872         --incremental_changed, --incremental_unchanged,
14873         --incremental_unknown.  Add incremental_disposition_ and
14874         implicit_incremental_ fields.
14875         (General_options::incremental_disposition): New function.
14876         (class Position_dependent_options): Add incremental_disposition
14877         option.
14878         (Position_dependent_options::copy_from_options): Set incremental
14879         dispositions.
14880         * options.cc (General_options::parse_incremental_changed): New
14881         function.
14882         (General_options::parse_incremental_unchanged): New function.
14883         (General_options::parse_incremental_unknown): New function.
14884         (General_options::General_options): Initialize new fields
14885         incremental_disposition_ and implicit_incremental_.
14886         (General_options::finalize): Check for uasge of --incremental-*
14887         without --incremental.
14888
14889 2009-02-06  Chris Demetriou  <cgd@google.com>
14890
14891         * gold.h (gold_undefined_symbol): Change to take only a Symbol
14892         pointer and to report location as the file name associated with
14893         the symbol.
14894         (gold_undefined_symbol_at_location): New function to replace the
14895         old gold_undefined_symbol functionality.
14896         * target-reloc.h (relocate_section): Update to use
14897         gold_undefined_symbol_at_location.
14898         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14899         Call gold_undefined_symbol function rather than gold_error.
14900         * errors.h (Errors::undefined_symbol): Take location as a
14901         string, rather than calculating it from a relocation.
14902         * errors.cc (Errors::fatal): Print "fatal error:" before the
14903         formatted message.
14904         (Errors::error, Errors::error_at_location): Print "error: "
14905         before the formatted message.
14906         (Errors::undefined_symbol): Take location as a string, rather
14907         than calculating it from a relocation.
14908         (gold_undefined_symbol_at_location): New function akin to
14909         old gold_undefined_symbol, calculates location from relocation.
14910         (gold_undefined_symbol): Change to take only a Symbol pointer
14911         and to report location as the file name associated with the symbol.
14912         * testsuite/debug_msg.sh: Update for changed error messages.
14913         * testsuite/undef_symbol.sh: Likewise.
14914
14915 2009-02-04  Duncan Sands  <baldrick@free.fr>
14916
14917         PR 9812
14918         * reduced_debug_output.h
14919         (Output_reduced_debug_abbrev_section::failed): Use format for
14920         gold_warning.
14921         (Output_reduced_debug_info_section::faild): Likewise.
14922
14923 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
14924
14925         * script.cc (Lazy_demangler): New class.
14926         (Version_script_info::get_symbol_version_helper): Demangle a
14927         symbol only once.
14928
14929 2009-01-29  Cary Coutant  <ccoutant@google.com>
14930
14931         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14932         to __tls_get_addr.
14933         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14934
14935 2009-01-28  Ian Lance Taylor  <iant@google.com>
14936
14937         * version.cc (version_string): Bump to 1.9.
14938
14939         * gold.h: Include <cstring> and <stdint.h>.
14940         * version.cc: Include <cstdio>.
14941         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14942         warning.
14943         * reduced_debug_output.cc (insert_into_vector): Rename from
14944         Insert_into_vector; change all callers.  Use Swap_unaligned to
14945         avoid aliasing issue; remove union since it is unnecessary.
14946
14947 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
14948
14949         * Makefile.am (CCFILES): Add gc.cc.
14950         (HFILES): Add gc.h.
14951         * Makefile.in: Regenerate.
14952         * gold.cc (Gc_runner): New class.
14953         (queue_initial_tasks): Call garbage collection related tasks
14954         when corresponding options are invoked.
14955         (queue_middle_gc_tasks): New function.
14956         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14957         processed early before laying out sections during garbage collection.
14958         * gold.h (queue_middle_gc_tasks): New function.
14959         (is_prefix_of): Move from "layout.cc".
14960         * i386.cc (Target_i386::gc_process_relocs): New function.
14961         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14962         * main.cc (main): Create object of class "Garbage_collection".
14963         * object.cc (Relobj::copy_symbols_data): New function.
14964         (Relobj::is_section_name_included): New function.
14965         (Sized_relobj::do_layout): Allow this function to be called twice
14966         during garbage collection and defer layout of section during the
14967         first call.
14968         * object.h (Relobj::get_symbols_data): New function.
14969         (Relobj::is_section_name_included): New function.
14970         (Relobj::copy_symbols_data): New function.
14971         (Relobj::set_symbols_data): New function.
14972         (Relobj::get_relocs_data): New function.
14973         (Relobj::set_relocs_data): New function.
14974         (Relobj::is_output_section_offset_invalid): New pure virtual function.
14975         (Relobj::gc_process_relocs): New function.
14976         (Relobj::do_gc_process_relocs): New pure virtual function.
14977         (Relobj::sd_): New data member.
14978         (Sized_relobj::is_output_section_offset_invalid): New function.
14979         (Sized_relobj::do_gc_process_relocs): New function.
14980         * options.h (General_options::gc_sections): Modify to not be a no-op.
14981         (General_options::print_gc_sections): New option.
14982         * plugin.cc (Plugin_finish::run): Remove function call to
14983         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
14984         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14985         * reloc.cc (Read_relocs::run): Add task to process relocs and
14986         determine unreferenced sections when doing garbage collection.
14987         (Gc_process_relocs): New class.
14988         (Sized_relobj::do_gc_process_relocs): New function.
14989         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14990         sections that are garbage collected.
14991         * reloc.h (Gc_process_relocs): New class.
14992         * sparc.cc (Target_sparc::gc_process_relocs): New function.
14993         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14994         symbols whose corresponding sections are garbage collected.
14995         (Symbol_table::Symbol_table): Add new parameter for the garbage
14996         collection object.
14997         (Symbol_table::gc_mark_undef_symbols): New function.
14998         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14999         (Symbol_table::gc_mark_dyn_syms): New function.
15000         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15001         as garbage.
15002         (Symbol_table::add_from_object): Likewise.
15003         (Symbol_table::add_from_relobj): When building shared objects, do not
15004         treat externally visible symbols as garbage.
15005         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15006         table information for static and relocatable links.
15007         * symtab.h (Symbol_table::set_gc): New function.
15008         (Symbol_table::gc): New function.
15009         (Symbol_table::gc_mark_undef_symbols): New function.
15010         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15011         (Symbol_table::gc_mark_dyn_syms): New function.
15012         (Symbol_table::gc_): New data member.
15013         * target.h (Sized_target::gc_process_relocs): New pure virtual
15014         function.
15015         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15016         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15017
15018 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15019
15020         * options.h (General_options::gc_sections): Define as a no-op for now.
15021         (General_options::no_keep_memory): Ditto.
15022         (General_options::Bshareable): Define.
15023         * options.cc (General_options::finalize): Honor -Bshareable.
15024
15025 2009-01-20  Andreas Schwab  <schwab@suse.de>
15026
15027         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15028         read the value in the contents, since we don't use it.  Use the
15029         template endianness when writing.
15030         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15031
15032 2009-01-19  Andreas Schwab  <schwab@suse.de>
15033
15034         * configure.tgt (powerpc64-*): Fix targ_obj.
15035
15036 2009-01-15  Ian Lance Taylor  <iant@google.com>
15037
15038         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15039         local symbols when stripping all symbols.
15040
15041 2009-01-14  Cary Coutant  <ccoutant@google.com>
15042
15043         * output.cc (Output_reloc): Add explicit instantiations.
15044
15045 2009-01-14  Cary Coutant  <ccoutant@google.com>
15046
15047         * archive.cc (Archive::get_elf_object_for_member): Remove call
15048         to File_read::claim_for_plugin.
15049         * descriptors.cc (Descriptors::open): Remove reference to
15050         is_claimed.
15051         (Descriptors::claim_for_plugin): Remove.
15052         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15053         (Descriptors::is_claimed): Remove.
15054         (claim_descriptor_for_plugin): Remove.
15055         * fileread.cc (File_read::claim_for_plugin): Remove.
15056         * fileread.h (File_read::claim_for_plugin): Remove.
15057         (File_read::descriptor): Reopen descriptor if necessary.
15058         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15059         (Plugin_manager::all_symbols_read): Add task parameter. Change
15060         all callers.
15061         (Plugin_manager::get_input_file): New function.
15062         (Plugin_manager::release_input_file): New function.
15063         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15064         corresponding data member.
15065         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15066         and pass to base constructor. Change all callers.
15067         (get_input_file, release_input_file): New functions.
15068         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15069         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15070         (Plugin_manager::all_symbols_read): Add task parameter.
15071         (Plugin_manager::get_input_file): New function.
15072         (Plugin_manager::release_input_file): New function.
15073         (Plugin_manager::task_): New data member.
15074         (Pluginobj::Pluginobj): Add filesize parameter.
15075         (Pluginobj::filename): New function.
15076         (Pluginobj::descriptor): New function.
15077         (Pluginobj::filesize): New function.
15078         (Pluginobj::filesize_): New data member.
15079         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15080         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15081         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15082
15083         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15084         with archive libraries.
15085         * testsuite/Makefile.in: Regenerate.
15086         * testsuite/plugin_test.c (struct sym_info): New type.
15087         (get_input_file, release_input_file): New static variables.
15088         (onload): Capture new transfer vector entries.
15089         (claim_file_hook): Stop reading at end of file according to filesize.
15090         Factor out parsing of readelf output into separate function.
15091         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15092         APIs and get the source file name from the symbol table.  Convert
15093         source file name to corresponding object file name.  Print info
15094         message when adding new input files.
15095         (parse_readelf_line): New function.
15096         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15097         * testsuite/plugin_test_2.sh: Likewise.
15098         * testsuite/plugin_test_3.sh: Likewise.
15099         * testsuite/plugin_test_4.sh: New test case.
15100
15101 2009-01-07  Ian Lance Taylor  <iant@google.com>
15102
15103         * version.cc (version_string): Bump to 1.8.
15104
15105 2008-12-23  Cary Coutant  <ccoutant@google.com>
15106
15107         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15108         * plugin.cc (Plugin_manager::finish): Rename as
15109         layout_deferred_objects.  Move cleanup to separate function.
15110         (Plugin_manager::cleanup): New function.
15111         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15112         separately.
15113         * plugin.h (Plugin_manager::finish): Rename as
15114         layout_deferred_objects.
15115         (Plugin_manager::cleanup): New function.
15116         (Plugin_manager::cleanup_done): New field.
15117
15118 2008-12-23  Cary Coutant  <ccoutant@google.com>
15119
15120         * plugin.cc (is_visible_from_outside): New function.
15121         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15122         so we don't return "IR only" status for exported symbols or -r links.
15123
15124         * testsuite/Makefile.am (plugin_test_3): New test case.
15125         * testsuite/Makefile.in: Regenerate.
15126         * testsuite/plugin_test_3.sh: New file.
15127
15128 2008-12-22  Cary Coutant  <ccoutant@google.com>
15129
15130         * object.cc (Sized_relobj::layout_section): New function.
15131         (Sized_relobj::do_layout): Defer layout of input sections until after
15132         plugin has provided replacement files.
15133         (Sized_relobj::do_layout_deferred_sections): New function.
15134         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15135         (Relobj::layout_deferred_sections): New function.
15136         (Relobj::do_layout_deferred_sections): New function.
15137         (Sized_relobj::do_layout_deferred_sections): New function.
15138         (Sized_relobj::layout_section): New function.
15139         (Sized_relobj::Deferred_layout): New structure.
15140         (Sized_relobj::deferred_layout_): New field.
15141         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15142         Change all callers.  Layout deferred sections.
15143         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15144         references.
15145         (Plugin_hook::run): Move code from do_plugin_hook inline.
15146         (Plugin_hook::do_plugin_hook): Remove.
15147         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15148         (Plugin_manager::finish): Renamed, was cleanup.
15149         (Plugin_manager::should_defer_layout): New function.
15150         (Plugin_manager::add_deferred_layout_object): New function.
15151         (Plugin_manager::Deferred_layout_list): New type.
15152         (Plugin_manager::deferred_layout_objects_): New field.
15153         (Plugin_hook::do_plugin_hook): Remove.
15154
15155 2008-12-17  Ian Lance Taylor  <iant@google.com>
15156
15157         * options.h (class General_options): Add --no case for
15158         --export-dynamic.
15159
15160 2008-12-16  Cary Coutant  <ccoutant@google.com>
15161
15162         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15163         vector.
15164         (Plugin_manager::claim_file): Create plugin object even if
15165         plugin did not call the add_symbols callback.
15166         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15167         asking for more symbols than were added.
15168         * testsuite/Makefile.am (plugin_test_1): Add test case with
15169         no global symbols.
15170         (empty.syms): New target.
15171         * testsuite/Makefile.in: Regenerate.
15172         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15173         message. Don't call add_symbols if no globals.
15174         (all_symbols_read_hook): Don't provide replacement for empty
15175         claimed file.
15176
15177 2008-12-12  Ian Lance Taylor  <iant@google.com>
15178
15179         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15180         r_type == 0 for a local symbol with r_sym == 0.
15181         (scan_relocatable_relocs): Pass r_sym to
15182         local_non_section_strategy.
15183         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15184         r_sym parameter.
15185
15186         * configure.ac: Update test for TLS descriptors: they are
15187         supported as of glibc 2.9.
15188         * configure: Rebuild.
15189
15190 2008-12-11  Ian Lance Taylor  <iant@google.com>
15191
15192         PR 7091
15193         * target-reloc.h (Default_scan_relocatable_relocs): For each
15194         function, map r_type == 0 to RELOC_DISCARD.
15195
15196 2008-12-10  Cary Coutant  <ccoutant@google.com>
15197
15198         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15199         object to override a kept COMDAT group from a plugin object.
15200
15201 2008-12-09  Ian Lance Taylor  <iant@google.com>
15202
15203         PR 7088
15204         * yyscript.y (file_cmd): Handle INPUT.
15205
15206         * testsuite/initpri1.c: Change all declarations to be full
15207         prototypes by adding void, to avoid compiler warnings.
15208
15209 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15210
15211         * options.cc (General_options::parse_plugin_opt): New.
15212         (General_options::add_plugin): The argument now is just the filename.
15213         (General_options::add_plugin_option): New.
15214         * options.h (plugin_opt): New.
15215         (add_plugin): Change argument name.
15216         (add_plugin_option): New.
15217         * plugin.cc (Plugin::load): Don't parse the plugin option.
15218         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15219         (Plugin::add_option): New.
15220         (Plugin::args_): Change type.
15221         (Plugin::filename_): New.
15222         (Plugin_manager::add_plugin_option): New.
15223         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15224         * testsuite/Makefile.in: Regenerate.
15225
15226 2008-12-05  Cary Coutant  <ccoutant@google.com>
15227
15228         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15229         Handle --strip-lto-sections option.
15230         * options.h (strip_lto_sections): New option.
15231
15232 2008-12-01  Cary Coutant  <ccoutant@google.com>
15233
15234         * plugin.cc (ld_plugin_message): Change format parameter to const.
15235         Fix mismatch between new[] and delete.
15236
15237 2008-11-14  Cary Coutant  <ccoutant@google.com>
15238
15239         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15240         instead of -1U.
15241
15242 2008-11-05  Craig Silverstein  <csilvers@google.com>
15243
15244         * options.cc (General_options::parse_dynamic_list): New function.
15245         * options.h (General_options): New flags dynamic_list,
15246         dynamic_list_data, dynamic_list_cpp_new, and
15247         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15248         (General_options::in_dynamic_list): New function.
15249         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15250         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15251         (Lex::can_continue_name): Likewise.
15252         (yylex): Likewise.
15253         (read_script_file): New parameter script_options.
15254         (read_dynamic_list): New function.
15255         (Script_options::define_dynamic_list): New function.
15256         (dynamic_list_keyword_parsecodes): New variable.
15257         (dynamic_list_keywords): New variable.
15258         * script.h (Script_options::define_dynamic_list): New function
15259         prototype.
15260         (read_dynamic_list): New function prototype.
15261         * symtab.cc (strprefix): New macro.
15262         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15263         dynamic_list_data, dynamic_list_cpp_new, and
15264         dynamic_list_cpp_typeinfo.
15265         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15266         (dynamic_list_expr): New rule.
15267         (dynamic_list_nodes): Likewise.
15268         (dynamic_list_node): Likewise.
15269         * testsuite/Makefile.am (dynamic_list): New test.
15270         * testsuite/Makefile.in: Regenerated.
15271         * testsuite/dynamic_list.t: New file.
15272         * testsuite/dynamic_list.sh: New file.
15273
15274 2008-11-05  Craig Silverstein  <csilvers@google.com>
15275
15276         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15277         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15278         (t11_last): Likewise.
15279         * testsuite/ver_test_6.c (main): Likewise.
15280
15281 2008-10-07  Cary Coutant  <ccoutant@google.com>
15282
15283         * options.c (General_options::finalize): Add check for -static and
15284         -shared.
15285         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15286         is not empty.
15287
15288 2008-10-02  Cary Coutant  <ccoutant@google.com>
15289
15290         * plugin.cc (make_sized_plugin_object): Fix conditional
15291         compilation to work when not all targets are enabled.
15292
15293 2008-09-29  Cary Coutant  <ccoutant@google.com>
15294
15295         * archive.cc (Archive::get_file_and_offset): Use filename instead
15296         of name to get library path.
15297         (Archive::include_member): Unlock external member of a thin archive.
15298
15299         * testsuite/Makefile.am (TEST_AR): New variable.
15300         (thin_archive_test_1): New test.
15301         (thin_archive_test_2): New test.
15302         * testsuite/Makefile.in: Regenerate.
15303         * testsuite/thin_archive_main.cc: New file.
15304         * testsuite/thin_archive_test_1.cc: New file.
15305         * testsuite/thin_archive_test_2.cc: New file.
15306         * testsuite/thin_archive_test_3.cc: New file.
15307         * testsuite/thin_archive_test_4.cc: New file.
15308
15309 2008-09-29  Cary Coutant  <ccoutant@google.com>
15310
15311         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15312         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15313         instead of -1U.
15314         (Sized_relobj::do_finalize_local_symbols): Likewise.
15315         (Sized_relobj::map_to_kept_section): Likewise.
15316         * object.h (Sized_relobj::invalid_address): New constant.
15317         (Sized_relobj::do_output_section_offset): Check for invalid_address
15318         and return -1ULL.
15319         * output.cc (Output_reloc::local_section_offset): Use constant
15320         invalid_address instead of -1U.
15321         (Output_reloc::get_address): Likewise.
15322         (Output_section::output_address): Change -1U to -1ULL.
15323         * output.h (Output_reloc::invalid_address): New constant.
15324         * reloc.cc (Sized_relobj::write_sections): Use constant
15325         invalid_address instead of -1U.
15326         (Sized_relobj::relocate_sections): Likewise.
15327         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15328         values for merge sections.
15329         * target-reloc.h (relocate_for_relocatable): Use constant
15330         invalid_address instead of -1U.
15331
15332 2008-09-19  Cary Coutant  <ccoutant@google.com>
15333
15334         Add plugin functionality for link-time optimization (LTO).
15335         * configure.ac (plugins): Add --enable-plugins option.
15336         * configure: Regenerate.
15337         * config.in: Regenerate.
15338         * Makefile.am (LIBDL): New variable.
15339         (CCFILES): Add plugin.cc.
15340         (HFILES): Add plugin.h.
15341         (ldadd_var): Add LIBDL.
15342         * Makefile.in: Regenerate.
15343
15344         * archive.cc: Include "plugin.h".
15345         (Archive::setup): Don't preread archive symbols when using a plugin.
15346         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15347         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15348         files.
15349         (Archive::include_member): Add symbols from plugin objects.
15350         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15351         * descriptors.cc (Descriptors::open): Check for file descriptors
15352         abandoned by plugins.
15353         (Descriptors::claim_for_plugin): New function.
15354         * descriptors.h (Descriptors::claim_for_plugin): New function.
15355         (Open_descriptor::is_claimed): New field.
15356         (claim_descriptor_for_plugin): New function.
15357         * fileread.cc (File_read::claim_for_plugin): New function.
15358         * fileread.h (File_read::claim_for_plugin): New function.
15359         (File_read::descriptor): New function.
15360         * gold.cc: Include "plugin.h".
15361         (queue_initial_tasks): Add task to call plugin hooks for generating
15362         new object files.
15363         * main.cc: Include "plugin.h".
15364         (main): Load plugin libraries.
15365         * object.h (Pluginobj): Declare.
15366         (Object::pluginobj): New function.
15367         (Object::do_pluginobj): New function.
15368         (Object::set_target): New function.
15369         * options.cc: Include "plugin.h".
15370         (General_options::parse_plugin): New function.
15371         (General_options::General_options): Initialize plugins_ field.
15372         (General_options::add_plugin): New function.
15373         * options.h (Plugin_manager): Declare.
15374         (General_options): Add --plugin option.
15375         (General_options::has_plugins): New function.
15376         (General_options::plugins): New function.
15377         (General_options::add_plugin): New function.
15378         (General_options::plugins_): New field.
15379         * plugin.cc: New file.
15380         * plugin.h: New file.
15381         * readsyms.cc: Include "plugin.h".
15382         (Read_symbols::do_read_symbols): Check for archive before checking
15383         for ELF file.  Call plugin hooks to claim files.
15384         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15385         from a real object file; force override when processing replacement
15386         files.
15387         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15388         (Symbol::init_base_object): Likewise.
15389         (Symbol::init_base_output_data): Likewise.
15390         (Symbol::init_base_output_segment): Likewise.
15391         (Symbol::init_base_constant): Likewise.
15392         (Symbol::init_base_undefined): Likewise.
15393         (Symbol::output_section): Assert that object is not a plugin.
15394         (Symbol_table::add_from_pluginobj): New function.
15395         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15396         undefined.
15397         (Symbol_table::sized_write_globals): Likewise.
15398         (Symbol_table::add_from_pluginobj): Instantiate template.
15399         * symtab.h (Sized_pluginobj): Declare.
15400         (Symbol::in_real_elf): New function.
15401         (Symbol::set_in_real_elf): New function.
15402         (Symbol::in_real_elf_): New field.
15403         (Symbol_table::add_from_pluginobj): New function.
15404
15405         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15406         (LIBDL): New variable.
15407         (LDADD): Add LIBDL.
15408         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15409         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15410         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15411         (MOSTLYCLEANFILES): Likewise.
15412         * testsuite/Makefile.in: Regenerate.
15413         * testsuite/plugin_test.c: New file.
15414         * testsuite/plugin_test_1.sh: New file.
15415         * testsuite/plugin_test_2.sh: New file.
15416
15417 2008-09-16  Ian Lance Taylor  <iant@google.com>
15418
15419         * target-reloc.h (relocate_section): Check whether a symbol is
15420         defined by the ABI before reporting an undefined symbol error.
15421         * target.h (Target::is_defined_by_abi): Make parameter const.
15422         (Target::do_is_defined_by_abi): Likewise.
15423         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15424         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15425         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15426         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15427         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15428         * testsuite/Makefile.in: Rebuild.
15429
15430         * fileread.cc (make_view): Add casts to avoid warning.
15431
15432 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15433
15434         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15435         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15436
15437 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15438
15439         * options.h (General_options::output_is_executable): New.
15440         (General_options::output_is_pie): New.
15441         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15442         for shared libraries.
15443         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15444
15445 2008-09-11  Chris Demetriou  <cgd@google.com>
15446
15447         * options.h (origin): New -z option.
15448         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15449         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15450         in DT_FLAGS_1.
15451
15452 2008-09-05  Cary Coutant  <ccoutant@google.com>
15453
15454         * fileread.cc (File_read::make_view): Add check for attempt to map
15455         beyond end of file.
15456
15457 2008-09-05  Cary Coutant  <ccoutant@google.com>
15458
15459         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15460         explicit instantiations.
15461
15462 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15463
15464         PR gold/6858
15465         * options.cc (General_options::finalize): Allow undefined symbols
15466         in shlibs if linking -shared.
15467
15468         PR gold/6859
15469         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15470         symbols as not needing a dynsym entry.
15471
15472 2008-08-20  Craig Silverstein  <csilvers@google.com>
15473
15474         * fileread.cc (File_read::open): Do not lock the file unless it
15475         was successfully opened.
15476
15477 2008-08-14  Cary Coutant  <ccoutant@google.com>
15478
15479         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15480         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15481         * testsuite/tls_test.cc (struct int128): 128-bit struct
15482         for testing TLS relocs with non-zero addend.
15483         (v12): New TLS variable.
15484         (t12): New test.
15485         (t_last): Add check for v12.
15486         * testsuite/tls_test.h (t12): New function.
15487         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15488
15489 2008-08-13  Ian Lance Taylor  <iant@google.com>
15490
15491         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15492         set tls_segment_ or relro_segment_.
15493         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15494         when appropriate.
15495         * output.h (Output_section::clear_is_relro): New function.
15496         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15497         sections specially even when output_data_ is empty.
15498         (Output_segment::maximum_alignment): When first section is relro,
15499         only force alignment for PT_LOAD segments.
15500         * script.cc (script_data_segment_align): New function.
15501         (script_data_segment_relro_end): New function.
15502         * script-c.h (script_data_segment_align): Declare.
15503         (script_data_segment_relro_end): Declare.
15504         * script-sections.h (class Script_sections): Declare
15505         data_segment_align and data_segment_relro_end.  Add fields
15506         segment_align_index_ and saw_relro_end_.
15507         * script-sections.cc (class Sections_element): Add set_is_relro
15508         virtual function.  Add new bool* parameter to place_orphan_here.
15509         Add get_output_section virtual function.
15510         (class Output_section_definition): Add set_is_relro.  Add new
15511         bool* parameter to place_orphan_here.  Add get_output_section.
15512         Add is_relro_ field.
15513         (Output_section_definition::Output_section_definition): Initialize
15514         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15515         and is_relro_ fields.
15516         (Output_section_definition::place_orphan_here): Add is_relro
15517         parameter.
15518         (Output_section_definition::set_section_addresses): Set relro for
15519         output section.
15520         (Output_section_definition::alternate_constraint): Likewise.
15521         (class Orphan_output_section): Add new bool* parameter to
15522         place_orphan_here.  Add get_output_section.
15523         (Orphan_output_section::place_orphan_here): Add is_relro
15524         parameter.
15525         (Script_sections::Script_sections): Initialize
15526         data_segment_align_index_ and saw_relro_end_.
15527         (Script_sections::data_segment_align): New function.
15528         (Script_sections::data_segment_relro_end): New function.
15529         (Script_sections::place_orphan): Set or clear is_relro.
15530         (Script_sections::set_section_addresses): Force alignment of first
15531         TLS section.
15532         * yyscript.y (exp): Call script_data_segment_align and
15533         script_data_segment_relro_end.
15534         * testsuite/relro_script_test.t: New file.
15535         * testsuite/relro_test.cc (using_script): Declare.
15536         (t1, t2): Test using_script.
15537         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15538         (relro_script_test_SOURCES): Define.
15539         (relro_script_test_DEPENDENCIES): Define.
15540         (relro_script_test_LDFLAGS): Define.
15541         (relro_script_test_LDADD): Define.
15542         (relro_script_test.so): New target.
15543         * testsuite/Makefile.in: Rebuild.
15544
15545 2008-08-06  Cary Coutant <ccoutant@google.com>
15546
15547         * archive.cc (Archive::total_archives, Archive::total_members)
15548         (Archive::total_members_loaded): New variables.
15549         (Archive::setup): Add parameter.  Add option to preread
15550         archive symbols.
15551         (Archive::read_armap): Add counter.
15552         (Archive::get_file_and_offset): New function.
15553         (Archive::get_elf_object_for_member): New function.
15554         (Archive::read_all_symbols): New function.
15555         (Archive::read_symbols): New function.
15556         (Archive::add_symbols): Add counters.
15557         (Archive::include_all_members): Use armap to find members if it's
15558         already built.
15559         (Archive::include_member): Skip reading symbols if already read.
15560         Factored code into Archive::get_file_and_offset and
15561         Archive::get_elf_object_for_member.  Changed call to
15562         Mapfile::report_include_archive_member.
15563         (Archive::print_stats): New function.
15564         * archive.h: Declare Object and Read_symbols_data classes.
15565         (Archive::Archive): Add initializers for new members.
15566         (Archive::setup): Add parameter.
15567         (Archive::print_stats): New function.
15568         (Archive::total_archives, Archive::total_members)
15569         (Archive::total_members_loaded): New variables.
15570         (Archive::get_file_and_offset): New function.
15571         (Archive::get_elf_object_for_member): New function.
15572         (Archive::read_all_symbols): New function.
15573         (Archive::read_symbols): New function.
15574         (Archive::Archive_member): New class.
15575         (Archive::members_): New member.
15576         (Archive::num_members_): New member.
15577         * main.cc: Include archive.h.
15578         (main): Call Archive::print_stats.
15579         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15580         archive parameter; member_name is now the fully-decorated name.
15581         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15582         * options.h: (General_options): Add --preread-archive-symbols option.
15583         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15584         Archive::setup.
15585
15586 2008-08-04  Ian Lance Taylor  <iant@google.com>
15587
15588         * symtab.h (Symbol::use_plt_offset): New function.
15589         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15590         * powerpc.cc (Relocate::relocate): Likewise.
15591         * sparc.cc (Relocate::relocate): Likewise.
15592         * x86_64.cc (Relocate::relocate): Likewise.
15593         * testsuite/weak_plt.sh: New test.
15594         * testsuite/weak_plt_main.cc: New test.
15595         * testsuite/weak_plt_shared.cc: New test.
15596         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15597         (check_PROGRAMS): Add weak_plt.
15598         (check_DATA): Add weak_plt_shared.so.
15599         (weak_plt_main_pic.o, weak_plt): New targets.
15600         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15601         * testsuite/Makefile.in: Rebuild.
15602
15603         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15604         gcctestdir/ld.
15605         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15606         * testsuite/Makefile.in: Rebuild.
15607
15608 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15609
15610         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15611         * Makefile.in: Regenerate.
15612         * po/POTFILES.in: Regenerate.
15613
15614 2008-07-29  Ian Lance Taylor  <iant@google.com>
15615
15616         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15617         symbols before other symbols.
15618         * testsuite/script_test_2.cc (test_addr): Declare.
15619         (test_addr_alias): Declare.
15620         (main): Check that test_addr and test_addr_alias have the right
15621         values.
15622         * testsuite/script_test_2.t: Define test_addr_alias and
15623         test_addr.
15624
15625 2008-07-24  Ian Lance Taylor  <iant@google.com>
15626
15627         PR 5990
15628         * descriptors.cc: New file.
15629         * descriptors.h: New file.
15630         * gold-threads.h (class Hold_optional_lock): New class.
15631         * fileread.cc: Include "descriptors.h".
15632         (File_read::~File_read): Release descriptor rather than closing
15633         it.
15634         (File_read::open) [file]: Call open_descriptor rather than open.
15635         Set is_descriptor_opened_.
15636         (File_read::open) [memory]: Assert that descriptor is not open.
15637         (File_read::reopen_descriptor): New function.
15638         (File_read::release): Release descriptor.
15639         (File_read::do_read): Make non-const.  Reopen descriptor.
15640         (File_read::read): Make non-const.
15641         (File_read::make_view): Reopen descriptor.
15642         (File_read::do_readv): Likewise.
15643         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15644         Update declarations.
15645         * layout.cc: Include "descriptors.h".
15646         (Layout::create_build_id): Use open_descriptor rather than open.
15647         * output.cc: Include "descriptors.h".
15648         (Output_file::open): Use open_descriptor rather than open.
15649         * archive.cc (Archive::const_iterator): Change Archive to be
15650         non-const.
15651         (Archive::begin, Archive::end): Make non-const.
15652         (Archive::count_members): Likewise.
15653         * archive.h (class Archive): Update declarations.
15654         * object.h (Object::read): Make non-const.
15655         * Makefile.am (CCFILES): Add descriptors.cc.
15656         (HFILES): Add descriptors.h.
15657         * Makefile.in: Rebuild.
15658
15659         PR 6716
15660         * gold.h: Always include <clocale>.  Add Solaris workarounds
15661         following code in binutils/sysdep.h.
15662
15663         PR 6048
15664         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15665         this->eh_frame_hdr_ is NULL before using it.
15666
15667         * dynobj.cc (Versions::Versions): Update comment.
15668
15669         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15670         the base version name.
15671
15672         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15673         array size plus one.
15674         (Stringpool_template::set_string_offsets): Subtract one from key
15675         before using it as an array index.
15676         (Stringpool_template::get_offset_with_length): Likewise.
15677         (Stringpool_template::write_to_buffer): Likewise.
15678         * stringpool.h (Stringpool_template::get_offset_from_key):
15679         Likewise.
15680
15681 2008-07-23  Ian Lance Taylor  <iant@google.com>
15682
15683         PR 6658
15684         * object.h (Merged_symbol_value::value): Do our best to handle a
15685         negative addend.
15686
15687         PR 6647
15688         * script.cc (Version_script_info::get_versions): Don't add empty
15689         version tag to return value.
15690         (Version_script_info::get_symbol_version_helper): Change return
15691         type to bool.  Add pversion parameter.  Change all callers.
15692         (script_register_vers_node): Don't require a non-NULL tag.
15693         * script.h (class Version_script_info): Update declarations.
15694         (Version_script_info::get_symbol_version): Change return type to
15695         bool.  Add version parameter.  Change all callers.
15696         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15697         handling.  Handle an empty version from a version script.
15698         (Symbol_table::define_special_symbol): Likewise.
15699         * testsuite/ver_test_10.script: New file.
15700         * testsuite/ver_test_10.sh: New file.
15701         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15702         (check_DATA): Add ver_test_10.syms.
15703         (ver_test_10.syms, ver_test_10.so): New target.
15704         * testsuite/Makefile.in: Rebuild.
15705
15706 2008-07-23  Simon Baldwin  <simonb@google.com>
15707
15708         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15709         to zero for undefined symbols from dynamic libraries.
15710
15711 2008-07-23  Ian Lance Taylor  <iant@google.com>
15712
15713         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15714         Change all callers.
15715         * symtab.h (class Symbol_table): Update declaration.
15716         * testsuite/ver_test_9.cc: New file.
15717         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15718         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15719         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15720         (ver_test_9.so, ver_test_9.o): New targets.
15721         * testsuite/Makefile.in: Rebuild.
15722
15723 2008-07-22  Ian Lance Taylor  <iant@google.com>
15724
15725         * options.h (class General_options): Define --check-sections.
15726         * layout.cc (Layout::set_segment_offsets): Handle
15727         --check-sections.
15728
15729         * options.h (class General_options): Define -n/--nmagic and
15730         -N/--omagic.
15731         * options.cc (General_options::finalize): For -n/--nmagic or
15732         -N/--omagic, set -static.
15733         * layout.cc (Layout::attach_allocated_section_to_segment): If
15734         -N/--omagic, don't put read-only and read-write sections in
15735         different segments.
15736         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15737         finding a read-only segment.
15738         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15739         don't set the minimum segment alignment to the common page size,
15740         and don't set the file offset to the address modulo the page size.
15741         * script-sections.cc (Script_sections::create_segments): If
15742         -n/--omagic, don't put read-only and read-write sections in
15743         different segments.
15744
15745         * cref.cc: New file.
15746         * cref.h: New file.
15747         * options.h (class General_options): Add --print-symbol-counts.
15748         * main.cc (main): Issue defined symbol report if requested.
15749         * archive.cc (Archive::interpret_header): Make into a const member
15750         function.
15751         (Archive::add_symbols): Call Input_objects::archive_start and
15752         archive_stop.
15753         (Archive::const_iterator): Define new class.
15754         (Archive::begin, Archive::end): New functions.
15755         (Archive::include_all_members): Rewrite to use iterator.
15756         (Archive::count_members): New function.
15757         * archive.h (class Archive): Update declarations.
15758         (Archive::filename): New function.
15759         * object.cc: Include "cref.h".
15760         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15761         (Sized_relobj::do_get_global_symbol_counts): New function.
15762         (Input_objects::add_object): Add object to cross-referencer.
15763         (Input_objects::archive_start): New function.
15764         (Input_objects::archive_stop): New function.
15765         (Input_objects::print_symbol_counts): New function.
15766         * object.h: Declare Cref and Archive.
15767         (Object::get_global_symbol_counts): New function.
15768         (Object::do_get_global_symbol_counts): New pure virtual function.
15769         (class Sized_relobj): Add defined_count_ field.  Update
15770         declarations.
15771         (class Input_objects): Add cref_ field.  Update constructor.
15772         Update declarations.
15773         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15774         defined_count_.
15775         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15776         symbol counts.
15777         (Sized_dynobj::do_get_global_symbol_counts): New function.
15778         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15779         defined_count_.  Update declarations.  Define Symbols typedef.
15780         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15781         parameter.  Change all callers.
15782         (Symbol_table::add_from_dynobj): Add sympointers and defined
15783         parameters.  Change all callers.
15784         * symtab.h (class Symbol_table): Update declarations.
15785         * Makefile.am (CCFILES): Add cref.cc.
15786         (HFILES): Add cref.h.
15787         * Makefile.in: Rebuild.
15788
15789 2008-07-22  Simon Baldwin  <simonb@google.com>
15790
15791         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15792         to zero when writing undefined symbols.
15793
15794 2008-07-22  Ian Lance Taylor  <iant@google.com>
15795
15796         * output.cc (Output_section::add_input_section): Don't try to
15797         merge empty merge sections.
15798
15799 2008-07-21  Craig Silverstein  <csilvers@google.com>
15800
15801         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15802         Include symbol version in error message.
15803
15804 2008-07-20  Chris Demetriou  <cgd@google.com>
15805
15806         * configure.ac (gold_cv_c_random_seed): New configured variable.
15807         (RANDOM_SEED_CFLAGS): New substituted variable.
15808         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15809         * configure: Rebuild.
15810         * Makefile.in: Likewise.
15811         * testsuite/Makefile.in: Likewise.
15812
15813 2008-07-18  Ian Lance Taylor  <iant@google.com>
15814
15815         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15816         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15817         * testsuite/ver_test_main.cc (main): Call t4.
15818         (t4, t4_2a): Define.
15819         * testsuite/ver_test_2.cc (t4_2): Define.
15820         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15821         * testsuite/ver_test_4.cc (t4_2a): Define.
15822         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15823         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15824
15825 2008-07-17  Ian Lance Taylor  <iant@google.com>
15826
15827         * dynobj.cc (Versions::add_def): If we give an error about a
15828         missing version, go ahead and create the version anyhow.
15829
15830 2008-07-10  Ian Lance Taylor  <iant@google.com>
15831
15832         Handle output sections with more than 0x7fffffff bytes.
15833         * object.h (class Relobj): Change map_to_output_ to
15834         output_sections_, and just keep a section pointer.  Change all
15835         uses.  Move comdat group support to Sized_relobj.
15836         (Relobj::is_section_specially_mapped): Remove.
15837         (Relobj::output_section): Remove poff parameter.  Change all
15838         callers.
15839         (Relobj::output_section_offset): New function.
15840         (Relobj::set_section_offset): Rewrite.
15841         (Relobj::map_to_output): Remove.
15842         (Relobj::output_sections): New function.
15843         (Relobj::do_output_section_offset): New pure virtual function.
15844         (Relobj::do_set_section_offset): Likewise.
15845         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15846         group support from Relobj.  Update declarations.
15847         (Sized_relobj::get_output_section_offset): New function.
15848         (Sized_relobj::do_output_section_offset): New function.
15849         (Sized_relobj::do_set_section_offset): New function.
15850         * object.cc (Relobj::output_section_address): Remove.
15851         (Sized_relobj::Sized_relobj): Initialize new fields.
15852         (Sized_relobj::include_section_group): Cast find_kept_object to
15853         Sized_relobj.
15854         (Sized_relobj::include_linkonce_section): Likewise.
15855         (Sized_relobj::do_layout): Use separate arrays for output section
15856         and output offset.
15857         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15858         output_sections.
15859         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15860         output_sections and section_offsets.
15861         (Sized_relobj::write_local_symbols): Likewise.
15862         (map_to_kept_section): Compute output address directly.
15863         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15864         output_sections and section_offsets.
15865         (Sized_relobj::write_sections): Likewise.
15866         (Sized_relobj::relocate_sections): Likewise.
15867         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15868         * output.h (class Output_reloc): Update declarations.  Change
15869         u2_.relobj to Sized_relobj*.
15870         (class Output_data_reloc): Change add functions to use
15871         Sized_relobj*.
15872         * output.cc (Output_reloc::Output_reloc): Change relobj to
15873         Sized_relobj*.
15874         (Output_reloc::local_section_offset): Change return type to
15875         Elf_Addr.  Use get_output_section_offset.
15876         (Output_reloc::get_address): Likewise.
15877         (Output_section::is_input_address_mapped): Don't call
15878         is_section_specially_mapped.
15879         (Output_section::output_offset): Likewise.
15880         (Output_section::output_address): Likewise.
15881         (Output_section::starting_output_address): Likewise.
15882         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15883         parameter to Sized_relobj*.
15884         (Copy_relocs::need_copy_reloc): Likewise.
15885         (Copy_relocs::save): Likewise.
15886         * copy-relocs.h (class Copy_relocs): Update declarations.
15887         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15888         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
15889         * target-reloc.h (relocate_for_relocatable): Change
15890         offset_in_output_section type to Elf_Addr.  Change code that uses
15891         it as well.
15892         * layout.cc (Layout::layout): Always set *off.
15893         * mapfile.cc (Mapfile::print_input_section): Use
15894         output_section_offset.
15895         * i386.cc (Target_i386::copy_reloc): Change object parameter to
15896         Sized_relobj*.
15897         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15898         * sparc.cc (Target_sparc::copy_reloc): Likewise.
15899         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15900
15901 2008-07-03  Ian Lance Taylor  <iant@google.com>
15902
15903         * layout.cc (Layout::include_section): Do not discard unrecognized
15904         SHT_STRTAB sections.
15905
15906 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
15907
15908         * script.cc (Lex::can_continue_name): Make '?' allowable in
15909         version-script names.
15910         * testsuite/version_script.map: Change glob pattern to use '?'
15911
15912 2008-06-30  Manish Singh  <yosh@gimp.org>
15913
15914         PR 6585
15915         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15916         Correct typo.
15917
15918 2008-06-30  Ian Lance Taylor  <iant@google.com>
15919
15920         PR 6660
15921         PR 6682
15922         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15923         versions]: Don't try to read the value in the contents, since we
15924         don't use it.  Use the template endianness when writing.
15925
15926 2008-06-25  Cary Coutant  <ccoutant@google.com>
15927
15928         * fileread.cc (File_read::make_view): Assert on zero-length view.
15929         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15930         symbol table when there are no symbols to read.
15931
15932 2008-06-23  Craig Silverstein  <csilvers@google.com>
15933
15934         * version.cc (version_string): Bump to 1.7
15935
15936 2008-06-18  Craig Silverstein  <csilvers@google.com>
15937
15938         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15939         constant 0xFFFF to type Valtype.
15940         (Powerpc_relocate_functions::rel16_ha): Likewise.
15941
15942 2008-06-17  Ian Lance Taylor  <iant@google.com>
15943
15944         * output.h (Output_section::Input_section): Initialize p2align_ to
15945         zero for Output_section_data constructors.
15946         (Output_section::Input_section::addralign): If not an input
15947         section, return the alignment of the Output_section_data.
15948         * testsuite/copy_test.cc: New file.
15949         * testsuite/copy_test_1.cc: New file.
15950         * testsuite/copy_test_2.cc: New file.
15951         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15952         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15953         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15954         (copy_test_1_pic.o, copy_test_1.so): New targets.
15955         (copy_test_2_pic.o, copy_test_2.so): New targets.
15956         * testsuite/Makefile.in: Rebuild.
15957
15958         * script-sections.cc (Script_sections::place_orphan): Initialize
15959         local variable exact.
15960
15961 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
15962
15963         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15964
15965 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
15966             David S. Miller  <davem@davemloft.net>
15967
15968         * powerpc.cc: New file.
15969         * Makefile.am (TARGETSOURCES): Add powerpc.cc
15970         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15971         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15972         * Makefile.in: Rebuild.
15973
15974 2008-06-09  Ian Lance Taylor  <iant@google.com>
15975
15976         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15977         <exception>.
15978         (throwing, orig_terminate): New static variables.
15979         (terminate_handler): New static function.
15980         (t2): Set terminate handler.
15981
15982 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
15983
15984         PR 6584
15985         * binary.cc (Binary_to_elf::sized_convert): Fix .data
15986         alignment.
15987
15988 2008-05-30  Cary Coutant  <ccoutant@google.com>
15989
15990         * archive.cc (Archive::include_all_members) Correct to step
15991         over symbol table and extended name table in thin archives.
15992
15993 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
15994
15995         PR 6407
15996         * target-reloc.h (relocate_for_relocatable): Fix new_offset
15997         calculation.
15998
15999 2008-05-28  Caleb Howe  <cshowe@google.com>
16000
16001         * reduced_debug_output.cc: New file.
16002         * reduced_debug_output.h: New file.
16003         * options.h (class General_options): Add --strip-debug-non-line.
16004         * options.cc (General_options::finalize): Add strip_debug_non_line
16005         to the strip heirarchy.
16006         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16007         fields.
16008         * layout.cc: Include "reduced_debug_output.h".
16009         (Layout::Layout): Initialize new fields.
16010         (line_only_debug_sections): New static array.
16011         (is_lines_only_debug_sections): New static inline function.
16012         (Layout::include_section): Handle --strip-debug-non-line.
16013         (Layout::make_output_section): If --strip-debug-non-line, build
16014         new output sections for .debug_abbrev and .debug_info.
16015         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16016         gold.  Warn about possible overflow.
16017         (read_signed_LEB_128): Likewise.
16018         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16019         (read_signed_LEB_128): Declare.
16020         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16021         (HFILES): Add reduced_debug_output.h.
16022         * Makefile.in: Rebuild.
16023
16024 2008-05-21  Ian Lance Taylor  <iant@google.com>
16025
16026         * mapfile.cc: New file.
16027         * mapfile.h: New file.
16028         * options.h (class General_options): Add -M/--print-map and -Map.
16029         * options.cc (General_options::finalize): Make -M equivalent to
16030         -Map -.
16031         * main.cc: Include <cstdio> and "mapfile.h".
16032         (main): Open mapfile if requested.
16033         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16034         constructor.  Change caller.
16035         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16036         (queue_middle_tasks): Likewise.
16037         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16038         declarations.
16039         * archive.cc: Include "mapfile.h".
16040         (Archive::add_symbols): Add mapfile parameter.  Change all
16041         callers.  Pass mapfile, symbol, and reason to include_member.
16042         (Archive::include_all_members): Add mapfile parameter.  Change all
16043         callers.
16044         (Archive::include_member): Add mapfile, sym, and why parameters.
16045         Change all callers.  Report inclusion to map file.
16046         * archive.h: Include "fileread.h".
16047         (class Archive): Update declarations.
16048         (Archive::file): New const method.
16049         (class Add_archive_symbols): Add mapfile_ field.  Update
16050         constructor.  Change all callers.
16051         * readsyms.h (class Read_symbols): Likewise.
16052         (class Finish_group): Likewise.
16053         (class Read_script): Likewise.
16054         * common.cc: Include "mapfile.h".
16055         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16056         all callers.
16057         (Symbol_table::do_allocate_commons): Likewise.
16058         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16059         symbol allocation to mapfile.
16060         * common.h (class Allocate_commons_task): Add mapfile_ field.
16061         Update constructor.  Change all callers.
16062         * symtab.h (class Symbol_table): Update declarations.
16063         * layout.cc: Include "mapfile.h".
16064         (Layout_task_runner::run): Print information to mapfile.
16065         (Layout::create_gold_note): Change Output_data_fixed_space to
16066         Output_data_zero_fill.
16067         (Layout::create_build_id): Likewise.
16068         (Layout::print_to_mapfile): New function.
16069         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16070         constructor.  Change caller.
16071         (class Layout): Declare print_to_mapfile.
16072         * output.cc (Output_section::Input_section::print_to_mapfile): New
16073         function.
16074         (Output_section::add_input_section): If producing a map, always
16075         add to input_sections_ list.
16076         (Output_section::do_print_to_mapfile): New function.
16077         (Output_segment::print_sections_to_mapfile): New function.
16078         (Output_segment::print_section_list_to_mapfile): New function.
16079         * output.h: Include "mapfile.h".
16080         (Output_data::print_to_mapfile): New function.
16081         (Output_data::do_print_to_mapfile): New virtual function.
16082         (Output_segment_headers::do_print_to_mapfile): New function.
16083         (Output_file_header::do_print_to_mapfile): New function.
16084         (Output_data_const::do_print_to_mapfile): New function.
16085         (class Output_data_const_buffer): Add map_name_ field.  Update
16086         constructor.  Change all callers.  Add do_print_to_mapfile
16087         function.
16088         (class Output_data_fixed_space): Likewise.
16089         (class Output_data_space): Likewise.
16090         (class Output_data_zero_fill): New class.
16091         (Output_data_strtab::do_print_to_mapfile): New function.
16092         (Output_data_reloc_base::do_print_to_mapfile): New function.
16093         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16094         (Output_data_group::do_print_to_mapfile): New function.
16095         (Output_data_got::do_print_to_mapfile): New function.
16096         (Output_data_dynamic::do_print_to_mapfile): New function.
16097         (Output_symtab_xindex::do_print_to_mapfile): New function.
16098         (class Output_section): Declare do_print_to_mapflie.  Declare
16099         print_to_mapfile in Input_section.
16100         (class Output_segment): Declare new functions.
16101         * object.h (Sized_relobj::symbol_count): New function.
16102         * script-sections.cc
16103         (Output_section_element_dot_assignment::set_section_addresses):
16104         Change Output_data_fixed_space to Output_data_zero_fill.
16105         (Output_data_expression::do_print_to_mapfile): New function.
16106         * script.cc (read_input_script): Add mapfile parameter.  Change
16107         all callers.
16108         * script.h (read_input_script): Update declaration.
16109         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16110         (Eh_frame::do_print_to_mapfile): New function.
16111         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16112         (Output_merge_string::do_print_to_mapfile): New function.
16113         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16114         function.
16115         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16116         function.
16117         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16118         function.
16119         * Makefile.am (CCFILES): Add mapfile.cc.
16120         (HFILES): Add mapfile.h.
16121         * Makefile.in: Rebuild.
16122
16123 2008-05-19  Ian Lance Taylor  <iant@google.com>
16124
16125         * options.h (class General_options): Add -z relro.
16126         * layout.cc (Layout::Layout): Initialize relro_segment_.
16127         (Layout::add_output_section_data): Return the output section.
16128         (Layout::make_output_section): Rcognize relro sections and mark
16129         them appropriately.
16130         (Layout::attach_allocated_section_to_segment): Put relro sections
16131         in a PT_GNU_RELRO segment.
16132         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16133         section as relro.
16134         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16135         PT_TLS segments.
16136         (Layout::linkonce_mapping): Map d.rel.ro.local to
16137         .data.rel.ro.local.
16138         (Layout::output_section_name): Us .data.rel.ro.local for any
16139         section which begins with that.
16140         * layout.h (class Layout): Update add_output_section_data
16141         declaration.  Add relro_segment_ field.
16142         * output.cc (Output_section::Output_section): Initialize is_relro_
16143         and is_relro_local_ fields.
16144         (Output_segment::add_output_section): Group relro sections.
16145         (Output_segment::is_first_section_relro): New function.
16146         (Output_segment::maximum_alignment): If there is a relro section,
16147         align the segment to the common page size.
16148         (Output_segment::set_section_addresses): Track whether we are
16149         looking at relro sections.  If the last section is a relro
16150         section, align to the common page size.
16151         (Output_segment::set_section_list_addresses): Add in_relro
16152         parameter.  Change all callers.  Align to the page size when
16153         moving from relro to non-relro section.
16154         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16155         segment.
16156         * output.h (class Output_section): Add is_relro_ and
16157         is_relro_local_ fields.
16158         (Output_section::is_relro): New function.
16159         (Output_section::set_is_relro): New function.
16160         (Output_section::is_relro_local): New function.
16161         (Output_section::set_is_relro_local): New function.
16162         (class Output_segment): Update declarations.
16163         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16164         * sparc.cc (Target_sparc::got_section): Likewise.
16165         * x86_64.cc (Target_x86_64::got_section): Likewise.
16166         * testsuite/relro_test_main.cc: New file.
16167         * testsuite/relro_test.cc: New file.
16168         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16169         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16170         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16171         (relro_test.so, relro_test_pic.o): New targets.
16172         * testsuite/Makefile.in: Rebuild.
16173
16174 2008-05-16  Ian Lance Taylor  <iant@google.com>
16175
16176         * output.cc (Output_segment::add_output_section): Remove front
16177         parameter.
16178         * output.h (class Output_segment): Remove
16179         add_initial_output_section and overloaded add_output_section.
16180         Update declaration of remaining add_output_section.
16181         * layout.cc (Layout::create_interp): Call add_output_section
16182         rather than add_initial_output_section.
16183         (Layout::finish_dynamic_section): Likewise.
16184
16185         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16186         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16187         know the dynamic type.
16188         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16189         field.  Initialize it in constructor.
16190         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16191         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16192         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16193         reloc.
16194
16195         * output.cc (Output_reloc::get_address): Change return type to
16196         Elf_Addr.
16197         * output.h (class Output_reloc): Update get_address declaration.
16198         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16199         for section addresses.
16200
16201 2008-05-09  Ian Lance Taylor  <iant@google.com>
16202
16203         PR 6493
16204         * gold.cc (gold_nomem): Use return value of write.
16205
16206 2008-05-08  Ian Lance Taylor  <iant@google.com>
16207
16208         * symtab.c (Symbol::init_base_output_data): Add version
16209         parameter.  Change all callers.
16210         (Symbol::init_base_output_segment): Likewise.
16211         (Symbol::init_base_constant): Likewise.
16212         (Symbol::init_base_undefined): Likewise.
16213         (Sized_symbol::init_output_data): Likewise.
16214         (Sized_symbol::init_output_segment): Likewise.
16215         (Sized_symbol::init_constant): Likewise.
16216         (Sized_symbol::init_undefined): Likewise.
16217         (Symbol_table::do_define_in_output_data): If the new symbol has a
16218         version, mark it as the default.
16219         (Symbol_table::do_define_in_output_segment): Likewise.
16220         (Symbol_table::do_define_as_constant): Likewise.
16221         * symtab.h (class Symbol): Update declarations.
16222         (class Sized_symbol): Likewise.
16223         * resolve.cc (Symbol::override_version): New function.
16224         (Symbol::override_base): Call override_version.
16225         (Symbol::override_base_with_special): Likewise.
16226         * testsuite/ver_script_8.script: New file.
16227         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16228         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16229         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16230         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16231
16232 2008-05-06  Ian Lance Taylor  <iant@google.com>
16233
16234         PR 6049
16235         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16236         functions.
16237         (class General_options): Remove existing --undefined, and add
16238         --no-undefined instead.  Add new --undefined as synonym for -u.
16239         * archive.cc (Archive::add_symbols): Check whether symbol was
16240         named with -u.
16241         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16242         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16243         all uses.  Add IS_UNDEFINED.  Update declarations to split
16244         different versions of init_base.  Declare init_base_undefined.
16245         (Symbol::is_defined): Handle IS_UNDEFINED.
16246         (Symbol::is_undefined): Likewise.
16247         (Symbol::is_weak_undefined): Call is_undefined.
16248         (Symbol::is_absolute): Handle IS_CONSTANT.
16249         (class Sized_symbol): Update declarations to split different
16250         versions of init.  Declare init_undefined.
16251         (class Symbol_table): Declare new functions.
16252         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16253         Change all callers.
16254         (Symbol::init_base_output_data): Likewise.
16255         (Symbol::init_base_output_segment): Likewise.
16256         (Symbol::init_base_constant): Likewise.
16257         (Symbol::init_base_undefined): New function.
16258         (Sized_symbol::init_object): Rename from init.  Change all
16259         callers.
16260         (Sized_symbol::init_output_data): Likewise.
16261         (Sized_symbol::init_output_segment): Likewise.
16262         (Sized_symbol::init_constant): Likewise.
16263         (Sized_symbol::init_undefined): New function.
16264         (Symbol_table::add_undefined_symbols_from_command_line): New
16265         function.
16266         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16267         function.
16268         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16269         (Symbol::output_section): Likewise.
16270         (Symbol::set_output_section): Likewise.
16271         (Symbol_table::sized_finalize_symbol): Likewise.
16272         (Symbol_table::sized_write_globals): Likewise.
16273         * resolve.cc (Symbol_table::should_override): Likewise.
16274         (Symbol::override_base_with_special): Likewise.
16275
16276         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16277         symbol, change it to have default visibility.
16278         * testsuite/protected_1.cc: New file.
16279         * testsuite/protected_2.cc: New file.
16280         * testsuite/protected_3.cc: New file.
16281         * testsuite/protected_main_1.cc: New file.
16282         * testsuite/protected_main_2.cc: New file.
16283         * testsuite/protected_main_3.cc: New file.
16284         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16285         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16286         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16287         (protected_1.so): New target.
16288         (protected_1_pic.o, protected_2_pic.o): New targets.
16289         (protected_3_pic.o): New target.
16290         (check_PROGRAMS): Add protected_2.
16291         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16292         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16293         * testsuite/Makefile.in: Rebuild.
16294
16295         * options.h (DEFINE_var): Add set_user_set_##varname__.
16296         (DEFINE_bool_alias): New macro.
16297         (class General_options): Define -Bstatic using DEFINE_bool_alias
16298         rather than DEFINE_special.  Add --undefined as an alias for -z
16299         defs.
16300         * options.cc (General_options::parse_Bstatic): Remove.
16301
16302         * options.h (class General_options): Add --fatal-warnings.
16303         * main.cc (main): Implement --fatal-warnings.
16304         * errors.h (Errors::warning_count): New function.
16305
16306         * options.h (class General_options): Add -Bsymbolic-functions.
16307         * symtab.h (Symbol::is_preemptible): Check for
16308         -Bsymbolic-functions.
16309
16310 2008-05-05  Ian Lance Taylor  <iant@google.com>
16311
16312         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16313         as noVARNAME rather than no-VARNAME.
16314         (class General_options): Add option -z combreloc.
16315         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16316         get_address.
16317         (Output_reloc::sort_before) [SHT_REL]: New function.
16318         (Output_reloc::sort_before) [SHT_RELA]: New function.
16319         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16320         Sort_relocs_comparison.
16321         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16322         parameter.  Change all callers.
16323         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16324         sort_relocs parameter.  Change all callers.
16325         * output.cc (Output_reloc::get_address): New function, broken out
16326         of write_rel.
16327         (Output_reloc::write_rel): Call it.
16328         (Output_reloc::compare): New function.
16329         (Output_data_reloc_base::do_write): Optionally sort relocs.
16330
16331         * configure.ac: If targ_extra_obj is set, link it in.
16332         * configure.tgt: Initialize all variables.
16333         (x86_64*): Set targ_extra_obj and targ_extra_size.
16334         * configure: Rebuild.
16335
16336         * object.cc (Sized_relobj::include_section_group): Adjust section
16337         indexes read from group data.  Build vector to pass to
16338         layout_group.
16339         * layout.cc (Layout::layout_group): Add flags and shndxes
16340         parameters.  Remove contents parameter.  Change caller.  Update
16341         explicit instantiations.
16342         * layout.h (class Layout): Update layout_group declaration.
16343         * output.cc (Output_data_group::Output_data_group): Add flags and
16344         input_shndxes parameters.  Remove contents parameter.  Change
16345         caller.
16346         (Output_data_group::do_write): Change input_sections_ to
16347         input_shndxes_.
16348         * output.h (class Output_data_group): Update constructor
16349         declaration.  Rename input_sections_ to input_shndxes_.
16350         * testsuite/many_sections_test.cc: Add template.
16351
16352 2008-04-30  Cary Coutant  <ccoutant@google.com>
16353
16354         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16355
16356         * layout.cc (Layout::include_section): Refactored check for debug
16357         info section.
16358         (Layout::add_comdat): Add new parameters.  Change type
16359         of signature parameter.  Add object and shndx to signatures table.
16360         (Layout::find_kept_object): New function.
16361         * layout.h: Include <cstring>.
16362         (Layout::is_debug_info_section): New function.
16363         (Layout::add_comdat): Add new parameters.
16364         (Layout::find_kept_object): New function.
16365         (Layout::Kept_section): New struct.
16366         (Layout::Signatures): Change type of map range.
16367         * object.cc (Relobj::output_section_address): New function.
16368         (Sized_relobj::include_section_group): Add new parameters.  Change
16369         calls to Layout::add_comdat.  Change to build table of kept comdat
16370         groups and table mapping discarded sections to kept sections.
16371         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16372         (Sized_relobj::do_layout): Change calls to include_section_group and
16373         include_linkonce_section.
16374         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16375         value to zero when section is discarded.
16376         (Sized_relobj::map_to_kept_section): New function.
16377         * object.h (Relobj::output_section_address): New function.
16378         (Relobj::Comdat_group): New type.
16379         (Relobj::find_comdat_group): New function.
16380         (Relobj::Comdat_group_table): New type.
16381         (Relobj::Kept_comdat_section): New type.
16382         (Relobj::Kept_comdat_section_table): New type.
16383         (Relobj::add_comdat_group): New function.
16384         (Relobj::set_kept_comdat_section): New function.
16385         (Relobj::get_kept_comdat_section): New function.
16386         (Relobj::comdat_groups_): New field.
16387         (Relobj::kept_comdat_sections_): New field.
16388         (Symbol_value::input_value): Update comment.
16389         (Sized_relobj::map_to_kept_section) New function.
16390         (Sized_relobj::include_linkonce_section): Add new parameter.
16391         * target-reloc.h (Comdat_behavior): New type.
16392         (get_comdat_behavior): New function.
16393         (relocate_section): Add code to map a discarded section to the
16394         corresponding kept section when applying a relocation.
16395
16396 2008-04-30  Craig Silverstein  <csilvers@google.com>
16397
16398         * dwarf_reader.cc (next_generation_count): New static var.
16399         (Addr2line_cache_entry): New struct.
16400         (addr2line_cache): New static var.
16401         (Dwarf_line_info::one_addr2line): Added caching.
16402         (Dwarf_line_info::clear_addr2line_cache): New function.
16403         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16404         cache-size parameter.
16405         (Dwarf_line_info::one_addr2line_cache): New function.
16406         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16407         new cache-size argument to one_addr2line(), and clear cache.
16408
16409 2008-04-28  Cary Coutant  <ccoutant@google.com>
16410
16411         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16412         R_386_PC8 relocations.
16413
16414 2008-04-23  Ian Lance Taylor  <iant@google.com>
16415
16416         * object.cc (Sized_relobj::include_section_group): Check for
16417         invalid section group.
16418
16419         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16420         header size.
16421
16422         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16423         than read for file header.
16424         * archive.cc (Archive::include_member): Likewise.
16425
16426 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16427
16428         * aclocal.m4: Regenerate.
16429         * configure: Regenerate.
16430
16431 2008-04-19  Ian Lance Taylor  <iant@google.com>
16432
16433         * version.cc (version_string): Bump to 1.6.
16434
16435         * testsuite/Makefile.am (many_sections_r_test): New target.
16436         (many_sections_r_test_SOURCES): Remove.
16437         (many_sections_r_test_DEPENDENCIES): Remove.
16438         (many_sections_r_test_LDFLAGS): Remove.
16439         (many_sections_r_test_LDADD): Remove.
16440
16441         * object.cc (Sized_relobj::do_add_symbols): Always pass
16442         local_symbol_count_ to add_from_relobj.
16443
16444         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16445         every thousand variables.
16446         * testsuite/Makefile.in: Rebuild.
16447
16448         * object.cc (Xindex::initialize_symtab_xindex): New function.
16449         (Xindex::read_symtab_xindex): New function.
16450         (Xindex::sym_xindex_to_shndx): New function.
16451         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16452         available.
16453         (Sized_relobj::do_initialize_xindex): New function.
16454         (Sized_relobj::do_read_symbols): Adjust section links.
16455         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16456         parameter.  Change all callers.
16457         (Sized_relobj::include_section_group): Adjust section links and
16458         symbol section indexes.
16459         (Sized_relobj::do_layout): Adjust section links.
16460         (Sized_relobj::do_count_local_symbols): Adjust section links and
16461         symbol section indexes.
16462         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16463         ordinary and special symbols.
16464         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16465         dynsym_xindex parameters.  Change all callers.  Adjust section
16466         links.  Use SHN_XINDEX when needed.
16467         (Sized_relobj::get_symbol_location_info): Adjust section links.
16468         Don't get fooled by special symbols.
16469         * object.h (class Xindex): Define.
16470         (class Object): Add xindex_ parameter.  Declare virtual functoin
16471         do_initialize_xindex.
16472         (Object::adjust_sym_shndx): New function.
16473         (Object::set_xindex): New protected function.
16474         (class Symbol_value): Add is_ordinary_shndx_ field.
16475         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16476         (Symbol_value::value): Assert ordinary section.
16477         (Symbol_value::initialize_input_to_output_map): Likewise.
16478         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16479         Change all callers.
16480         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16481         all callers.
16482         (class Sized_relobj): Update declarations.
16483         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16484         parameter.  Change all callers.
16485         (Sized_relobj::adjust_shndx): New function.
16486         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16487         field.
16488         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16489         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16490         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16491         (Sized_dynobj::read_dynsym_section): Adjust section links.
16492         (Sized_dynobj::read_dynamic): Likewise.
16493         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16494         section links.
16495         (Sized_dynobj::do_initialize_xindex): New function.
16496         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16497         do_initialize_xindex.
16498         (Sized_dynobj::adjust_shndx): New function.
16499         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16500         dynsym_xindex_ fields.
16501         (Layout::finalize): Add a call to set_section_indexes before
16502         creating the symtab sections.
16503         (Layout::set_section_indexes): Don't do anything if the section
16504         already has a section index.
16505         (Layout::create_symtab_sections): Add shnum parameter.  Change
16506         caller.  Create .symtab_shndx section if needed.
16507         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16508         caller.
16509         (Layout::allocated_output_section_count): New function.
16510         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16511         needed.
16512         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16513         fields.  Update declarations.
16514         (Layout::symtab_xindex): New function.
16515         (Layout::dynsym_xindex): New function.
16516         (class Write_symbols_task): Add layout_ field.
16517         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16518         Change caller.
16519         * output.cc (Output_section_headers::Output_section_headers): Add
16520         shstrtab_section parameter.  Change all callers.
16521         (Output_section_headers::do_sized_write): Store overflow values
16522         for section count and section string table section index in
16523         section header zero.
16524         (Output_file_header::do_sized_write): Check for overflow of
16525         section count and section string table section index.
16526         (Output_symtab_xindex::do_write): New function.
16527         (Output_symtab_xindex::endian_do_write): New function.
16528         * output.h (class Output_section_headers): Add shstrtab_section_.
16529         Update declarations.
16530         (class Output_symtab_xindex): Define.
16531         (Output_section::has_out_shndx): New function.
16532         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16533         field.
16534         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16535         Change all callers.
16536         (Sized_symbol::init): Likewise.
16537         (Symbol::output_section): Check for ordinary symbol.
16538         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16539         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16540         callers.
16541         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16542         Change all callers.  Simplify handling of symbols from sections
16543         not included in the link.
16544         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16545         distinction.
16546         (Weak_alias_sorter::operator()): Assert that symbols are
16547         ordinary.
16548         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16549         distinction.
16550         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16551         parameters.  Change all callers.
16552         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16553         symbol distinction.  Use SHN_XINDEX when needed.
16554         (Symbol_table::write_section_symbol): Add symtab_xindex
16555         parameter.  Change all callers.
16556         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16557         SHN_XINDEX when needed.
16558         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16559         declarations.
16560         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16561         (Symbol::is_defined): Check is_ordinary.
16562         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16563         (Symbol::is_absolute, Symbol::is_common): Likewise.
16564         (class Sized_symbol): Update declarations.
16565         (class Symbol_table): Update declarations.
16566         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16567         parameters.  Change all callers.
16568         (Sized_symbol::override): Likewise.
16569         (Symbol_table::override): Likewise.
16570         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16571         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16572         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16573         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16574         to be in an ordinary section.
16575         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16576         object and is_ordinary parameters.  Change all callers.
16577         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16578         Change all callers.  Don't add undefined or non-ordinary symbols
16579         to reloc_map_.
16580         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16581         Change all callers.
16582         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16583         declarations.
16584         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16585         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16586         (Sized_relobj::relocate_sections): Likewise.
16587         * target-reloc.h (scan_relocs): Adjust section symbol index.
16588         (scan_relocatable_relocs): Likewise.
16589         * i386.cc (Scan::local): Check for ordinary symbols.
16590         * sparc.cc (Scan::local): Likewise.
16591         * x86_64.cc (Scan::local): Likewise.
16592         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16593         to symbol_section_and_value.
16594         * testsuite/many_sections_test.cc: New file.
16595         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16596         (check_PROGRAMS): Add many_sections_test.
16597         (many_sections_test_SOURCES): Define.
16598         (many_sections_test_DEPENDENCIES): Define.
16599         (many_sections_test_LDFLAGS): Define.
16600         (BUILT_SOURCES): Add many_sections_define.h.
16601         (many_sections_define.h): New target.
16602         (BUILT_SOURCES): Add many_sections_check.h.
16603         (many_sections_check.h): New target.
16604         (check_PROGRAMS): Add many_sections_r_test.
16605         (many_sections_r_test_SOURCES): Define.
16606         (many_sections_r_test_DEPENDENCIES): Define.
16607         (many_sections_r_test_LDFLAGS): Define.
16608         (many_sections_r_test_LDADD): Define.
16609         (many_sections_r_test.o): New target.
16610         * testsuite/Makefile.in: Rebuild.
16611
16612 2008-04-17  Cary Coutant  <ccoutant@google.com>
16613
16614         * errors.cc (Errors::info): New function.
16615         (gold_info): New function.
16616         * errors.h (Errors::info): New function.
16617         * gold.h (gold_info): New function.
16618         * object.cc (Input_objects::add_object): Print trace output.
16619         * options.cc (options::parse_set): New function.
16620         (General_options::parse_wrap): Deleted.
16621         (General_options::General_options): Deleted initializer.
16622         * options.h (options::String_set): New typedef.
16623         (options::parse_set): New function.
16624         (DEFINE_set): New macro.
16625         (General_options::wrap): Changed to use DEFINE_set. Changed
16626         callers of any_wrap_symbols and is_wrap_symbol.
16627         (General_options::trace, General_options::trace_symbol):
16628         New options.
16629         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16630         (General_options::wrap_symbols_): Deleted.
16631         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16632
16633 2008-04-17  David S. Miller  <davem@davemloft.net>
16634
16635         * options.cc (General_options::parse_V): New function.
16636         * options.h: Add entries for -V and -Qy.
16637
16638 2008-04-17  Ian Lance Taylor  <iant@google.com>
16639
16640         * common.cc (Symbol_table::allocate_commons): Remove options
16641         parameter.  Change caller.
16642         (Symbol_table::do_allocate_commons): Remove options parameter.
16643         Change caller.  Just call do_allocate_commons_list twice.
16644         (Symbol_table::do_allocate_commons_list): New function, broken out
16645         of do_allocate_commons.
16646         * common.h (class Allocate_commons_task): Remove options_ field.
16647         Update constructor.
16648         * symtab.cc (Symbol_table::Symbol_table): Initialize
16649         tls_commons_.
16650         (Symbol_table::add_from_object): Put TLS common symbols on
16651         tls_commons_ list.
16652         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16653         which are IN_OUTPUT_DATA.
16654         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16655         allocate_commons and do_allocate_commons declarations.  Declare
16656         do_allocate_commons_list.
16657         * gold.cc (queue_middle_tasks): Update creation of
16658         Allocate_commons_task to not pass options.
16659         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16660         (TLS_TEST_C_FLAGS): New variable.
16661         (tls_test_c_pic.o): New target.
16662         (tls_test_shared.so): Link in tls_test_c_pic.o.
16663         (tls_test_c_pic_ie.o): New target.
16664         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16665         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16666         (tls_test_c.o): New target.
16667         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16668         (tls_pic_test_LDADD): Likewise.
16669         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16670         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16671         (tls_test_c_gnu2.o): New target.
16672         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16673         tls_test_c_gnu2.o.
16674         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16675         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16676         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16677         * testsuite/tls_test.cc: Include "config.h".
16678         (t_last): Call t11_last.
16679         * testsuite/tls_test.h (t11, t11_last): Declare.
16680         * testsuite/tls_test_c.c: New file.
16681         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16682         * configure.ac: Check for OpenMP support.
16683         * configure, config.in, Makefile.in: Rebuild.
16684         * testsuite/Makefile.in: Rebuild.
16685
16686 2008-04-16  Cary Coutant  <ccoutant@google.com>
16687
16688         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16689         (Target_i386::tls_base_symbol_defined_): New field.
16690         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16691         (Target_i386::Scan::global): Likewise.
16692         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16693         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16694         (Target_x86_64::tls_base_symbol_defined_): New field.
16695         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16696         (Target_x86_64::Scan::global): Likewise.
16697
16698 2008-04-16  Cary Coutant  <ccoutant@google.com>
16699
16700         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16701         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16702         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16703         building shared libraries.
16704         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16705         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16706         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16707         * testsuite/Makefile.in: Rebuild.
16708         * testsuite/weak_undef.h: New file.
16709         * testsuite/weak_undef_file1.cc: Add extra test cases.
16710         * testsuite/weak_undef_file2.cc: Likewise.
16711         * testsuite/weak_undef_test.cc: Likewise.
16712
16713 2008-04-16  David S. Miller  <davem@davemloft.net>
16714
16715         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16716         Add issued_non_pic_error_ field.  Declare check_non_pic.
16717         (Target_sparc::Scan::check_non_pic): New function.
16718         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16719         (Target_sparc::Scan::global): Likewise.
16720
16721         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16722         * configure: Rebuild.
16723
16724         * options.h (DEFINE_enable): New macro.
16725         (new_dtags): New enable option.
16726         (initfirst, interpose, loadfltr, nodefaultlib,
16727         nodelete, nodlopen, nodump): New -z options.
16728         * layout.cc (Layout:finish_dynamic_section): If new
16729         dtags enabled, emit DT_RUNPATH.  Also, emit a
16730         DT_FLAGS_1 containing any specified -z flags.
16731
16732 2008-04-16  Ian Lance Taylor  <iant@google.com>
16733
16734         * copy-relocs.cc: New file.
16735         * copy-relocs.h: New file.
16736         * reloc.cc: Remove Copy_relocs code.
16737         * reloc.h: Likewise.
16738         * reloc-types.h (struct Reloc_types) [both versions]: Add
16739         get_reloc_addend_noerror.
16740         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16741         variants of add_global which take an addend which must be zero.
16742         * i386.cc: Include "copy-relocs.h".
16743         (class Target_i386): Change type of copy_relocs_ to variable,
16744         update initializer.
16745         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16746         Change all callers.
16747         (Target_i386::do_finalize_sections): Change handling of
16748         copy_relocs_.
16749         * sparc.cc: Include "copy-relocs.h".
16750         (class Target_sparc): Change type of copy_relocs_ to variable,
16751         update initializer.
16752         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16753         Change all callers.
16754         (Target_sparc::do_finalize_sections): Change handling of
16755         copy_relocs_.
16756         * x86_64.cc: Include "copy-relocs.h".
16757         (class Target_x86_64): Change type of copy_relocs_ to variable,
16758         update initializer.
16759         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16760         class.  Change all callers.
16761         (Target_x86_64::do_finalize_sections): Change handling of
16762         copy_relocs_.
16763         * Makefile.am (CCFILES): Add copy-relocs.cc.
16764         (HFILES): Add copy-relocs.h.
16765
16766         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16767
16768         * testsuite/script_test_4.sh: Permit leading zeroes.
16769
16770 2008-04-15  Ian Lance Taylor  <iant@google.com>
16771
16772         * script-sections.cc (Script_sections::create_segments): Use
16773         header_size_adjustment even when there is enough room for the
16774         headers.
16775         * testsuite/script_test_4.sh: New file.
16776         * testsuite/script_test_4.t: New file.
16777         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16778         (check_DATA): Add script_test_4.stdout.
16779         (MOSTLYCLEANFILES): Likewise.
16780         (script_test_4): New target.
16781         (script_test_4.stdout): New target.
16782         * testsuite/Makefile.in: Rebuild.
16783
16784         * sparc.cc: Add definitions for Output_data_plt_sparc class
16785         constants.
16786
16787 2008-04-14  David S. Miller  <davem@davemloft.net>
16788
16789         * sparc.cc: New file.
16790         * Makefile.am (TARGETSOURCES): Add sparc.cc
16791         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16792         * configure.tgt: Document targ_extra_size and
16793         targ_extra_big_endian.  Add entries for sparc-* and
16794         sparc64-*.
16795         * configure.ac: Handle targ_extra_size and
16796         targ_extra_big_endian.
16797         * Makefile.in: Rebuild.
16798         * configure: Likewise.
16799         * po/POTFILES.in: Likewise.
16800         * po/gold.pot: Likewise.
16801
16802 2008-04-14  Ian Lance Taylor  <iant@google.com>
16803
16804         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16805         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16806         in the name/type/flags to section mapping.  Don't call
16807         allocate_output_section.
16808         (Layout::choose_output_section): Change parameter from adjust_name
16809         to is_input_section.  Don't permit input sections after sections
16810         are attached to segments.  Don't call allocate_output_section.
16811         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16812         not write_enable_output_section.
16813         (Layout::make_output_section): Don't push to
16814         unattached_section_list_ nor call attach_to_segment.  Call
16815         attach_section_to_segment if sections are attached.
16816         (Layout::attach_sections_to_segments): New function.
16817         (Layout::attach_section_to_segment): New function.
16818         (Layout::attach_allocated_section_to_segment): Rename from
16819         attach_to_segment.  Remove flags parameter.
16820         (Layout::allocate_output_section): Remove function.
16821         (Layout::write_enable_output_section): Remove function.
16822         * layout.h (class Layout): Update for above changes.  Add new
16823         field sections_are_attached_.
16824         * output.h (Output_section::update_flags_for_input_section): New
16825         function.
16826         * output.cc (Output_section::add_input_section): Call
16827         update_flags_for_input_section.
16828         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16829
16830 2008-04-11  Cary Coutant  <ccoutant@google.com>
16831
16832         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16833         thought unnecessary.
16834         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16835
16836 2008-04-11  Ian Lance Taylor  <iant@google.com>
16837
16838         * output.h (class Output_section_data): Remove inline definition
16839         of set_addralign.
16840         * output.cc (Output_section_data::set_addralign): New function.
16841
16842 2008-04-11  Cary Coutant  <ccoutant@google.com>
16843
16844         Add support for TLS descriptors for i386 and x86_64.
16845         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16846         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16847         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16848         GOT_TYPE_TLS_DESC.
16849         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16850         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16851         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16852         relocations.
16853         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16854         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16855         Fix problem with initial-exec relocations.
16856         (Target_i386::Relocate::relocate_tls): Likewise.
16857         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16858         relaxation.
16859         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16860         support for section-plus-offset dynamic table entries.
16861         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16862         (Output_data_dynamic::Dynamic_entry): Add support for
16863         section-plus-offset dynamic table entries.
16864         (Output_data_dynamic::Classification): Likewise.
16865         (Output_data_dynamic::classification_): Renamed offset_.
16866         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16867         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16868         (Target_x86_64::make_plt_section): New function.
16869         (Target_x86_64::reserve_tlsdesc_entries): New function.
16870         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16871         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16872         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16873         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16874         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16875         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16876         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16877         add extra PLT entry for TLS descriptors.
16878         (Output_data_plt_x86_64::got_): New field.
16879         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16880         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16881         fields.
16882         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16883         descriptors.
16884         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16885         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16886         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16887         R_386_TLS_DESC_CALL relocations.
16888         (Target_x86_64::Scan::global): Likewise.
16889         (Target_x86_64::do_finalize_sections): Add dynamic table entries
16890         for TLS descriptors.
16891         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16892         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16893         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16894         GD-to-IE relaxation.
16895         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16896         and TLS_DESCRIPTORS.
16897         * Makefile.in: Rebuild.
16898         * configure: Rebuild.
16899         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16900         (tls_test_shared2.so): New target.
16901         (tls_shared_gd_to_ie_test_SOURCES): New variable.
16902         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16903         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16904         (tls_shared_gd_to_ie_test_LDADD): New variable.
16905         (tls_shared_gnu2_gd_to_ie_test): New target.
16906         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16907         New targets.
16908         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16909         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16910         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16911         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16912         (tls_shared_gnu2_test): New target.
16913         (tls_test_gnu2_shared.so): New target.
16914         (tls_shared_gnu2_test_SOURCES): New variable.
16915         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16916         (tls_shared_gnu2_test_LDFLAGS): New variable.
16917         (tls_shared_gnu2_test_LDADD): New variable.
16918         * testsuite/Makefile.in: Rebuild.
16919         * testsuite/Makefile.
16920
16921 2008-04-11  Ian Lance Taylor  <iant@google.com>
16922
16923         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16924         justsyms.t.
16925         * testsuite/Makefile.in: Rebuild.
16926
16927         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16928         long.
16929         * testsuite/script_test_2.cc (main): Adjust test.
16930
16931 2008-04-11  David S. Miller  <davem@davemloft.net>
16932             Ian Lance Taylor  <iant@google.com>
16933
16934         * options.h (General_options): Add entries for '-Y' and
16935         '-relax'.
16936         * options.cc (General_options:finalize): If -Y was used, add those
16937         entries to the library path instead of the default "/lib" and
16938         "/usr/lib".
16939
16940 2008-04-11  David S. Miller  <davem@davemloft.net>
16941
16942         * testsuite/justsyms.t: Start at 0x100.
16943         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16944         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16945         long.
16946         * testsuite/script_test_2.cc: Adjust string and section length
16947         checks.
16948
16949 2008-04-09  Ian Lance Taylor  <iant@google.com>
16950
16951         PR gold/5996
16952         * script-sections.cc (Sections_element::allocate_to_segment): Add
16953         orphan parameter.
16954         (Output_section_definition::allocate_to_segment): Likewise.
16955         (Orphan_output_section::allocate_to_segment): Likewise.
16956         (Script_sections::attach_sections_using_phdrs_clause): Don't
16957         propagate non-PT_LOAD segments to orphan sections.
16958         * testsuite/Makefile.am (script_test_3.stdout): Generate using
16959         readelf rather than objdump.
16960         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
16961         .interp section and PT_INTERP segment are the same size.
16962         * testsuite/Makefile.in: Rebuild.
16963
16964         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16965         aliases for symbols defined in the same object.
16966         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16967         (weak_alias_test_SOURCES): New variable.
16968         (weak_alias_test_DEPENDENCIES): New variable.
16969         (weak_alias_test_LDFLAGS): New variable.
16970         (weak_alias_test_LDADD): New variable.
16971         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16972         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16973         (weak_alias_test_3.o): New target.
16974         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16975         * testsuite/weak_alias_test_main.cc: New file.
16976         * testsuite/weak_alias_test_1.cc: New file.
16977         * testsuite/weak_alias_test_2.cc: New file.
16978         * testsuite/weak_alias_test_3.cc: New file.
16979
16980 2008-04-08  Ian Lance Taylor  <iant@google.com>
16981
16982         * options.h (class General_options): Add --noinhibit-exec option.
16983         * main.cc (main): Check --noinhibit-exec.
16984
16985         * options.h (class General_options): Define --wrap as a special
16986         option.  Add wrap_symbols_ field.
16987         (General_options::any_wrap_symbols): New function.
16988         (General_options::is_wrap_symbol): New function.
16989         * options.cc (General_options::parse_wrap): New function.
16990         (General_options::General_options): Initialize wrap_symbols_.
16991         * symtab.cc (Symbol_table::wrap_symbol): New function.
16992         (Symbol_table::add_from_object): Handle --wrap.
16993         * symtab.h (class Symbol_table): Declare wrap_symbol.
16994         * target.h (Target::wrap_char): New function.
16995         (Target::Target_info): Add wrap_char field.
16996         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16997         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16998         * testsuite/testfile.cc (Target_test::test_target_info):
16999         Likewise.
17000
17001         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17002         there is one.
17003
17004         * layout.h (class Layout): Add added_eh_frame_data_ field.
17005         * layout.cc (Layout::Layout): Initialize new field.
17006         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17007         output section until we find a section we merged successfully.
17008         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17009         that the size be non-zero.
17010
17011         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17012         qualifier.
17013
17014 2008-04-08  Craig Silverstein  <csilvers@google.com>
17015
17016         * configure.ac: Export new conditional variable HAVE_ZLIB.
17017         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17018         on HAVE_ZLIB.
17019         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17020         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17021
17022 2008-04-07  Ian Lance Taylor  <iant@google.com>
17023
17024         * version.cc (version_string): Set to "1.5".
17025
17026         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17027         Add issued_non_pic_error_ field.  Declare check_non_pic.
17028         (Target_x86_64::Scan::check_non_pic): New function.
17029         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17030         (Target_x86_64::Scan::global): Likewise.
17031
17032         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17033         addend parameter.  Change caller.  Handle merge sections.
17034         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17035         Address to Addend.  Don't add in the result of
17036         local_section_offset, pass down the addend and use the returned
17037         value.
17038         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17039         Update declarations of local_section_offset and symbol_value.
17040         * testsuite/two_file_test_1.cc (t18): New function.
17041         * testsuite/two_file_test_2.cc (f18): New function.
17042         * testsuite/two_file_test_main.cc (main): Call t18.
17043         * testsuite/two_file_test.h (t18, f18): Declare.
17044
17045         * configure.ac: Don't test for objdump, c++filt, or readelf.
17046         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17047         conditionals.
17048         (TEST_READELF): New variable.
17049         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17050         (check_PROGRAMS): Add two_file_strip_test.
17051         (two_file_strip_test): New target.
17052         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17053         (two_file_same_shared_strip_test_SOURCES): New variable.
17054         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17055         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17056         (two_file_same_shared_strip_test_LDADD): New variable.
17057         (two_file_shared_strip.so): New target.
17058         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17059         (ver_test_5.syms, ver_test_7.syms): Likewise.
17060         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17061         (strip_test_3.stdout): Use TEST_OBJDUMP.
17062         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17063
17064 2008-04-04  Cary Coutant  <ccoutant@google.com>
17065
17066         * symtab.h (Symbol::is_weak_undefined): New function.
17067         (Symbol::is_strong_undefined): New function.
17068         (Symbol::is_absolute): New function.
17069         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17070         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17071         absolute symbols.
17072         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17073         (weak_undef_test): New target.
17074         * testsuite/Makefile.in: Rebuild.
17075         * testsuite/weak_undef_file1.cc: New file.
17076         * testsuite/weak_undef_file2.cc: New file.
17077         * testsuite/weak_undef_test.cc: New file.
17078
17079 2008-04-03  Craig Silverstein  <csilvers@google.com>
17080
17081         * compressed_output.h (class Output_compressed_section): Use
17082         unsigned buffer.
17083         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17084         add zlib header.
17085         (zlib_compressed_suffix): Removed.
17086         (Output_compressed_section::set_final_data_size): Use unsigned
17087         buffers.
17088         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17089         Fix linker invocation.
17090         (flagstest_o_specialfile_and_compress_debug_sections):
17091         Likewise.
17092         * testsuite/Makefile.in: Regenerated.
17093
17094 2008-04-02  David S. Miller  <davem@davemloft.net>
17095
17096         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17097         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17098
17099 2008-04-02  Craig Silverstein  <csilvers@google.com>
17100
17101         * TODO: New file.
17102
17103 2008-04-02  Ian Lance Taylor  <iant@google.com>
17104
17105         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17106         parameters.  Update for new key type to views_.  Change all
17107         callers.
17108         (File_read::read): Adjust for byteshift in returned view.
17109         (File_read::add_view): New function, broken out of
17110         find_and_make_view.
17111         (File_read::make_view): New function, broken out of
17112         find_and_make_view.
17113         (File_read::find_or_make_view): Add offset and aligned
17114         parameters.  Rewrite accordingly.  Change all callers.
17115         (File_read::get_view): Add offset and aligned parameters.  Adjust
17116         for byteshift in return value.
17117         (File_read::get_lasting_view): Likewise.
17118         * fileread.h (class File_read): Update declarations.
17119         (class File_read::View): Add byteshift_ field.  Add byteshift to
17120         constructor.  Add byteshift method.
17121         * archive.h (Archive::clear_uncached_views): New function.
17122         (Archive::get_view): Add aligned parameter.  Change all callers.
17123         * object.h (Object::get_view): Add aligned parameter.  Change all
17124         callers.
17125         (Object::get_lasting_view): Likewise.
17126
17127         * fileread.cc (File_read::release): Don't call clear_views if
17128         there are multiple objects.
17129         * fileread.h (File_read::clear_uncached_views): New function.
17130         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17131         on the archive.
17132
17133 2008-03-31  Cary Coutant  <ccoutant@google.com>
17134
17135         Add thin archive support.
17136         * archive.cc (Archive::armagt): New const.
17137         (Archive::setup): Remove task parameter and calls to unlock.
17138         (Archive::unlock_nested_archives): New function.
17139         (Archive::read_header): Add nested_off parameter. Change
17140         all callers.
17141         (Archive::interpret_header): Likewise.
17142         (Archive::include_all_members): Change to handle thin
17143         archives.
17144         (Archive::include_member): Likewise.
17145         * archive.h (Archive::Archive): Add new parameters and
17146         initializers.
17147         (Archive::armagt): New const.
17148         (Archive::setup): Remove task parameter.
17149         (Archive::unlock_nested_archives): New function.
17150         (Archive::read_header): Add nested_off parameter.
17151         (Archive::interpret_header): Likewise.
17152         (Archive::Nested_archive_table): New typedef.
17153         (Archive::is_thin_archive_): New field.
17154         (Archive::nested_archives_): New field.
17155         (Archive::options_): New field.
17156         (Archive::dirpath_): New field.
17157         (Archive::task_): New field.
17158         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17159         for thin archives.  Pass additional parameters to
17160         Archive::Archive.  Unlock the archive file after calling
17161         Archive::setup.
17162
17163 2008-03-29  Ian Lance Taylor  <iant@google.com>
17164
17165         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17166         version symbol to be local.
17167         * testsuite/ver_test_4.sh: New file.
17168         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17169         (check_DATA): Add ver_test_4.syms.
17170         (ver_test_4.syms): New target.
17171         * testsuite/Makefile.in: Rebuild.
17172
17173         * output.cc
17174         (Output_section::Input_section_sort_entry::has_priority): New
17175         function.
17176         (Output_section::Input_section_sort_entry::match_file_name): New
17177         function.
17178         (Output_section::Input_section_sort_entry::match_section_name):
17179         Remove.
17180         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17181         Remove.
17182         (Output_section::Input_section_sort_entry::match_section_file):
17183         Remove.
17184         (Output_section::Input_section_sort_compare::operator()): Rewrite
17185         using new Input_section_sort_entry functions.  Sort crtbegin and
17186         crtend first.  Sort sections with no priority before sections with
17187         a priority.
17188         * testsuite/initpri1.c (d3): Check j != 4.
17189         (cd5): New constructor/destructor function.
17190         (main): Check j != 2.
17191
17192         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17193         new symbol when resolving, don't call set_is_default.
17194         * testsuite/ver_test_7.cc: New file.
17195         * testsuite/ver_test_7.sh: New file.
17196         * testsuite/Makefile.am (ver_test_7.so): New target.
17197         (ver_test_7.o): New target.
17198         (check_SCRIPTS): Add ver_test_7.sh.
17199         (check_DATA): Add ver_test_7.syms.
17200         (ver_test_7.syms): New target.
17201
17202 2008-03-28  Ian Lance Taylor  <iant@google.com>
17203
17204         * layout.cc (Layout::layout): If we see an input section with a
17205         name that needs sorting, set the must_sort flag for the output
17206         section.
17207         (Layout::make_output_section): If the name of the output section
17208         indicates that it might require sorting, set the may_sort flag.
17209         * output.h (Output_section::may_sort_attached_input_sections): New
17210         function.
17211         (Output_section::set_may_sort_attached_input_sections): New
17212         function.
17213         (Output_section::must_sort_attached_input_sections): New
17214         function.
17215         (Output_section::set_must_sort_attached_input_sections): New
17216         function.
17217         (class Output_section): Declare Input_section_sort_entry.  Define
17218         Input_section_sort_compare.  Declare
17219         sort_attached_input_sections.  Add new fields:
17220         may_sort_attached_input_sections_,
17221         must_sort_attached_input_sections_,
17222         attached_input_sections_are_sorted_.
17223         * output.cc (Output_section::Output_section): Initialize new
17224         fields.
17225         (Output_section::add_input_section): Add an entry to
17226         input_sections_ if may_sort or must_sort are true.
17227         (Output_section::set_final_data_size): Call
17228         sort_attached_input_sections if necessary.
17229         (Output_section::Input_section_sort_entry): Define new class.
17230         (Output_section::Input_section_sort_compare::operator()): New
17231         function.
17232         (Output_section::sort_attached_input_sections): New function.
17233         * configure.ac: Check whether the compiler supports constructor
17234         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17235         * testsuite/initpri1.c: New file.
17236         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17237         CONSTRUCTOR_PRIORITY.
17238         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17239         (initpri1_LDFLAGS): New variable.
17240         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17241
17242 2008-03-27  Ian Lance Taylor  <iant@google.com>
17243
17244         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17245         * testsuite/common_test_1.c: New file.
17246         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17247         (common_test_1_SOURCES): New variable.
17248         (common_test_1_DEPENDENCIES): New variable.
17249         (common_test_1_LDFLAGS): New variable.
17250
17251         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17252         and commons_ correctly when NAME/VERSION does not override
17253         NAME/NULL.
17254         * testsuite/ver_test_6.c: New file.
17255         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17256         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17257         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17258
17259 2008-03-26  Ian Lance Taylor  <iant@google.com>
17260
17261         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17262         of an undefined symbol from a version script.
17263         * testsuite/Makefile.am (ver_test_5.so): New target.
17264         (ver_test_5.o): New target.
17265         (check_SCRIPTS): Add ver_test_5.sh.
17266         (check_DATA): Add ver_test_5.syms.
17267         (ver_test_5.syms): New target.
17268         * testsuite/ver_test_5.cc: New file.
17269         * testsuite/ver_test_5.script: New file.
17270         * testsuite/ver_test_5.sh: New file.
17271         * Makefile.in, testsuite/Makefile.in: Rebuild.
17272
17273         PR gold/5986
17274         Fix problems building gold with gcc 4.3.0.
17275         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17276         (gold_error_at_location, gold_warning_at_location): Use it.
17277         * configure.ac: Check whether we can compile and use a template
17278         function with a printf attribute.
17279         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17280         when jumping over bytes.
17281         * object.cc: Instantiate Object::read_section_data.
17282         * debug.h: Include <cstring>
17283         * dwarf_reader.cc: Include <algorithm>
17284         * main.cc: Include <cstring>.
17285         * options.cc: Include <cstring>.
17286         * output.cc: Include <cstring>.
17287         * script.cc: Include <cstring>.
17288         * script.h: Include <string>.
17289         * symtab.cc: Include <cstring> and <algorithm>.
17290         * target-select.cc: Include <cstring>.
17291         * version.cc: Include <string>.
17292         * testsuite/testmain.cc: Include <cstdlib>.
17293         * configure, config.in: Rebuild.
17294
17295 2008-03-25  Ian Lance Taylor  <iant@google.com>
17296
17297         * options.cc: Include "../bfd/bfdver.h".
17298         (options::help): Print bug reporting address.
17299
17300         * version.cc (print_version): Adjust output for current value of
17301         BFD_VERSION_STRING.
17302
17303         * NEWS: New file.
17304
17305         * options.cc (options::help): Print list of supported targets.
17306         * target-select.h: Include <vector>.
17307         (class Target_selector): Make machine_, size_, and is_big_endian_
17308         fields const.  Add bfd_name_ and instantiated_target_ fields.
17309         (Target_selector::Target_selector): Add bfd_name parameter.
17310         (Target_selector::recognize): Make non-virtual, call
17311         do_recognize.
17312         (Target_selector::recognize_by_name): Make non-virtual, call
17313         do_recognize_by_name.
17314         (Target_selector::supported_names): New function.
17315         (Target_selector::bfd_name): New function.
17316         (Target_selector::do_instantiate_target): New pure virtual
17317         function.
17318         (Target_selector::do_recognize): New virtual function.
17319         (Target_selector::do_recognize_by_name): New virtual function.
17320         (Target_selector::instantiate_target): New private function.
17321         (supported_target_names): Declare.
17322         * target-select.cc (Target_selector::Target_selector): Update for
17323         new parameter and fields.
17324         (select_target_by_name): Check that the name matches before
17325         calling recognize_by_name.
17326         (supported_target_names): New function.
17327         * i386.cc (class Target_selector_i386): Update Target_selector
17328         constructor call.  Remove recognize and recognize_by_name.  Add
17329         do_instantiate_target.
17330         * x86_64.cc (class Target_selector_x86_64): Likewise.
17331         * testsuite/testfile.cc (class Target_selector_test): Update for
17332         changes to Target_selector.
17333
17334         * README: Rewrite, with some notes on unsupported features.
17335
17336 2008-03-24  Cary Coutant  <ccoutant@google.com>
17337
17338         * i386.cc (Target_i386::Got_type): New enum declaration.
17339         (Target_i386::Scan::local): Updated callers of Output_data_got
17340         member functions.
17341         (Target_i386::Scan::global): Likewise.
17342         (Target_i386::Relocate::relocate): Likewise.
17343         (Target_i386::Relocate::relocate_tls): Likewise.
17344         * object.h (Got_offset_list): New class.
17345         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17346         (Sized_relobj::local_got_offset): Likewise.
17347         (Sized_relobj::set_local_got_offset): Likewise.
17348         (Sized_relobj::local_has_tls_got_offset): Removed.
17349         (Sized_relobj::local_tls_got_offset): Removed.
17350         (Sized_relobj::set_local_tls_got_offset): Removed.
17351         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17352         * output.cc (Output_data_got::add_global): Added got_type parameter.
17353         (Output_data_got::add_global_with_rel): Likewise.
17354         (Output_data_got::add_global_with_rela): Likewise.
17355         (Output_data_got::add_global_pair_with_rel): New function.
17356         (Output_data_got::add_global_pair_with_rela): New function.
17357         (Output_data_got::add_local): Added got_type parameter.
17358         (Output_data_got::add_local_with_rel): Likewise.
17359         (Output_data_got::add_local_with_rela): Likewise.
17360         (Output_data_got::add_local_pair_with_rel): New function.
17361         (Output_data_got::add_local_pair_with_rela): New function.
17362         (Output_data_got::add_global_tls): Removed.
17363         (Output_data_got::add_global_tls_with_rel): Removed.
17364         (Output_data_got::add_global_tls_with_rela): Removed.
17365         (Output_data_got::add_local_tls): Removed.
17366         (Output_data_got::add_local_tls_with_rel): Removed.
17367         (Output_data_got::add_local_tls_with_rela): Removed.
17368         * output.h (Output_data_got::add_global): Added got_type parameter.
17369         (Output_data_got::add_global_with_rel): Likewise.
17370         (Output_data_got::add_global_with_rela): Likewise.
17371         (Output_data_got::add_global_pair_with_rel): New function.
17372         (Output_data_got::add_global_pair_with_rela): New function.
17373         (Output_data_got::add_local): Added got_type parameter.
17374         (Output_data_got::add_local_with_rel): Likewise.
17375         (Output_data_got::add_local_with_rela): Likewise.
17376         (Output_data_got::add_local_pair_with_rel): New function.
17377         (Output_data_got::add_local_pair_with_rela): New function.
17378         (Output_data_got::add_global_tls): Removed.
17379         (Output_data_got::add_global_tls_with_rel): Removed.
17380         (Output_data_got::add_global_tls_with_rela): Removed.
17381         (Output_data_got::add_local_tls): Removed.
17382         (Output_data_got::add_local_tls_with_rel): Removed.
17383         (Output_data_got::add_local_tls_with_rela): Removed.
17384         * resolve.cc (Symbol::override_base_with_special): Removed
17385         reference to has_got_offset_ field.
17386         * symtab.cc (Symbol::init_fields): Replaced initialization
17387         of got_offset_ with got_offsets_.  Removed initialization
17388         of has_got_offset_
17389         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17390         (Symbol::got_offset): Likewise.
17391         (Symbol::set_got_offset): Likewise.
17392         (Symbol::has_tls_got_offset): Removed.
17393         (Symbol::tls_got_offset): Removed.
17394         (Symbol::set_tls_got_offset): Removed.
17395         (Symbol::got_offset_): Removed.
17396         (Symbol::tls_mod_got_offset_): Removed.
17397         (Symbol::tls_pair_got_offset_): Removed.
17398         (Symbol::got_offsets_): New field.
17399         (Symbol::has_got_offset): Removed.
17400         (Symbol::has_tls_mod_got_offset): Removed.
17401         (Symbol::has_tls_pair_got_offset): Removed.
17402         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17403         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17404         member functions.
17405         (Target_x86_64::Scan::global): Likewise.
17406         (Target_x86_64::Relocate::relocate): Likewise.
17407         (Target_x86_64::Relocate::relocate_tls): Likewise.
17408
17409 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17410
17411         * yyscript.y: Fix spelling error in comment.
17412
17413 2008-03-24  Ian Lance Taylor  <iant@google.com>
17414
17415         * options.h (class General_options): Define build_id option.
17416         * layout.h (class Layout): Declare write_build_id, create_note,
17417         create_build_id.  Add build_id_note_ member.
17418         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17419         "libiberty.h", "md5.h", "sha1.h".
17420         (Layout::Layout): Initialize eh_frame_data_,
17421         eh_frame_hdr_section_, and build_id_note_.
17422         (Layout::finalize): Call create_build_id.
17423         (Layout::create_note): New function, broken out of
17424         Layout::create_gold_note.
17425         (Layout::create_gold_note): Call create_note.
17426         (Layout::create_build_id): New function.
17427         (Layout::write_build_id): New function.
17428         (Close_task_runner::run): Call write_build_id.
17429
17430         * x86_64.cc: Correct license to GPLv3.
17431
17432 2008-03-23  Ian Lance Taylor  <iant@google.com>
17433
17434         * options.cc: Include "demangle.h".
17435         (parse_optional_string): New function.
17436         (parse_long_option): Handle takes_optional_argument.
17437         (parse_short_option): Update dash_z initializer.  Handle
17438         takes_optional_argument.
17439         (General_options::General_options): Initialize do_demangle_.
17440         (General_options::finalize): Set do_demangle_.  Handle demangling
17441         style.
17442         * options.h (parse_optional_string): Declare.
17443         (struct One_option): Add optional_arg field.  Update constructor.
17444         Update call constructor calls.  Add takes_optional_argument
17445         function.
17446         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17447         (DEFINE_optional_string): Define.
17448         (General_options::demangle): Change from DEFINE_bool to
17449         DEFINE_optional_string.
17450         (General_options::no_demangle): New function.
17451         (General_options::do_demangle): New function.
17452         (General_options::set_do_demangle): New function.
17453         (General_options::execstack_status_): Move definition to end of
17454         class definition.
17455         (General_options::static_): Likewise.
17456         (General_options::do_demangle_): New field.
17457         * object.cc (big_endian>::get_symbol_location_info): Call
17458         Options::do_demangle, not Options::demangle.
17459         * symtab.cc (demangle): Likewise.
17460
17461 2008-03-22  Ian Lance Taylor  <iant@google.com>
17462
17463         * gold.h: Include <cstddef> and <sys/types.h>
17464         * options.h: Include <cstring>.
17465
17466 2008-03-21  Ian Lance Taylor  <iant@google.com>
17467
17468         * Added source code to GNU binutils.
17469 \f
17470 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17471
17472 Copying and distribution of this file, with or without modification,
17473 are permitted in any medium without royalty provided the copyright
17474 notice and this notice are preserved.
17475
17476 Local Variables:
17477 mode: change-log
17478 left-margin: 8
17479 fill-column: 74
17480 version-control: never
17481 End: